PDF to JPG, missing image filename error

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
kdc415

PDF to JPG, missing image filename error

Post by kdc415 »

When I attempt: 'convert test.pdf test.jpg' I get the follow error:

C:\Collateral\Temp>convert test.pdf logo.jpg
convert: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -
dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEV
ICE=bmpsep8" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-
sOutputFile=C:/DOCUME~1/ADMINI~1.NGP/LOCALS~1/Temp/magick-6vm33AHi" "-fC:/DOCUME
~1/ADMINI~1.NGP/LOCALS~1/Temp/magick-sh6_RROG" "-fC:/DOCUME~1/ADMINI~1.NGP/LOCAL
S~1/Temp/magick-oUhbFvop" @ error/utility.c/SystemCommand/1982.
convert: Postscript delegate failed `test.pdf': No such file or directory @ erro
r/pdf.c/ReadPDFImage/648.
convert: missing an image filename `logo.jpg' @ error/convert.c/ConvertImageComm
and/2970.

These commands all run fine:

convert logo: logo.pdf
convert logo.pdf logo.jpg

The test.pdf does exist. I can run the same command on the same test.pdf on my laptop running xp with same IM and GS versions and it works fine. I tried installing the VC++ redist and still no luck.

IM: 6.6.1
GS: 8.71
W2K AS SP4

I'd appreciate any advice on how to solve this problem.

Thanks, Ken
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: PDF to JPG, missing image filename error

Post by Drarakel »

I don't know why it works sometimes on your system.. But in the above example, ImageMagick simply doesn't find Ghostscript.
ImageMagick first checks the registry. If this is without success, it just calls the filename (without absolute path). You could try adding the 'gs8.71/bin' directory to your PATH environment variable.
kdc415

Re: PDF to JPG, missing image filename error

Post by kdc415 »

I finally got it all working. I was certainly thrown off by the fact that my tests worked 100% of the time:

convert logo: logo.pdf
convert logo.pdf logo.jpg

I assumed if it found logo.pdf that all was well. I can't explain it, but this was not the case. And the jpg was created every time as proved by the timestamp of the file created by the convert command.

I continued under the assumption that GS was not found and added it's path to the path environment variable via computer properties. You have to reboot for them to take effect system wide. You can add to the path variable in your command window session, but it's only good in that session.

After the reboot the covert from command line worked, so I moved on to trying the convert using COM in classic asp. No jpg was created even though the convert completed without error.

Now I assumed I had a permission issue and gave IUSR_servername full perms to the gs and imagemagick folders since the asp page was being called under that account. That didn't do it so I loaded up FileSpy, then called the asp script. After following the trail and setting perms every time I saw a denied msg I ended up with settings that worked. They're all not necessary on each folder as different folders were accessed under different user accounts at different step, but I didn't record what I did that carefully and these will get you going. I can tell you all of the 3 user accounts were used in the process of creating a jpg from a pdf.

The user accounts SYSTEM, IUSR_servername and IWAM_servername all need access to the GS & IM executable folders as well as C:\WINNT\Temp.

Hopefully this will help someone get PDF -> JPG working in asp. It certainly cost me a number of hours of trial & error after google didn't help. My system environment is up in my first post.

Regards,
Ken
kdc415

Re: PDF to JPG, missing image filename error

Post by kdc415 »

For whatever it's worth, I forgot to mention that the registry entry containing the path to GS exists, it must not have been recognized by IM when I installed it.

I will also say the coolness of what I can do now was well worth the effort, koodos to the great efforts to all of those involved.

Ken
Post Reply