Page 1 of 1

File not found with converting PDF to image

Posted: 2017-03-08T03:51:47-07:00
by Ankha
Version: ImageMagick 7.0.2-4 Q16 x86 2016-07-11 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib

OS is Windows 10 Enterprise Version 1607

I also have ghostscript 9.20 installed.

I have a bug when trying to convert some PDF files using the command line (it works fine for other PDF files):

Code: Select all

convert doc.pdf doc.tif
The error is:

Code: Select all

convert: PDFDelegateFailed `[ghostscript library 9.20] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor  "-sOutputFile=C:/Users/xxx/AppData/Local/Temp/magick-9164UCQ6lA1_bVKQ%d" "-fC:/Users/xxx/AppData/Local/Temp/magick-9164YhuWq1nhG7Ol" "-fC:/Users/xxx/AppData/Local/Temp/magick-9164zLuzJoM7VFYt"': Error: /undefined in --get--
Operand stack:
   --dict:5/5(L)--   0   false   1   --dict:6/14(L)--   --dict:6/14(L)--   Subtype
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1983   1   3   %oparray_pop   1982   1   3   %oparray_pop   1966   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --dict:6/6(L)--   --nostringval--   7   %dict_continue   --nostringval--
Dictionary stack:
   --dict:1205/1684(ro)(G)--   --dict:1/20(G)--   --dict:83/200(L)--   --dict:83/200(L)--   --dict:135/256(ro)(G)--   --dict:291/300(ro)(G)--   --dict:32/32(L)--   --dict:0/6(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.20: Unrecoverable error, exit code 1
 @ error/pdf.c/InvokePDFDelegate/274.
convert: no images defined `doc.tif' @ error/convert.c/ConvertImageCommand/3235.
I don't know exactly how ImageMagick uses ghostscript, but indeed, the files
  • C:/Users/xxx/AppData/Local/Temp/magick-9164YhuWq1nhG7Ol
  • C:/Users/xxx/AppData/Local/Temp/magick-9164zLuzJoM7VFYt
don't exist. I suspect that's the reason why ghostscript complains and returns a "No such file or directory" error.

The PDF file contains three CMYK images (one of which has a transparent area), that's all: http://www.vekn.fr/graphical_design/doc.pdf (I reduced the size of the images to make the file smaller)

Thanks for your help.

Re: File not found with converting PDF to image

Posted: 2017-03-08T06:12:58-07:00
by Ankha
Based on other topics, I tested the following command line :

"c:\Program Files (x86)\gs\gs9.20\bin\gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -sOutputFile=test.tif doc.pdf

and it fails, so it must be a ghostscript issue after all. I created a ticket: https://bugs.ghostscript.com/show_bug.cgi?id=697654

Re: File not found with converting PDF to image

Posted: 2017-03-08T08:19:41-07:00
by Ankha
The PDF was badly formed, hence the ghostscript error (even though it could be opened in FoxIt PhantomPDF without error).