Skip to content

Instantly share code, notes, and snippets.

@rtanglao
Last active May 30, 2016 05:39
Show Gist options
  • Save rtanglao/ed80e5b3008f11d7663d1f698d50073d to your computer and use it in GitHub Desktop.
Save rtanglao/ed80e5b3008f11d7663d1f698d50073d to your computer and use it in GitHub Desktop.
# from http://www.fmwconcepts.com/imagemagick/tidbits/image_info.php#ave_color
convert rose: -colorspace rgb -scale 1x1 \
-format "%[fx:floor(255*r)],%[fx:floor(255*g)],%[fx:floor(255*b)]" info:
# output is: rgb(146,89,80)
img = Magick::Image.read(path).first
pix = img.scale(1, 1)
averageColor = pix.pixel_color(0,0)
print averageColor.red (and then divide by 257)
# from http://stackoverflow.com/questions/5162929/is-it-possible-to-get-the-average-image-color-with-rmagick
@rtanglao
Copy link
Author

grep -o "#......"

@rtanglao
Copy link
Author

rtanglao commented May 30, 2016

also from:
http://stackoverflow.com/questions/25488338/how-to-find-average-color-of-an-image-with-imagemagick?rq=1

convert p4.png -resize 1x1 txt:-
  # ImageMagick pixel enumeration: 1,1,255,srgb
  0,0: (189,185,184)  #BDB9B8  srgb(189,185,184)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment