create account

RE: I made a tool that lets designers/programmers get top colors from a screenshot or design by pilcrow

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @blixt2/i-made-a-tool-that-lets-designers-programmers-get-top-colors-from-a-screenshot-or-design

· @pilcrow ·
Nice! Can you explain a little bit how you did this? I'm curious to learn how it works.
properties (22)
authorpilcrow
permlinkre-blixt2-i-made-a-tool-that-lets-designers-programmers-get-top-colors-from-a-screenshot-or-design-20170828t085057720z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-08-28 08:51:06
last_update2017-08-28 08:51:06
depth1
children1
last_payout2017-09-04 08:51:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length87
author_reputation2,531,070,549,481
root_title"I made a tool that lets designers/programmers get top colors from a screenshot or design"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id13,103,096
net_rshares0
@blixt2 ·
Sure! The principle is very simple, it just scans the entire image and counts up the number of equal colored pixels. Then it sorts the resulting map by number of instances (descending, so most common color is at the top) and trims the list at 100 before displaying it in the UI.

The rest is a bunch of JavaScript specific stuff, like getting the blob from drag & drop result, reading bytes from the canvas buffer, using promises to split up asynchronous parts, and so on. For gleaning into that it's probably best to skim through the code, it's written in ES6 flavor and should be fairly readable!
properties (22)
authorblixt2
permlinkre-pilcrow-re-blixt2-i-made-a-tool-that-lets-designers-programmers-get-top-colors-from-a-screenshot-or-design-20170828t144731209z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2017-08-28 14:47:30
last_update2017-08-28 14:47:30
depth2
children0
last_payout2017-09-04 14:47:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length598
author_reputation3,757,878,226
root_title"I made a tool that lets designers/programmers get top colors from a screenshot or design"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id13,130,628
net_rshares0