I've been trying all afternoon to get ImageMagick working with my installation of Windows XP and Apache. I install ImageMagick-6.3.8-Q8 and copy image.imagemagick.inc to the includes directory. The option for ImageMagick then appears under Image Toolkit. I enable it, and it prompts me to enter the path to the convert utility (by default it has the Linux path). I follow the instructures and enter:

C:\Program Files\ImageMagick-6.3.8-Q8\convert.exe

Then the computer beeps (some error message that I can't see) and just sits in a permanent loop on that page. Nothing in the logs.

I've done a lot of searching and found a lot of people have the problem, but no solution it seems. Can you please help? I don't want to use the GD2 as it sucks up huge amounts of memory when I upload images. Very frustrating.


#21 imageapi_217960.patch932 bytesdrewish
#17 imagemagick_217960.patch843 bytesdrewish
Members fund testing for the Drupal project. Drupal Association Learn more


drewish’s picture

Status: Active » Postponed (maintainer needs more info)

humm, since i did all the development of the toolkit on windows using php5 and apache so i'm not sure why you'd be having that problem. try enabling the debugging messages and see if that gives you any clue.

wotstheguts’s picture

Hi, thanks for your quick reply. Unfortunately I can't enable the debugging. Once I give it the correct path for the convert.exe file, it just beeps and hangs. This behaviour is then repeated every time I click on the Image toolkit menu. I can't get it to work again unless I delete the .inc file from the includes directory.

Now it is possible I'm doing something wrong, being a newbie to Drupal!

I've had exactly the same results on two different PCs. The precise steps I take are:

1. Download and install Drupal 5.7 (fresh install with no contributed modules).
2. Download and install current ImageMagick using the defaults. The installation directory is: C:\Program Files\ImageMagick-6.3.8-Q8. Check that it's running by executing convert from the command line (I've found that sometimes the Windows path variable is not updated correctly until you reboot).
3. Download images module (5.x-1.6). Copy image.imagemagick.inc to the includes directory.
4. Click on the Image toolkit menu. The ImageMagick option is listed, which I select. For path to the binary I enter "c:\program files\ImageMagick-6.3.8-q8\convert.exe". Click on Save configuration. But the computer gives an error beep and the page hangs, with no further messages or information. If I jump to another menu, I get a message that ImageMagick can't find the convert.exe file and that the path must be set from Image toolkit menu. Clicking on the Image toolkit menu just results in a repeat of the error beep and the page hanging. Nothing in the watchdog log. Nothing in the Apache log.

I also wrote a wee php file to test convert.exe using exec:

exec("convert test.jpg test.png");

This ran perfectly, happily converting the test.jpg in my web root to .png format.

What have I done wrong here?

Further information: I'm running Apache 2.2.6, PHP 5.2.5, and MySQL 5.0.45.
The ImageMagick include version is:
// $Id: image.imagemagick.inc,v 2007/10/10 03:47:12 drewish Exp $

Thanks and regards,

drewish’s picture

are you getting anything in your php error log? i'm wondering if there's some sort of open_basedir restriction...

as for the debugging if you've got the devel module you should be able to use the execute php block to run:
variable_set('image_imagemagick_debugging', 1);
and that would set the variable.

wotstheguts’s picture

Hi, I have PHP logging turned on but not getting any errors in that log either. I'll download the devel module and follow your suggestion.


wotstheguts’s picture

Version: 5.x-2.x-dev » 5.x-1.6
Status: Needs review » Postponed (maintainer needs more info)

I installed devel and set the debug variable using the execute php block. Used the variable editor to check it was set:

image_imagemagick_debugging i:1; 4 edit

Then selected ImageMagick from the Image tools menu. Same problem, nothing new in the watchdog logs, php log, or Apache log.

BUT I got this message in the Firefox log:

Warning: Error in parsing value for property 'display'. Declaration dropped.
Source File: http://test/modules/system/defaults.css
Line: 43

.clear-block {
display: inline-block;

Found some documentation about this:

But not sure if this is related to the problem, or just a red herring. For what it's worth, I'm running Firefox


wotstheguts’s picture

It is a red herring. An error entry appears for every menu accessed in Drupal.

Same problem occurs when I try to access this page from different browsers and different PCs. The error beep comes from the server. I'm sure it's gonna be something really simple that I'll be kicking myself about...

wotstheguts’s picture

Hi, sorry to bug you (so to speak), but do you have any other ideas on this? It's really easy to replicate, just need to go through the steps I've outlined. Perhaps it's due to some quirk with this combination of WAMP versions?


drewish’s picture

i don't use wamp, i install everything myself and as i said it's always worked for me. i'm surprised that you didn't see any of the debug messages as the toolkit tried to call imagemagick. perhaps you've got some php.ini setting that's preventing the toolkit from calling proc_open()? the toolkit tried to work around the "black window" you describe using the following technique: http://us3.php.net/manual/en/function.exec.php#56599

if you can give me some clues i'll see what i can do but as it is i don't have much to go on.

wotstheguts’s picture

Hi, I really appreciate your help so far with this.

Just to clarify, I don't get a "black window" at all, I just get a beep after enabling ImageMagick and the page hangs, with no errors recorded anywhere as far as I can determine.

I thought you might be able to replicate the problem quite easily by installing the versions of Apache, PHP, and MySQL that I mentioned earlier on a Windows XP box, along with a fresh Drupal install. I've gone through exactly the same procedure on three completely different PCs now with exactly the same result. I'm quite new to Drupal and so I have a long learning curve once I start digging into the code. I was hoping that, being more intimate with the code, you may have an "aha" moment and know what it was!

I do have one final interesting clue. Prior to attempting to install ImageMagick, the following options appear when I click on Image toolkit:

The built-in GD2 toolkit is installed and working properly.
JPEG quality:
Define the image quality for JPEG manipulations. Ranges from 0 to 100. Higher values mean better image quality but bigger files.

After attempting to remove ImageMagick (by disabling the module, deleting the .inc file and removing references to ImageMagick in the MySQL variables table), the option to set the JPEG quality no longer appears. BUT the most painful side-effect is that the Imagecache module stops working properly. It still creates directories for images, but it doesn't scale them any more, just leaves them at their original resolution. Which plays havoc with my thumbnails.

It'd be really cool if you could look into it further; I'm sure others must have had this issue. The Apache and PHP settings are at their defaults, aside from loading the PHP GD2 module in php.ini.

If you don't have time, I'll just live with GD2 until I eventually move the website to Linux. But could you please let me know how to COMPLETELY remove ImageMagick so that I can get Imagecache working again without a fresh Drupal install? Are there any other affected tables in MySQL?

Thanks heaps,

wotstheguts’s picture

Status: Postponed (maintainer needs more info) » Active

OK, just wanted to summarise this issue after some further experimentation.

I originally found this problem with Apache 2.2.6, PHP 5.2.5, MySQL 5.0.45, and ImageMagick 6.3.8-Q8 on Windows XP Pro SP2 on a Dell desktop.

This afternoon I started afresh with a clean slate and older releases of everything - and had EXACTLY the same issue with Apache 2.0.63, PHP 5.1.4, MySQL 5.0.21, and ImageMagick 5.5.7-Q8 on Windows XP Home SP2 on a Toshiba laptop.

Either I am doing something STUPID, or omitting something that is necessary to get this running, or the ImageMagick include is BROKEN!!!

These are the EXACT steps I go through:

1. Download and install Apache 2.2.6, then PHP 5.2.5, then MySQL 5.0.45.
2. Make changes to httpd.conf:

DirectoryIndex index.php index.html
LoadModule rewrite_module modules/mod_rewrite.so

AllowOverride All

AllowOverride All

3. Make changes to php.ini:

doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

4. Restart Apache and verify PHP is loaded. Load phpinfo() in Apache to check PHP is running and all extensions are loaded.
5. Create database in MySQL:

create database drupal;
use drupal;

6. Download Drupal 5.7, copy to htdocs, and run install.php with "drupal" as the database. No contributed modules installed and no configuration changes made, aside from setting the files directory and running cron as requested on the Status screen.
7. Download and install ImageMagick 6.3.8-Q8 using the defaults. The installation directory is: C:\Program Files\ImageMagick-6.3.8-Q8. Verify that it's working by executing convert from the command line as instructed in the ImageMagick install. Reboot for good measure.
8. Download Images module (5.x-1.6). Copy image.imagemagick.inc to the includes directory.
9. In Drupal, click on the Image toolkit menu. The ImageMagick option is listed, which I select. For path to the binary I enter "C:\Program Files\ImageMagick-6.3.8-Q8\convert.exe". Click on Save configuration.

Pause here - are these the correct steps??? For example, am I supposed to install the Images module or just copy the image.imagemagick.inc?

If the steps above look right, could someone else PLEASE try this and see if you get the same result as below?! If this isn't enough information to go on, I don't know what is!

After I click on Save configuration, the PC beeps and the page hangs, with no further messages or information. If I click on another menu, I get a message that ImageMagick can't find the convert.exe file and that the path must be set from Image toolkit menu. Clicking on the Image toolkit menu just results in a repeat of the error beep and the page hanging. Nothing in the Drupal watchdog log (even after installing devel module and manually enabling debugging). Nothing in the Apache log. Nothing in the PHP log. Nothing in the Windows XP log.

This abortive attempt to install ImageMagick had another nasty side-effect on my development system - it completely killed Imagecache and prevented it from scaling images any more.

If nobody else can duplicate this, then I'll just go crawl into a hole for a while, then crawl out and install Linux. But really, it's a piece of cake to replicate by following the above procedure, and if it's a bug it needs to be fixed.

If I've done something wrong, I'd be very appreciative if somebody could point out the problem; maybe I've overlooked something that more seasoned users would think obvious.


drewish’s picture

Status: Active » Postponed (maintainer needs more info)

you need to change the toolkit back to gd before deleting the imagemagick.inc file. there's an existing issue with core for that: http://drupal.org/node/113385

so i just downloaded the latest version of imagemagick thinking that perhaps they'd changed something, i deleted all the drupal image toolkit variables and set it up again... with no problems.

do you have imagemagick in your path? it wouldn't think that it should be but maybe it's trying to find some library via the path...

also try the 2.x version of the image module. since we're grasping at straws here.

drewish’s picture

Version: 5.x-1.6 » 5.x-2.x-dev
Status: Postponed (maintainer needs more info) » Needs review

this is a long shot but give the attached patch (for the 2.x branch) a try.

wotstheguts’s picture

Hi drewish, thanks for your replies. Yes ImageMagick is in the path env variable. Are you using Windows XP with similar versions of AMP? I'm really surprised you don't have the same probs!

Regarding changing the toolkit back to GD2 before deleting the .inc file, the problem is that I can no longer get into the menu to change it back.

I will try the 5.x-2.x-dev version, but where do I download it - I can't find it on drupal.org? Also, the patch you mentioned doesn't seem to be attached to #12.

The following may or may not be a clue. Once I get the error, after a delay the following message appears in Windows event log:

Faulting application httpd.exe, version, faulting module libhttpd.dll, version, fault address 0x0001ca5a.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

I get the same error in Apache 2.0.63. I can't say for sure that it's related to the problem, but the error only seems to occur after I try and install the IM include.


EddyGL’s picture

Version: 5.x-1.6 » 5.x-2.x-dev
Status: Postponed (maintainer needs more info) » Needs review

I've been getting a very similar error, and narrowed down the cause to a space in the path. When I installed ImageMagick into a folder with no space, I'd get the same error, but this time it seemed due to Apache being in a folder containing a space as well..
Being the default install of Apache from apache.org it's intalled to

C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

When I kill the cmd.exe which is hung, I get the page showing the command which was run...

start "window title" /DC:\Program Files\Apache Software Foundation\Apache2.2\htdocs /b "C:\imagemagick\convert.exe" -version

If I try to manually run this command in a command window.. I'll get a popup error stating.. "Windows cannot find "Files\Apache. Make sure you typed......" etc etc..

This seems to prove the space in the path is screwing up the command. I don't know php well enough to change the source to handle this.

Installing Apache into the root, ie c:\Apache, and Imagemagick as well into say c:\imagemagick would be a work around ( though I haven't confirmed this myself, I just went back to GD ), but not really a "fix" of the issue, since just by default Imagemagick and Apache install to folders contain spaces on Windows.

BTW, I'm currently using Apache 2.2.8 and Drupal 6.2, however I first saw the error in Drupal 5.x as well

dman’s picture

I just read all down this thread and started muttering to myself "space in the path, space in the path" from about #3 ;-)

Don't shift your installs, instead use c:\progra~1\ImageMagick-6.3.8-Q8\convert.exe
Windows is still DOS at the commandline.
The Apache path will be something similar, although I can't remember how to find the DOS path any more. I did think it was silly of the Apache windows distro to intentionally put itself in a folder with lots of spaces in...

drewish’s picture

humm... it might be the webroot rather than the apache directory... as per my apache setup notes i put apache in the default directory but i'd use a webroot with no spaces...

so i'm going to disagree with dman, it's not the imagemagick path because that is quoted, the problem is probably the /d working path that is not quoted.

drewish’s picture

843 bytes

give this a try then.

martenw’s picture

I had a similar problem and that patch did the trick for me! Thanks a bunch!

drewish’s picture

Status: Needs review » Fixed

great, thanks. committed to DRUPAL-5 and DRUPAL-5--2. looks like it's already made it's way into HEAD.

drewish’s picture

Project: Image » ImageAPI
Version: 5.x-2.x-dev » 5.x-1.x-dev
Component: imagemagick toolkit » ImageAPI Imagick

Bumping this over to the ImageAPI because it got a copy of the underlying bug when it borrowed code from the image module.

drewish’s picture

Category: support » bug
Status: Fixed » Needs review
932 bytes
dopry’s picture

Status: Needs review » Fixed

committed to head, rev 1.10

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

beautifulmind’s picture

I got following error after uploading the image.

ImageMagick reported an error: convert: Negative or zero image
size `/tmp/tmp_kMG2gH'.

can any one figure out what's the wrong?

Thank you.

lipinponmala007’s picture

for me i have similar error .but it is found that the pictures are not with write permission .so i gave them the permission so the problem got solved.
since i am new to drupal i don't know whether i am right ....