473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Saving an image file to a directory with GDI+

Hello everyone and thank you for taking the time to read my post

I am running Visual C++ 2005 and I'm having some trouble with GDI+.


I have two bitmaps:

Expand|Select|Wrap|Line Numbers
  1. Bitmap* pngFrame;
  2. Bitmap* pngEmblem;
  3.  
I initialized them in a function I use, and I can display them no problem like this:
Expand|Select|Wrap|Line Numbers
  1. PAINTSTRUCT ps; 
  2. BeginPaint(hwnd, &ps);
  3. Gdiplus::Graphics* gfx = new Gdiplus::Graphics(ps.hdc); 
  4. gfx->DrawImage(pngFrame, 80, 12); 
  5. gfx->DrawImage(pngEmblem, 80 + ((17 - (INT)pngEmblem->GetWidth()) / 2), 12 + ((17 - (INT)pngEmblem->GetHeight()) / 2)); 
  6. delete gfx;  
  7. EndPaint(hwnd, &ps);
  8.  

Now, that works all fine and dandy. However, in another event, when the user clicks a button. I would like to draw the pngFrame, draw the pngEmblem on top of it, and then save it as one picture.

For example (pseudocode):

Expand|Select|Wrap|Line Numbers
  1. gfx->DrawImage(pngFrame);
  2. gfx->DrawImage(pngEmblem);
  3. gfx->SaveTo(C:\\picture.png);
  4.  

They are PNG files so it handles the transparency automatically. But yea, can I get some help with this one?
Jul 3 '07 #1
0 1362

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Michael Kennedy [UB] | last post by:
Hi Everyone, I have this multithreaded C# windows forms application which does a lot of image processing. Occasionally, I get the following error: A generic error occurred in GDI+....
3
by: cdj | last post by:
Hi all, I've got a picturebox on a form, and a save button. When I go to save, the app craps out with the following error: ================== An unhandled exception of type...
4
by: melanieab | last post by:
Hi, I'm trying to save a bitmap file so I can print it later. I have Image.Save("sImage.bmp",System.Drawing.Imaging.ImageFormat.Bmp); The file sImage.bmp shows up in the bin\debug folder but...
3
by: Gary B | last post by:
I'm converting a windows application to a web application. (by the way, this is way easier than it used to be - many of the modules went over untouched!) The windows app used a pictuebox and...
2
by: Will | last post by:
I've got a file upload happening to upload an image file to the server. During this process I want to also create a thumbnail of the image in the same directory, and adjust the size of the image...
1
by: M Keeton | last post by:
I currently have a picture which is stored in a "System.Drawing.Image" variable and I want to save it as a bitmap file. I have tried 2 different approaches and both give me the following error: ...
2
by: steve | last post by:
Hi All I have a program which takes photos of members using a web cam, then saves them as bitmap files The bitmap is used by a Picturebox to display the photo and clicking on a button enables...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
2
by: Mark Denardo | last post by:
Hi, I need some expert GDI+ person to help me with my RoundOffImage Function: What I'm trying to do is take in an image, crop off the edges around an ellipse region I set up, and then return the...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.