[magick-users] histogram and PerlMagick

Brian Jackson brian at actionathletics.com
Thu Nov 2 22:54:01 CST 2006


On Thursday 02 November 2006 14:52, Gabe Schaffer wrote:
> On 11/2/06, Brian Jackson <brian at actionathletics.com> wrote:
> > On Thursday 02 November 2006 13:17, Ron Savage wrote:
> > > On Wed, 1 Nov 2006 15:42:15 -0700, Brian Jackson wrote:
> >
> > I've got a little shell script to produce the 4 different
> > histograms (value, red, green, blue) and it takes about 0.6-2.5
> > seconds depending on the machine, which isn't too bad, but not
> > having to make a shell call, writing and then reading 4
> > files....that's the goal :)
>
> You can do it with 2 histograms:
> 1. create histogram file
> 2. load histogram file
> 3. separate histogram file into red/green/blue channels to get R/G/B
> histograms 4. convert original image to greyscale
> 5. create histogram file
> 6. load histogram file as value histogram

Thanks.  I've already written the shell script to do all of the 
histogram converting.  That's not the issue.  That's the script that 
takes between 0.6 and 2.5 seconds depending on machine/image.

I want to do this IN MEMORY in Perl, without temp files.  :)

The problem with the histogram output is that you need to write it to a 
file and then read it back in so you can write it back out to a 
different format (that Perl/Tk will understand), then read it back in 
again, to load into a Photo object.  That's a lot of in-n-outs!  I'm 
trying to avoid that.

>From the Tk::Photo man page regarding supported file formats...
"At present, only GIF, XBM, XPM, BMP, JPEG, PNG and PPM/PGM formats are 
supported."

I've piecemealed a hack utilizing the shell script to perform the 
histogram creations.  Proc::Simple is nice so I can check when it's 
done, then proceed to read in the newly created histograms.

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



More information about the Magick-users mailing list