[PLUG] data array from a black and white graphics image

Russell Senior seniorr at aracnet.com
Wed Aug 17 08:56:57 UTC 2005


>>>>> "Keith" == Keith Lofstrom <keithl at kl-ic.com> writes:

Keith> Is there any easy-to-use graphics software library with simple
Keith> routines that can be pointed at a two-level black-and-white
Keith> png/jpg/gif/tif/other? bitmap image, then returns an array of
Keith> ones and zeros?  C, C++, or Perl would be acceptable.

As I learned about a year ago (Sept 2004) on this very mailing list:

  $ convert foo.png foo.txt 

will give you something that looks like:

  $ head foo.txt
  # ImageMagick pixel enumeration: 72,77,255,RGB
  0,0: (254,254,254) #FEFEFE
  1,0: (254,254,254) #FEFEFE
  2,0: (254,254,254) #FEFEFE
  3,0: (254,254,254) #FEFEFE
  4,0: (254,254,254) #FEFEFE
  5,0: (254,254,254) #FEFEFE
  6,0: (254,254,254) #FEFEFE
  7,0: (254,254,254) #FEFEFE
  8,0: (254,254,254) #FEFEFE

You ought to be able to hack that into whatever format you like pretty
easily.


-- 
Russell Senior         ``I have nine fingers; you have ten.''
seniorr at aracnet.com



More information about the PLUG mailing list