Page 1 of 1

Powerbuilder & IM

Posted: 2019-02-05T09:26:08-07:00
by jagonzo62
In Powerbuilder I am connecting to ImageMagick using OLE but when I try to executing the convert command I get a message about convert not being found. I've downloaded many versions of IM without any luck. I found that it use to work in version IM6.5.9...Q16. This old version is no longer available.
Please help.

Re: Powerbuilder & IM

Posted: 2019-02-05T10:11:04-07:00
by snibgo
What version of IM do you use now? Is "convert" found at the command line?

Re: Powerbuilder & IM

Posted: 2019-02-05T10:55:41-07:00
by jagonzo62
Hello,
I downloaded all the versions from the Imagemagick site. Ones with convert and ones without. The ones that were static and dynamic. Version 6 & 7. It's odd. I've used similar commands like below to connect to Word or Excel. I am using Powerbuilder 2017 R3. The last version of Imagemagick I downloaded was ImageMagick-7.0.8-Q8.

I can connect to the Imagemagick process:

OLEObject oMagick
oMagick = Create OLEObject
oMagick.ConnectToNewObject ('ImageMagickObject.MagickImage.1')

but this command fails:
oMagick.object.ImagickImage.convert(ls_origfile, '-format', 'png', ls_destfile)

Thanks

Re: Powerbuilder & IM

Posted: 2019-02-05T10:56:17-07:00
by jagonzo62
I am sorry the command was:

oMagick.convert(ls_origfile, '-format', 'png', ls_destfile)

Re: Powerbuilder & IM

Posted: 2019-05-08T09:06:16-07:00
by jagonzo62
I figured out how to adjoin a bunch of tifs into one big tif file using Powerbuilder:

Here's how I connect to imagick in Powerbuilder:

OLEObject oMagick
oMagick = Create OLEObject
oMagick.ConnectToNewObject ('ImageMagickObject.MagickImage.1')

ls_orgfile = ls_folder_with_files + '\*.tif' // ls_folder_with_files is a variable containing the name of the folder (c:\temp\folder1) that contains the tifs I want to join together.

ls_destfile= ls_consolidated_file_name // ls_consolidated_file_name is a variable containing the path and file name of the new consolidated file (c:\temp\file.tif).

// Its was the *.tif that tells imagemagick to get all the files in the folder (ls_folder_with_files ) and join them together and copy the internal file to the new file (ls_consolidated_file_name).

try

la_result= ioMagick.Convert('-adjoin', ls_orgfile , ls_destfile ) // <======================

CATCH (OLERuntimeError ole_e1)
ls_error = ole_e1.getmessage()
gnv_app.inv_error.of_Message("Error", "ioMagick.Convert command call in of_create_consolidated_packet() function failed", exclamation!)
CATCH (Exception ex1)
ls_error = ex1.getmessage()
gnv_app.inv_error.of_Message("Error", ls_error, exclamation!)
Finally
Destroy ioMagick
end try