Page 1 of 1

Average color

Posted: 2008-07-21T06:05:22-07:00
by imagetester
Is there any efficient way to get the average color of ANY image in a way to get Average Red=... Average Green=... Average Blue=...

And within the range 0-255 for each color.

I'm using magick++ library with c++

Re: Average color

Posted: 2008-07-21T17:51:40-07:00
by fmw42
convert this command line to magick++

convert rose: -scale 1x1! -depth 8 txt:-

returns
# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: (145, 89, 80) #915950 rgb(145,89,80)

or

convert rose: -scale 1x1! -format "%[fx:floor(255*u.r)],%[fx:floor(255*u.g)],%[fx:floor(255*u.b)]" info:

returns
145,89,80