Testing with IM 6.4.2-4 Q16 (non-hdri) on Mac OSX Tiger:
The following two methods of getting the histogram are not quite the same. Some values are slightly different. I was under the impression that histogram was a subset of the miff format. Is this a bug? If not can you clarify why the difference is not a bug. Thanks. Fred
Method1:
convert rose: -colorspace rgb -colors 10 -format "%c" histogram:info:
575: ( 51, 50, 45) #33322D rgb(51,50,45)
544: (221, 54, 48) #DD3630 rgb(221,54,48)
376: (175, 65, 56) #AF4138 rgb(175,65,56)
289: ( 94, 93, 78) #5E5D4E rgb(94,93,78)
277: (110,146, 86) #6E9256 rgb(110,146,86)
277: (231, 81, 88) #E75158 rgb(231,81,88)
266: (212,211,217) #D4D3D9 rgb(212,211,217)
262: ( 98, 56, 47) #62382F rgb(98,56,47)
206: (139,133,145) #8B8591 rgb(139,133,145)
148: ( 83, 76, 55) #534C37 rgb(83,76,55)
Method 2:
convert rose: -colorspace rgb -colors 10 miff:- | convert - -format "%c" histogram:info:
575: ( 51, 51, 45) #33332D rgb(51,51,45)
544: (221, 54, 48) #DD3630 rgb(221,54,48)
376: (175, 66, 57) #AF4239 rgb(175,66,57)
289: ( 94, 93, 79) #5E5D4F rgb(94,93,79)
277: (110,147, 86) #6E9356 rgb(110,147,86)
277: (232, 81, 89) #E85159 rgb(232,81,89)
266: (213,211,217) #D5D3D9 rgb(213,211,217)
262: ( 98, 57, 47) #62392F rgb(98,57,47)
206: (140,133,146) #8C8592 rgb(140,133,146)
148: ( 83, 76, 56) #534C38 rgb(83,76,56)
The reason this is a problem is that when I tried to do the following to get the percent pixels with that color in an image by looking at the histogram from Method 1 (the normal way to do it) and then use:
color="rgb(110,146,86)"
convert rose: -colorspace rgb -colors 10 miff:- | \
convert - -fill white -opaque $color \
-fill black +opaque white \
-scale 1x1! -format "%[fx:100*u]%%" info:
It returns 0% (because it needs to use rgb(110,147,86) to work correctly.
There are other ways to get the same result, so it is not a critical issue. But I thought I would point this out and see if it is a bug due to some inconsistent code between histogram and miff
inconsistency in histogram and miff in IM 6.4.2-4
Re: inconsistency in histogram and miff in IM 6.4.2-4
The problem you reported is fixed in ImageMagick 6.4.2-5 Beta.