Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I save an image with GDIPlusX
Message
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01301519
Message ID:
01301547
Views:
15
>I am using GDIPlusX 1.10 and the imgCanvas image class in gdiplusx.vcx on a form. I need to save the picture in the imgCanvas image container to a file but I can't seem to do that. All the gdiplusx examples have the save command directly from the object created from _SCREEN.system.drawing. There is a SAVE method in the imgCanvas class but I can't make that work.
>
>I am using the Picture property of the image container to load the JPG file. Is that right or should I be loading it with GDIPlus? I'm new with this and kind of lost at the moment.


Hi John,

I'm glad to know that you are using GdiPlusX.

Note that the ImageCanvas has the "oBmp" property, that is a Bitmap GDI+ object from the image drawn in the imagecanvas.

So, you can use it the same way you manipulate an image directly with GdiPlusX.
Note that the ImgCanvas has also the property "oGfx", that is the Graphics object derived from the Bitmap - "oBmp" object. Capiche ?


Here are some possibilities:

1 - From anywhere in your form, after you've drawn in the image canvas:
Thisform.ImageCanvas1.oBmp.Save("c:\myimage.png", _Screen.System.Drawing.Imaging.ImageFormat.Png)
2 - From inside the ImgCanvas, in the "BeforeDraw" or in the "AfterDraw" event, after drawing the image, you can also call:
This.oBmp.Save("c:zmyImage.png", .Imaging.ImageFormat.Png)
3 - My preference is to bring intellisense to help us, using a little bit more code, but easier to understand what else you can do:
LOCAL loBmp as xfcBitmap
loBmp = Thisform.ImageCanvas1.oBmp

With _Screen.System.Drawing
   loBmp.Save("c:\myImg.png", .Imaging.ImageFormat.Bmp)
EndWith
See that after you type "loBmp", intellisense will show you all the possible commands for that object.



Hope you find this helpful

Good luck

Cesar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform