Histogram Dimensions

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
matt
Posts: 4
Joined: 2010-08-17T06:33:10-07:00
Authentication code: 8675308

Histogram Dimensions

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

Re: Histogram Dimensions

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Histogram Dimensions

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
matt
Posts: 4
Joined: 2010-08-17T06:33:10-07:00
Authentication code: 8675308

Re: Histogram Dimensions

Post by matt »

Thanks guys!
Post Reply