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++
Average color
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Average color
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
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