There is one other way to do the histogram. That is to separate each channel, append and get the histogram from all channel data together. A global sort of histogram. This seems to be what PS is doing. That is probably what they mean by RGB composite
convert PhotoBoothXmas_0109.JPG -separate +append -define histogram:unique-colors=false histogram:hist6.png
Your result from PS
Prior to IM 6.8.5.0 you would need to add -set colorspace RGB before the -separate.
It is odd to me that this is not the same or equivalent to averaging the channels by
convert PhotoBoothXmas_0109.JPG -separate -evaluate-sequence mean -define histogram:unique-colors=false histogram:hist7.png
which is the same as
convert PhotoBoothXmas_0109.JPG -colorspace OHTA -channel R -separate +channel -define histogram:unique-colors=false histogram:hist8.png
Aside: In my redist script, the global histogram is one of many options that can be used.
Histograms in Photoshop CS6 vs. IM
Re: Histograms in Photoshop CS6 vs. IM
Yes! I came upon the same result and came to post it when I saw yours. The only thing is a type. I believe you intended to write
with a "-" before append, yes?
That is indeed the RGB histogram shown by PS. The other one, converting to gray first, is equivalent to the "Luminosity" histogram in PS.
Victory! Big thanks to all! I would buy you a drink if I could.
Appending is not the same as averaging. When you append, only the highest value is shown, hiding the lower values. When you average, you show the mean
That begs another question, which is, why would users want to see only a composites of the highest values, rather than the means of the values?
- J
Code: Select all
convert PhotoBoothXmas_0109.JPG -separate -append -define histogram:unique-colors=false histogram:hist6.png
That is indeed the RGB histogram shown by PS. The other one, converting to gray first, is equivalent to the "Luminosity" histogram in PS.
Victory! Big thanks to all! I would buy you a drink if I could.
Appending is not the same as averaging. When you append, only the highest value is shown, hiding the lower values. When you average, you show the mean
That begs another question, which is, why would users want to see only a composites of the highest values, rather than the means of the values?
- J
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Histograms in Photoshop CS6 vs. IM
-append joins top-to-bottom, +append joins left-to-right. Since all you want is the histogram, it doesn't matter.
When you append, won't all values (every channel of every pixel) show in the histogram?blue-j wrote:When you append, only the highest value is shown, hiding the lower values.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Histograms in Photoshop CS6 vs. IM
I agree with GreenKoopa. Appending is not just showing the larger value. It is showing the histogram all the values R+G+B whereas averaging is getting the histogram of the averaged channels or (R+G+B)/3. Thus a scale factor of 3 or 1/3. The only difference might be (?) clipping if the sum is done and goes above 16 bits before the divide by 3. But I thought IM does all the processing in double precision floats. So I do not understand why it might clip.Appending is not the same as averaging. When you append, only the highest value is shown, hiding the lower values. When you average, you show the mean
Again, same as GreenKoopa. I used +append to append the images horizontally. But you would get the same result in this case of doing the histogram using -append to append the images vertically.
It kind of makes sense from the names. RGB combined means get the data from all the channels and make the histogram. Luminosity histogram means get the histogram from the luminosity channel Y=rec601luma. Y is from YUV, YIQ, YCbCr, etc., which is the same as colorspace gray. see http://www.imagemagick.org/script/comma ... colorspaceThat is indeed the RGB histogram shown by PS. The other one, converting to gray first, is equivalent to the "Luminosity" histogram in PS.
Last edited by fmw42 on 2013-05-31T15:31:59-07:00, edited 3 times in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Histograms in Photoshop CS6 vs. IM
Yes. Averaging is a primitive form of greyscale conversion. Appending uses the actual values of each channel. The difference can be readily seen:When you append, won't all values (every channel of every pixel) show in the histogram?
Code: Select all
convert xc:red xc:lime xc:blue -append test.png
convert test.png -separate -append -define histogram:unique-colors=false histogram:h3.png
convert test.png -separate -evaluate-sequence mean -define histogram:unique-colors=false histogram:h4.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Histograms in Photoshop CS6 vs. IM
That is a good example, snibgo. It would appear that it is a matter of putting the data into different bins rather than a clipping issue as I was just about to suggest. But your example makes it much clearer.
With the average here, you get 3 values of (255+0+0)/3 from rgb(255,0,0), rgb(0,255,0) and rgb(0,0,255). With all the channels you get 3 white (255) and 6 black (0) values. Great example.
Note the average (or mean) can also be obtained from the first channel of OHTA, which is not the same as colorspace gray. Colorspace gray is the same as luminosity, Y.
But your use of -separate -append and -separate -evaluate-sequence mean makes if very clear.
see also http://www.imagemagick.org/script/comma ... colorspace
With the average here, you get 3 values of (255+0+0)/3 from rgb(255,0,0), rgb(0,255,0) and rgb(0,0,255). With all the channels you get 3 white (255) and 6 black (0) values. Great example.
Note the average (or mean) can also be obtained from the first channel of OHTA, which is not the same as colorspace gray. Colorspace gray is the same as luminosity, Y.
But your use of -separate -append and -separate -evaluate-sequence mean makes if very clear.
see also http://www.imagemagick.org/script/comma ... colorspace
Re: Histograms in Photoshop CS6 vs. IM
Thanks so much for sharing your knowledge. This has been very informative for me! I enjoy learning about imaging a lot and appreciate this community and the mentorship you all give me. Thanks again!
J
J