Image Magick with Visual Foxpro

ImageMagick is versatile enough to use from a multitude of languages. Back in January of 2006, I used it in Visual Foxpro 7 to create thumbs and mid size images for an image gallery that ended up not being used. Here is the source to do that.


loMagickImage = Createobject("ImageMagickObject.MagickImage")
lcSourceFile = "C:\uploads\"+Alltrim(gFileList.FILENAME)
lcThumbnailFile = "C:\uploads\thumb_"+Alltrim(gFileList.FILENAME)
lcMidFile = "C:\uploads\mid_"+Alltrim(gFileList.FILENAME)
loMagickImage.Convert("-resize", "x128", lcSourceFile, lcThumbnailFile)
loMagickImage.Convert("-resize", "x512", lcSourceFile, lcMidFile)
loMagickImage = .Null.

Make sure that you check the option labeled “Install ImageMagickObject OLE Control for VBscript, Visual Basic, and WSH” during the install or else you won’t be able to call it from VFP or any other language.


Filed under: Visual Fox Pro — Shaun Kester on June 30, 2008

Comments / Trackbacks

No comments yet on this post. Will you be the first to do so?

Leave a Reply