>Ideally, I'm looking for read and write routines that would take as
>input a .jpg image and output an array (each pixel is a RGB value); and
>would take in as input an array and output a .jpg image.

Here's how I would do it:

convert picture.jpg picture.ppm
ppmtorgb3 picture.ppm
for PICTURE in picture.{red,grn,blu}
  pnmnoraw $PICTURE
done | ./invert
rgb3toppm out.{red,grn,blu} > out.ppm
convert out.ppm out.jpg

My invert.f program (yes, I like fortran) can be seen at:
This is significantly slower than using the gimp, but I'm
sure you want to do more than invert some colors.  There are
probably much better ways to implement my program in c, and
I assume you'll be able to figure that part out.

There doesn't appear to be either a jpgtoppm program or a
ppmnoraw program, but doing it in multiple steps seems to work.
Of course, I'm not even thinking about using libjpeg or anything
like that to get your array (which would probably work rather

-James Smaby

Reply via email to