-
April 2nd, 2011, 01:07 PM
#1
gdi+ image resizing
hi,
i have spent a couple of fruitless hours on this, maybe someone can help...
My main aim is to create screenshot of my screen, re-size it & save it to a file.
Dumping a screenshot into HBITMAP & saving that to disk works fine, however, changing the resolution wont work.
I can change the resolution of a image using the DrawImage() method of a Graphics object, but i can only Draw in an Image* object...not in a HBITMAP.
I fail at creating an empty Image* object.
HDC tmp= GetDC(0);
Graphics grr(tmp);
Image mim;//error
grr.DrawImage(&mim, 100, 100;
mim.Save(L"C:\\asdfasdf.jpg",0,0);
this code should take a screenshot, select ti into a Graphics object, and draw it into the image "mim" with an resolution of 100x100, but fails already at creating an empty image.
so how can i create an empty image?
-
April 15th, 2011, 11:51 PM
#2
Re: gdi+ image resizing
Because mim does not contain anything! That means your tmp fails to get a snapshot, which also means your provided snippet is incorrect. Supply us a more correct sample that actually works. And instead of creating an empty image then draw the scaled picture on it, I suggest you scale the taken snapshot into a placeholder of any size you want.
-
April 17th, 2011, 02:44 PM
#3
Re: gdi+ image resizing
Originally Posted by felix1432
Image mim;//error
Gdiplus::Image class has not a default (with no parameters) constructor.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|