Temporary file permission problem with convert

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
mbnewmedia

Temporary file permission problem with convert

Post by mbnewmedia »

I am calling the ImageMagickObject from an ASP program as follows:

Set objIM = CreateObject("ImageMagickObject.MagickImage.1")
sFilename = "G:\Mike\PhotoShop\pages\CD-2007-06-14-A01-ASection.pdf"
sJpgFilename = "G:\Mike\PhotoShop\pages\CD-2007-06-14-A01-ASection.jpg"
sResult = objIM.Convert(sFilename, "-resize", "x500", sJpgFilename)

and I get the following error:

convert: 430: unable to create temporary file `G:\Mike\PhotoShop\pages\CD-2007-06-14-A01-ASection.pdf': Permission denied:
convert: 410: missing an image filename `G:\Mike\PhotoShop\medium\CD-2007-06-14-A01-ASection.jpg':

The program does have R/W access to G:\Mike\PhotoShop\pages\. Is ImageMagick writing temporary file(s) to some other work folder?
mbnewmedia

Re: Temporary file permission problem with convert

Post by mbnewmedia »

:D I found the solution to this. ImageMagick was using the default TMP system variable, and th eprogram could not write to that folder. I put in a new system variable for MAGICK_TMPDIR, pointed to a writeable folder, and this overrides the TMP variable. Works like a champ now.
hina

Re: Temporary file permission problem with convert

Post by hina »

Hello mbnewmedia,

I get exactly the same error message:
convert: 430: unable to create temporary file 'xyz.pdf': Permission denied:
convert: 410: missing an image filename `xys1.jpg'

I am able to convert the file from command prompt, but it gives me the above error messsage in asp code.

How were you able to solve it??? I have no clue about TMP system variable,MAGICK_TMPDIR.........

Please help!!!!! Other team/modules are dependant on my completion of this code.

Thanks,
mbnewmedia

Re: Temporary file permission problem with convert

Post by mbnewmedia »

Your case may be differnet than mine, but for me, my asp program ran from a Windows web server and ImageMagick needs to use a temporary folder to write out a work file. My asp program did not have write permission to the default system TMP folder, which was like E:/temp I think.

So, you can set ImageMagicks TMP folder.

Log into the server as administrator.

Create temporary work folder E:\inetpub\wwwroot\work

Right click My Computer.
Click Properties.
Advanced tab.
Click Environment Variables.
Under System variables click New.
Enter:
Variable name: MAGICK_TMPDIR
Variable value: E:\inetpub\wwwroot\work
OK

This in effect set ImageMagick to use the new temporary work folder for its temporary files, and the asp program has write privileges to wwwroot/work.
hina

Re: Temporary file permission problem with convert

Post by hina »

Thanks a lot. It worked!!!!
Post Reply