Skip to Content

ImageMagick is a free open-source software package that allows you to convert image files between formats, resize images and perform other functions. It can be used from the command line or as a COM object using PowerBuilder’s OLEObject functionality.

You can download the installer from here:

You must use one of the installers with the word “dynamic” in the description. I chose the Win32 installer because it offers a higher resolution than the Win64 Dynamic installer.

The command documentation for ImageMagick can be found here:

There are several commands that are supported by the COM interface.

compare: Compares two image files and returns information about the differences.

composite: Overlaps one image over another resulting in a third image file.

convert: Converts between image formats as well as resizing the image and other actions such as blur, crop, despeckle, and much more.

identify: Describes the format and characteristics of image files.

mogrify: Resizes the image and other actions such as blur, crop, despeckle, and much more. Mogrify overwrites the original image file, whereas, convert writes to a different image file.

montage: Creates a composite image by combining several separate images. The images are tiled on the composite image optionally adorned with a border, frame, image name, and more.

Here is an example that converts a JPG file to PNG:

OLEObject oMagick

String ls_origfile, ls_destfile

Integer li_rc

Any la_result

ls_origfile = “C:\PBSource\PB105\ImageMagick\Totoro.jpg”

ls_destfile = “C:\PBSource\PB105\ImageMagick\Totoro.png”

oMagick = Create OLEObject

li_rc = oMagick.ConnectToNewObject(“ImageMagickObject.MagickImage”)

If li_rc = 0 Then

   la_result = oMagick.Convert(ls_origfile, “-format”, “png”, ls_destfile)

   MessageBox(“Convert”, “Result: ” + String(la_result))


   MessageBox(“ConnectToNewObject”, “Failed: ” + String(li_rc), StopSign!)

End If


Destroy oMagick

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

    1. Former Member

      Hi all,

      Sounds interesting Marco. Can you share this PBLs ?

      jtagarro  _*at*_  neosistemassrl  _*dot*_ com

      Thanks in advance.


      AUS Julián Tagarro

      NeoSistemas SRL

  1. Former Member

    Hi All,

    This product looks great and has amazing potential.  I am having however a problem using it!

    Roland & Marco, I have installed the latest 32-bit version and registered the ImageMagickObject.dll (ImageMagick-6.8.9-3-Q16-x86-dll).  I can connect to the OLE object, but when I run any of the functions I am getting an “error calling external object function” error.

    What is strange is that the functions still seems to be firing in the background anyway, as when I use the convert Image to resize my images and replicate my images.  New images are being created, but the error keeps coming up each time.

    I am using PB12 Classic

    Any help would be greatly appreciated.


  2. Former Member

    Roland / Marco,

    I am wondering whether there may be something wrong in the built binary that I have downloaded – released 8th June 2014.

    Could you post a link to the versions of the dll you have used so that I could try the older versions to test for the same problem.

    Many Thanks,


    1. Former Member Post author

      I have 6.8.8 and the latest is 6.8.9. I don’t see where you can download prior version executables.

      If you go to their website and click Download from the left hand nav area, it goes to a page with various mirror websites. Choose one of them and look for ImageMagick-6.8.9-3-Q16-x86-dll.exe.

        1. Former Member


          Ran into the same exact issue “error calling external object function” with running ver 6.8.9. Trying to figure out how you installed 6.8.5-9? Was able to download the zip ( file from SUNET’s Index of /pub/multimedia/graphics/ImageMagick but not able to install this version as there is no install application. Can you please shed some light as to how you installed version 6.8.5-9?

          Thanks in advance.


          1. Former Member Post author

            They only have installers for the current version. I have ImageMagick-6.8.8-Q8 which was the current version when I downloaded it. Older version are only source code. I could zip up my install folder for you. Then you could unzip it over the version you have.

          2. Former Member

            SUNET’s Index of /pub/multimedia/graphics/ImageMagick/binaries is the directory you need to be in to download the installers.  This is where I downloaded the older version.

            You will need to download any of the files listed with ‘static’ or ‘dll’ in the name.  These are the exe installers.


            Above is the link for the 32 bit version.


  3. Former Member


    Thank you for the assistance.  I now have the code working using version 6.8.5-9.

    I will experiment later with newer versions to try and find where the build error started to arise.




Leave a Reply