[magick-users] histogram and PerlMagick

Brian Jackson brian at actionathletics.com
Wed Nov 1 20:41:51 CST 2006


On Wednesday 01 November 2006 16:42, Anthony Thyssen wrote:
> Brian Jackson on  wrote...
>
> | "Anthony Thyssen" wrote:
> |
> | I don't see this.  I tried on all 3 of my boxes here and all
> | produce a MIFF and not a GIF.  Same as I noticed from PerlMagick
> |
> | 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
>
> Arrgggkkk! (You here the sound of a choking cough over the wires)...
>
> You are using IM v5! 3 years old!  You are really asking for trouble.

And the other 2 systems were v6.  this is not a version 5 vs version 6 
issue.

The same result happened on ALL 3 systems.  A MIFF is still produced.

>
> | Really stupid question, but what do I do with the output?  I want
> | to SEE- the histogram for red, green, blue, and value.
> |-
>
> To get a histogram for the seperate channels. you will need to
> separate those channels into separate images.

That's what I'm trying to do, but how to do it in Perl?   I tried the 
$img->Separate(-channel=>{red,green.blue}) syntax, but that didn't do 
what I wanted :(

> For IM v5 you will need to follow the techniques I outlined in the
> very old (and aborted) IM v5 Examples.  Your lucky it is actually
> still online, I was considering junking it!
>
>    http://www.cit.gu.edu.au/~anthony/graphics/imagick5/masks/
>
> EG for the red channel you will need to use something like...
>
>    convert image.jpg -channel red drawn.png +matte red.png
>    convert red.png histogram:red_histogram.miff
>    identify -format %c red_histogram.miff
>    convert -comment '' red_histogram.miff red_histogram.gif
>
> Note the use of separate commands and temporary files for each and
> every step in the image processing.  That is the IM v5 way.

Wow, that's a lot of typing when this does the same thing on the CLI:

convert -colorspace RGB -channel red image.jpg \
histogram:-|convert - red.png

I know for v6 from the CLI I need the -channel [RGB]  -separate tags and 
that works, but what I would REALLY like is a perl way of doing this 
without  files  :-D  Something that can produce the histograms for the 
different channels in memory and that perl/Tk will understand.


Also, on a completly different subject, can I say the documentation for 
version 6 has gone downhill!  Man pages replaced with web pages, and 
those are not as descriptive.  :(

thanks,
brian

-- 
Brian Jackson
Action Athletics Sports Photography
brian at actionathletics.com
http://www.ActionAthletics.com/


More information about the Magick-users mailing list