convert ppm to jpeg

  • Thread starter Thread starter Kim Schulz
  • Start date Start date
K

Kim Schulz

hi
anyone that know some free code to convert ppm to jpeg in c#?

Best regards
Kim Schulz
 
Kim,

I don't think that GDI supports the PPM format. If you have a library
that supports it, and exposes a GDI device context handle to the image, then
you should be able to create a new Bitmap instance, and then get the device
context for that, calling BitBlt (through the P/Invoke layer), to copy the
PPM image to the Bitmap).

Once you have that, you can then call Save on the Bitmap, indicating
that you want it to be saved in JPG format.

Hope this helps.
 
Kim,

I don't think that GDI supports the PPM format. If you have a
library
that supports it, and exposes a GDI device context handle to the
image, then you should be able to create a new Bitmap instance, and
then get the device context for that, calling BitBlt (through the
P/Invoke layer), to copy the PPM image to the Bitmap).

Once you have that, you can then call Save on the Bitmap,
indicating
that you want it to be saved in JPG format.

Hope this helps.


what if I have the pixel information directly in an array as RGB ?

Best regards

Kim Schulz
 
Kim,

If you have that, then you can probably create a new Bitmap of the same
size, and iterate through all the pixels on the original image. With the
pixel information in RGB, you could call SetPixel on the new Bitmap
instance.

Be warned though, this is probably going to be very, very slow.
 
Back
Top