0

Trying to play with ImageMagick to read scanned PDF texts, but at the point to convert the PDF to image, I've got this error, where it shows "no decode delegate for this image format `PDF' @ error/constitute.c/ReadImage/504". Been search for this solution for hours to no avail, need some help here.

OS: Windows 7 x64

ImageMagick Version: ImageMagick-6.9.8-10-Q16-x86-dll.exe

convert -list format

shows below output

   Format  Module    Mode  Description
-------------------------------------------

* native blob support
r read support
w write support
+ support for multiple images
ReverseEngineer
  • 529
  • 1
  • 5
  • 18
  • Have you installed **ghostscript** (`gs`) with matching 32/64 bit-ness? – Mark Setchell Nov 23 '18 at 07:38
  • You may have to modify your policy.xml file for the recent addition of a restriction on PDF files due to a Ghostscript bug that has subsequently been fixed. See https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413 – fmw42 Nov 23 '18 at 18:11
  • @MarkSetchell, yes i do have ghostscript installed. – ReverseEngineer Nov 26 '18 at 08:38
  • @fmw42, this does not work for me.. – ReverseEngineer Nov 26 '18 at 08:38
  • What do you get back for `convert -version`? What do you get for `gs --version`? If your output for `convert -list format` does not show anything further, then you have a problem with your install. It should list a lot of image formats. – fmw42 Nov 26 '18 at 18:28
  • `convert -version Version: ImageMagick 6.9.8-10 Q16 x86 2017-06-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 pa ngocairo png ps rsvg tiff webp xml zlib` – ReverseEngineer Nov 27 '18 at 09:40

1 Answers1

1

Looks like your delegates are not properly configured, Once Ghostscript is installed make sure the binary folder C:\Program Files/gs/gs3.0.9/bin is added to your path.

Once Done, there should be a file names delegates.mgk in you graphics magick home directory. Open that file in a text editor.

<delegate decode="pdf" encode="eps" mode="bi" command='"@PSDelegate@" -q -dBATCH -dSAFER -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=@GSEPSDevice@ "-sOutputFile=%o" -- "%i" -c quit' />

In the whole file, find and replace @PSDelegate@ with gswin64c and it should get the job done.

Kashish Soni
  • 161
  • 4