[magick-users] histogram and PerlMagick

Ron Savage ron at savage.net.au
Wed Nov 1 15:13:56 CST 2006


On Wed, 1 Nov 2006 11:27:52 -0700, Brian Jackson wrote:

Hi Brian

> Really stupid question, but what do I do with the output?  I want
> to SEE the histogram for red, green, blue, and value.

Ah, ha! Can you upload somewhere an image showing the sort of image you would 
like to see?

For example (I'm guessing of course), a bar chart, with each bar one color from 
the image and the height (or horizontal extent) of the image corresponding to 
the # of pixels of that color? There is a Perl module which does this:
http://search.cpan.org/~rsavage/Image-Magick-Chart-1.02/
but it may not do what you want. I'll write a demo over the (4 day) weekend.

Or did you have something else in mind?

> I'm not a graphics programmer, so the actual binary makeup of an
> image isn't my specialty.  I'm a photographer, who knows some perl
> :)

I'm the opposite - a Perl programmer who can hardly active the camera built in 
to my mobile phone...

> Could write out the red, green, blue, and opacity values separately
> and then convert the MIFF to a JPEG/PNG, etc?

My preferred output format is PNG. Is MIFF unacceptable to you for some reason?
 
> Would there be a way to select the channel and then produce a
> histogram from that?  Such as I do for the 'value' histogram right
> now.  Even if it's to a bunch of files, I can work with that.

A channel, e.g. 'red'? So you'd want all shades of red in the output, right?

> convert|head -1;convert rose: histogram:t.gif;file t.gif Version:
> ImageMagick 5.5.4 02/01/03 Q16 http://www.imagemagick.org t.gif:
> MIFF image data

I think I understand what's happening, but I could be raving (again). If you 
say:
convert rose: t.gif
the output is GIF because the file /suffix/ is definitive.
If you say:
convert rose: histogram:t.gif
the output is MIFF because the /prefix/ histogram is definitive.
So you could say:
convert rose: histogram:t.chocolate.frog
and the output will be MIFF, rather than a chocolate frog.
-- 
Cheers
Ron Savage, ron at savage.net.au on 2/11/2006
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company




More information about the Magick-users mailing list