Re: How to convert a .jpg file to a RGB format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>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}
  do
  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:
http://virgo.umeche.maine.edu/gimp/invert.f
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
well).

-James Smaby


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux