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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.