Page 1 of 1

Histogram Dimensions

Posted: 2010-08-17T06:37:30-07:00
by matt
Hello everyone,

I’m using the histogram feature in ImageMagick and it is rendering the proper histogram, however, there is one thing that I’ve noticed with regards to the dimensions compared to histograms in other applications.

For example, ImageMagick histograms (at least mine anyways) are 256x200. The 256 makes sense as one column for each level. I’ve attached a sample histogram (with some slight modifications such as transparency etc.) entitled IM_Histogram.png. When I compare that to Photoshop’s histogram (PS_Histogram.png) I get the same histogram but photoshop seems to crop or compress the image to 100px in height or rather a 2.56 scale ratio. Looking at other programs out there (such as LightRoom – LR_Histogram.png – note this isn’t the same image so actual histogram is different) they have similar sizes. I have noted that for the most part they seems cropped and then resized down.

Basically my question is, is this some sort of standard? Why does ImageMagick pick 200px and other software shoots for a 256x100 image size. I’m not saying ImageMagick’s histogram is wrong because it isn’t I just would like to know why popular photo editing software is going one over the other.

If PS and LightRoom are the ‘preferred’ method to see histograms can I modify my command-line to do that kind of crop/resize (i.e. feed in the dimensions).

Hope you can help.

Thanks,

Matt

IM_Histogram.png
Image

PS_Histogram.png
Image

LR_Histogram.png
Image

Re: Histogram Dimensions

Posted: 2010-08-17T10:02:28-07:00
by fmw42
No idea why it is 256x200! Perhaps a simple multiple of 100 to make it bigger so you can see more details.

But make it any size you want:


convert rose: histogram:- | convert - -scale 256x100! rose_hist_256x100.gif

Image

Re: Histogram Dimensions

Posted: 2010-08-17T18:19:29-07:00
by anthony
It is just the size that was selected for histogram output. It is nothing special about it.

Internally I believe the histogram functions using 1024 bins and not 256 as the graph implies.

You can get the actual color data by getting the comment from the histogram image.

There is also an option to turn of that comment generation to make histogram work a little faster.

See IM Examples, Histogram Special File format Output
http://www.imagemagick.org/Usage/files/#histogram

Re: Histogram Dimensions

Posted: 2010-08-18T05:57:34-07:00
by matt
Thanks guys!