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.
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.
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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.