Image coordinate data

Joel Meulenberg joelmeulenberg at yahoo.com
Tue Oct 5 01:11:50 CDT 1999


> This may or may not be a Perl question but it sounded like something
> that
> could easily be done using a GIF file and Perl.
> 
> I need to develop a way to take a scanned, line-art (black and white
> pixels
> only) image and generate cartesian coordinate data representing the
> pixels
> that are on or off. The data should take a form something like:
> 
> (0,0)=0, (0,1)=1, etc. or something similar stored in an array(s).
> 
> Simple right?

Yes.
Note:  I do *not* know anything about the legality of using the GD.pm
Perl module together with older versions of Thomas Boutell's gd C
library.  Since Unisys started to get all selfish with their little LZW
compression (used in GIFs) patent it has become difficult to find the
older versions of GD.pm/gd that work on GIFs rather than PNGs.  

However, I just happen to have an old copy of GD.pm version 1.19
(together with gd version 1.2) sitting on a hard drive.  So I'm
attaching it to this email.  Note that this is an early enough version
that it actually uses LZW (rather that RLE) compression when saving the
GIF.  Later versions still supported GIFs, but used RLE (Run Length
Encoding) rather than LZW compression.  In still later versions
(including current) GIF support was totally absent so as to avoid all
possible entanglements with the Unisys LZW patent.

You can use the "getPixel" method to read the color of a pixel at a
given (x,y) coordinate within a GIF image.


An alternative is to use the ImageMagick program (got Linux?) together
with the PerlMagick module (interface to ImageMagick).  The "pixel"
method (of Image::Magick) can tell you the color of a pixel at a given
(x,y) coordinate within a GIF image.  You can get Image::Magick from
CPAN.  I'm not sure of it's current support for GIFs.  You can find
PerlMagick on CPAN (under the Image subdir if you're browsing
manually).

+Joel


=====
__________________________________________________
AdStream programs expose you to a stream of banner ads while you're
connected to the Internet.  In exchange for a smidgen of your attention
they pay you cash.  You can easily earn enough to pay your monthly ISP
bill.  Compare the various AdStream programs at:
http://adstreaminfo.hypermart.net/
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GD-1_19_tar.gz
Type: application/x-gzip-compressed
Size: 114892 bytes
Desc: GD-1_19_tar.gz
Url : http://mail.pm.org/archives/grand-rapids-pm-list/attachments/19991004/a942db8a/GD-1_19_tar.bin


More information about the grand-rapids-pm-list mailing list