[magick-users] histogram and PerlMagick
Brian Jackson
brian at actionathletics.com
Wed Nov 1 16:42:15 CST 2006
On Wednesday 01 November 2006 13:13, Ron Savage wrote:
> 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?
Think 'levels' from The GIMP or Photoshop.
Here is what I'm looking for (obviously an underexposed image :)
http://brianjacksonphoto.com/histogram
> 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.
I will troll on your module and see if that will work for me.
> > 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...
Well, techically I do both. Professional photographer and contract perl
programmer, but mostly DB and system related stuff, no graphical
programming except charts for the reports systems I've written :)
> > 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?
Nothing wrong with PNG here. I like PNG, just wish certain browsers
from the NW of the US would interpret alpha values correctly.
MIFF is not a good format because my application is written in Perl/TK
and that's not a supported format. At present, only GIF, XBM, XPM,
BMP, JPEG, PNG and PPM/PGM formats are supported
> > 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?
Yes.
These give the desired outputs from the CLI. How do I replicate this in
perl?
convert -colorspace gray img.jpg histogram:- | display -
convert -colorspace RGB -channel red img.jpg histogram:- | display -
convert -colorspace RGB -channel blue img.jpg histogram:- | display -
convert -colorspace RGB -channel green img.jpg histogram:- | display -
> 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.
Exactly. Eventhough the extension is .GIF, the actual file format is a
MIFF.
thanks,
brian
--
Brian Jackson
Action Athletics Sports Photography
brian at actionathletics.com
http://www.ActionAthletics.com/
More information about the Magick-users
mailing list