Foxite.COM Community Weblog

Foxite.COM Community Weblog - free weblog service for the Visual FoxPro Community.
Welcome to Foxite.COM Community Weblog Sign in | Join | Help
in
Home Blogs Forum Photos Forum Archives

VFP IMAGING



CONVERT IMAGE TYPES WITH VFP9 AND GDI+

This piece of code loads an image and saves it on the same original folder in the formats supported by GDI+

LOCAL lcSource, lcDestination
lcSource = GETPICT()
lcDestination = JUSTPATH(lcSource) + "\_" + JUSTSTEM(lcSource)
 
LOCAL loImage AS GpImage OF HOME() + ffc/_gdiplus.vcx
loImage = NEWOBJECT("GpImage", HOME() + "ffc/_gdiplus.vcx")
loImage.CreateFromFile(lcSource)
loImage.SaveToFile(lcDestination + ".jpg","image/jpeg")
loImage.SaveToFile(lcDestination + ".bmp","image/bmp")
loImage.SaveToFile(lcDestination + ".tif","image/tiff")
loImage.SaveToFile(lcDestination + ".gif","image/gif")
loImage.SaveToFile(lcDestination + ".png","image/png")

*!* JPEGs allow to choose the quality of the image

loImage.SaveToFile(lcDestination + ".jpg","image/jpeg", "quality=70")

Published Tuesday, February 07, 2006 5:53 PM by cesarchalom
Filed Under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Ana María Bisbé said:

Versión en Español de este artículo in / Spanish version at http://www.portalfox.com/article.php?sid=2174
July 24, 2007 12:14 AM
 

foxpro.catalyst ?? » Blog Archive » More VFP9 and GDIs said:

October 8, 2007 10:10 PM

What do you think?

(required) 
(optional)
(required)