This article provides a resolution for an issue where the Graphics::DrawImage method appears slow when you call it with an ImageAttributes object to draw a JPEG or PNG image to a printer.
Cause
The Graphics::DrawImage method converts the source image to a device-independent bitmap (DIB) when you call it with an ImageAttributes object.
Resolution
To solve the issue, call Graphics::DrawImage with the ImageAttributes parameter set to NULL unless specifying an ImageAttributes object is necessary.
When supported by the printer, calling Graphics::DrawImage with the ImageAttributes parameter set to NULL will pass the source JPEG or PNG directly to the printer.
More information
- Graphics::DrawImage(Image*,constPointF*,INT,REAL,REAL,REAL,REAL,Unit,constImageAttributes*,DrawImageAbort,VOID*) method (gdiplusgraphics.h)
- Graphics::DrawImage(Image*,constPoint*,INT,INT,INT,INT,INT,Unit,constImageAttributes*,DrawImageAbort,VOID*) method (gdiplusgraphics.h)
- Graphics::DrawImage(Image*,constRect&,INT,INT,INT,INT,Unit,constImageAttributes*,DrawImageAbort,VOID*) method (gdiplusgraphics.h)
- Graphics::DrawImage(Image*,constRectF&,REAL,REAL,REAL,REAL,Unit,constImageAttributes*,DrawImageAbort,VOID*) method (gdiplusgraphics.h)
- ExtEscape function (wingdi.h)
- Testing a Printer for JPEG or PNG Support
Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
