Unable to Execute Script after Installing ImageMagick v7.0.1

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
goldfish
Posts: 10
Joined: 2016-05-29T19:53:16-07:00
Authentication code: 1151

Unable to Execute Script after Installing ImageMagick v7.0.1

Post by goldfish »

Hi all,

I'm running Perl v5.20.2 built for MSWin32-x64-multi-thread on a 64-bit Windows Server 2008 R2 Enterprise machine. I had been using PerlMagick installed with the DLLs that came with ImageMagick v6.9.3 without issue, but I can't get the same script to work with the DLLs from v7.0.1.

After further testing, I can't seem to use the "convert" cmd line tool either...

Code: Select all

W:\>convert 0001.tif 0001.jpg
Invalid Parameter - 0001.jpg
[EDIT] I just checked the "Bugs" forum, and it looks like there were problems with the Windows install wizards; it told you to test the install with "convert" even though that tool is not installed by default, and it also was not installing convert.exe, etc. even when the checkbox was selected. Looks like this should be fixed now[/EDIT]

When I run the script, an error dialogue box titled "perl.exe - Bad Image" pops up with the following message:
C:\Strawberry\perl\site\lib\auto\Image\Magick\Magick.xs.dll is either not designed to run on Windows or it contains an error. Try installing the program again using the original media or contact your system administrator or software vendor for support
After clicking "ok" on the dialogue box, Perl continues with this output to STDERR:

Code: Select all

W:\>perl \Scripts\check_imgs.pl 001.tif
Can't load 'C:/Strawberry/perl/site/lib/auto/Image/Magick/Magick.xs.dll' for module Image::Magick: load_file:%1 is not a valid Win32 application at C:/Strawberry/perl/lib/DynaLoader.pm line 193. at \Scripts\check_imgs.pl line 16.
Compilation failed in require at \Scripts\check_imgs.pl line 16.
BEGIN failed--compilation aborted at \Scripts\check_imgs.pl line 16.
I'm not sure why it's referring to a "Win32 application" in the error message... none of these programs are 32-bit.

Line 16 of the script is just loading the module:

Code: Select all

use Image::Magick;
I've tried uninstalling and reinstalling, installing different v7.0.1 releases, and reloading the Image::Magick module from CPAN. All have yielded the same results.

Any help is appreciated. Unfortunately, I cannot roll back to the version that worked because of the security vulnerability made public at the start of this month (May 2016).

Thank you very much.
Last edited by goldfish on 2016-06-04T13:44:55-07:00, edited 2 times in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Unable to Execute Script after Installing ImageMagick v7.0.1

Post by snibgo »

"Invalid Parameter" is an error message from Microsoft Windows convert.exe, not from ImageMagick.

When you installed IM, did you tick the box saying you wanted legacy applications like convert,exe? If you didn't, then you didn't install IM's convert.exe.

I know nothing about Perl. Sorry.
snibgo's IM pages: im.snibgo.com
goldfish
Posts: 10
Joined: 2016-05-29T19:53:16-07:00
Authentication code: 1151

Re: Unable to Execute Script after Installing ImageMagick v7.0.1

Post by goldfish »

Thank you for the reply.

From what the error messages are telling me, it looks like the DLL that comes with this 7.0.1 release (Magick.xs.dll) is not working with Windows, though I don't know why.

Also, forgive my ignorance... I'm a bit lost in general with this upgrade. If convert.exe and the like are legacy applications, then how is ImageMagick supposed to be used from this point? The documentation that comes with the 7.0.1 download still references the convert utility, at least I cannot find any tools there that I haven't already used with the prior version.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Unable to Execute Script after Installing ImageMagick v7.0.1

Post by snibgo »

Your error ...

Code: Select all

W:\>convert 0001.tif 0001.jpg
Invalid Parameter - 0001.jpg
... is coming from the Microsoft program, not from IM's convert.exe. Therefore you are not running IM's convert.exe.

This is probably because either you didn't tick the box at installation saying you wanted to install convert.exe and other legacy apps, or you didn't add IM's directory to the front of your system path.
snibgo's IM pages: im.snibgo.com
goldfish
Posts: 10
Joined: 2016-05-29T19:53:16-07:00
Authentication code: 1151

Re: Unable to Execute Script after Installing ImageMagick v7.0.1

Post by goldfish »

My apologies, the convert issue is a red herring. The real problem is Magick.xs.dll is being reported as "either not designed to run on Windows or it contains an error". That message pops up as soon as the Image::Magick module is loaded:

Code: Select all

C:\Users\Documents>perl -e "use Image::Magick"
Can't load 'C:/Strawberry/perl/site/lib/auto/Image/Magick/Magick.xs.dll' for module Image::Magick: load_file:%1 is not a valid Win32 application at :/Strawberry/perl/lib/DynaLoader.pm line 193. at -e line 1.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Unable to Execute Script after Installing ImageMagick v7.0.1

Post by snibgo »

Sorry, I can't help with that.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Unable to Execute Script after Installing ImageMagick v7.0.1

Post by fmw42 »

I am not an expert on this either, but is it possible you are trying to load a 32-bit Imagemagick on 64-bit machine or vice-versa.
goldfish
Posts: 10
Joined: 2016-05-29T19:53:16-07:00
Authentication code: 1151

Re: Unable to Execute Script after Installing ImageMagick v7.0.1

Post by goldfish »

is it possible you are trying to load a 32-bit Imagemagick on 64-bit machine
You know, that's definitely possible. It could also be that this DLL is designed for Linux, Mac, or something else. I'm unfortunately not too great with DLLs, and I wouldn't be surprised if the fault lies with me or my environment too.

But, all of the ones I've tried are from the distros labeled "64-bit" on the download page. I would be curious if anyone has successfully used the DLLs that come with a v7.0.1 Windows 64-bit distribution. I have gotten the same results with each I've tried.

Thanks again for the input, everyone.

EDIT for anyone coming here looking at this thread: there's a more active discussion in the Bugs forum here:
viewtopic.php?f=3&t=29842&p=138397
Post Reply