Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I use GDI to resize an image
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01019935
Message ID:
01019979
Views:
25
This message has been marked as the solution to the initial question of the thread.
Here's one way to do it:
LOCAL lcSource, lcDestination
lcSource = GETPICT()
lcDestination = "C:\" + JUSTFNAME(lcSource) && Image will be saved on to C:\
IF !CreateThumbNail(lcSource, lcDestination, 85, 100)
	MESSAGEBOX("Unable to create image")
ENDIF

FUNCTION CreateThumbnail(tcSource, tcDestination, tnWidth, tnHeight)
	LOCAL llSuccess, loImage, loThumbImage
	llSuccess = .F.
	IF FILE(tcSource)
		loImage = Newobject('GpImage',HOME(1) + 'FFC\_gdiplus.vcx')
		loImage.CreateFromFile(tcSource)
		loThumbImage = loImage.GetThumbnailImage(tnWidth, tnHeight)
		IF TYPE("loThumbImage") = "O"
			llSuccess = loThumbImage.SaveToFile(tcDestination, "image/jpeg")
		ENDIF
	ENDIF
	RETURN llSuccess
ENDFUNC
>I have an image called im003.jpg which I need to resize to 100 pixels high x 85 wide - how do I use GDI to do this
>
>Thanks
>
>Colin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform