kevinbrianwhite
May 21st, 1999, 03:58 PM
I'm am trying to write a jpeg image to printer device. I want to read a jpeg into memory and set to a printer device. I am using the Independent JPEG Group's library. I can read a jpg file and write a jpg file but I haven't found any code that shows putting the jpeg on a device. I am wondering if anybody else has accomplished this feat. Or can somebody point me to some useful information on the web or source code. I am having a hell of a time figuring this out.
If you can read a JPEG file and convert it to a Device Independent Bitmap (DIB for short), there are various functions that can display the DIB to a device (such as a screen or printer). You need to create a device context (DC) for the device and call StrecthDIBits, or a similar function. You can also take a look at sample programs such as SHOWDIB (or DIBSHOW -- I don't remember the name). These sample programs can be found in the VC++ Samples directory.
The bottom line is that you're not really manipulating the JPEG image data "as is" when displaying or printing. The first step (which is 95% of the work) is to convert the JPEG, TIFF, PNG, whatever, to a DIB format in memory. Once it's a DIB, there are a lot of code samples out there that show you how to manipulate the DIB.
Regards,
Paul McKenzie