Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss
Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

GDI + OutOfMemory error in DrawImage

236 views
Skip to first unread message

listechtony

unread,
Jul 27, 2009, 11:44:01 PM7/27/09
to
I am attempting to print a rotated image using GDI+. This is the code snippet
I am using...

Gdiplus::Graphics graphics(pdc->m_hDC);
graphics.SetInterpolationMode(Gdiplus::InterpolationModeHighQuality);
graphics.SetPageUnit(Gdiplus::UnitPixel);
.
.
.
status = graphics.DrawImage(piImage, destinationPoints, 3);

The status returns OutOfMemory, even for small images.

There is no problem if the image is not rotated (probably because no
interpolation is required?) yet even for very small rotations, the DrawImage
runs out of memory, or sometimes will work, but be very very slow in printing.

Any ideas what is happening in the GDI+ DrawImage function that is causing
this problem and how to fix it?

Regards

Tony


listechtony

unread,
Aug 25, 2009, 7:11:04 PM8/25/09
to
Can someone help here?

Richard [Microsoft Direct3D MVP]

unread,
Aug 25, 2009, 7:28:32 PM8/25/09
to
[Please do not mail me a copy of your followup]

=?Utf-8?B?bGlzdGVjaHRvbnk=?= <liste...@discussions.microsoft.com> spake the secret code
<9D79E25B-6695-4762...@microsoft.com> thusly:

>I am attempting to print a rotated image using GDI+. [...]

You should try a GDI/GDI+ newsgroup. This newsgroup is for DirectX
Graphics (i.e. Direct3D).
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

docschnipp

unread,
Oct 30, 2009, 6:38:01 PM10/30/09
to
"listechtony" wrote:

> There is no problem if the image is not rotated (probably because no
> interpolation is required?) yet even for very small rotations, the DrawImage
> runs out of memory, or sometimes will work, but be very very slow in printing.
>
> Any ideas what is happening in the GDI+ DrawImage function that is causing
> this problem and how to fix it?

This is a bug in GDI+. Instead of rotate it by 90.0, 180.0 etc, try 90.0001
or 180.0001. The result is the same, but it does not trigger the bug.

best
doc

tau...@gmail.com

unread,
Jun 4, 2014, 4:26:56 AM6/4/14
to
Did you get the solution?
Please share if you solve it....
0 new messages