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
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.
Related
I have a bunch of base64 encoded images which I want to convert to their corresponding image files using magick (ImageMagick version 7). I can paste the base64 directly into various online converters which works. But command-line magick is failing.
Example of a file is attached in "x.txt". Pasting it into an online converter like https://onlinejpgtools.com/convert-base64-to-jpg readily yields an image. But this command line fails:
magick inline:`cat x.txt` x.png
This says "magick: corrupt image". If I remove the "inline" part, I get "magick: unable to open image". Here is a link to download the sample file x.txt:
In Imagemagick, try (no cat). That works for me.
magick inline:x.txt x.png
Or pipe from cat to magick as
cat tmp.txt | magick inline:- y.png
well I've given up. I don't think I understand how GS works... as far as I understand GS replaces all fonts that are not embedded and should not touch already embedded ones? why is it replacing them? I have a pdf file that contains 2 embedded fonts and 1 not embedded (ArialMT).
I'm using command:
"gswin64c.exe -I "C:/Program Files/gs/gs9.56.1/Resource/Init" -sFONTMAP="Fontmap.GS" -dNOSAFER -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=LeaveColorUnchanged -dBATCH -dNOPAUSE -sDEVICE="pdfwrite" -dAutoRotatePages=/None -dPDFA=3 -sOutputFile="pdfa.pdf" "original.pdf"
all I get with this command is this error:
GPL Ghostscript 9.56.1: Actual TT subtable offset xxxxx differs from one in the TT header yyyy. (multiple ones like this)
The following errors were encountered at least once while processing this file:
error executing PDF token
**** This file had errors that were repaired or ignored.
**** The file was produced by:
**** >>>> StreamServe Communication Server 16.6.1 GA Build 319 (64 bit) <<<<
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe's published PDF
**** specification.
the output is a pdf without ANY fonts...
is there any way to force GS not to replace font if it wasn't found on the system?
why is it replacing ArialMT with NimbusSans-Regular even though I have declared a specific path to ArialMT in my FontMap.GS file?
I'd rather not share this pdf file as it contains sensitive customer data.
(osadzony podzestaw=embedded subset)
Ghost Script substitution will require embeddable fonts on windows those are usually stored in C:\Windows\Fonts
Thus if font substitution was simple (without look-up) your command could be simplified
gswin64c.exe -sFONTPATH="C:\Windows\Fonts" -dNOSAFER -sDEVICE=pdfwrite -dNEWPDF=false -dPDFA=3 -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=LeaveColorUnchanged -dAutoRotatePages=/None -o"pdfa.pdf" "original.pdf"
you need to add -dNEWPDF=false Since to include additional mapping you add -I "C:/Program Files/gs/gs9.56.1/Resource/Init" -sFONTMAP=Fontmap.gs
Thus the following should be a startpoint
gswin64c.exe -sFONTPATH="C:\Windows\Fonts" -I "C:/Program Files/gs/gs9.56.1/Resource/Init" -sFONTMAP=Fontmap.gs -dNOSAFER -sDEVICE=pdfwrite -dNEWPDF=false -dPDFA=3 -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=LeaveColorUnchanged -dAutoRotatePages=/None -o"pdfa.pdf" "original.pdf"
It will not remove warnings using a PDF file from the same developer, the difference was now there is no mention of Nimbus, but the substitutions should be better/fuller as the warning messages verified the fonts were eventually applied from windows
Note the file is smaller although the fonts are embedded, and in side by side comparison they look the same.
GPL Ghostscript 9.56.1: PDFA doesn't allow images with Interpolate true.
and
The following errors were encountered at least once while processing this file:
missing white space after number
error executing PDF token
**** This file had errors that were repaired or ignored.
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe's published PDF
**** specification.
from their report.
If I save the file from Acrobat the file size drops but the same issues reside
I have to set the Outbin in a PCL file that is generated via Ghostscript with the device=pxlcolor. I'm looking araund but didn't find the necessary parameter.
Can someone pls advice?
My commandline on windows is:
C:/Programme/gs/gs9.06/bin/gswin32c.exe -dBATCH -sDEVICE=pxlcolor -dFIXEDMEDIA -dMediaPosition=4 -dDuplex=true -sOutputFile=output.pcl -f Input.pdf
That produces a pcl file that takes it sheet(s) from the correct input tray/PaperSource.
There is no provision for this, you will have to add these manually after the file is generated.
I m converting a pdf into image using ghostscript
It almost produces good images but for one pdf the created image is having a white strip
however this strip is not present in the original pdf.
script which i hv used is below
gs -dNOPAUSE -sDEVICE=jpeg -dFirstPage=1 -dLastPage=2 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=fileName.gif -dJPEGQ=100 -r300 -q pdfName.pdf -c quit
Here the created image http://www.pictureshack.us/images/65486_1.gif
i am using Ghostscript 8.70 and the issue is fixed for the latest update i.e 9.06, but i cant upgrade to this...moreover found the issue its due -r300, so when i specify resolution of 100 then it works fine for this pdf but not for many other pdf...
You don't say what version of Ghostscript you are using, and you haven't provided the original PDF file, so I can't test it on current code. However, this 'looks like' a transparency bug, and may well be fixed in recent versions of Ghostscript.
I would suggest you upgrade to 9.06 if you haven't already and try that. If the problem persists please open a bug report at http://bugs.ghostscript.com Please attach the original PDF file and the command line you are using.
Is it possible to export odp / ppt slides as images using unoconv?
For example,
unoconv -f png presentation.ppt
But this unoconv command converts only the first slide as a png file. Is it possible to export all slides as individual images, say, 001.png, 002.png, 003.png using unoconv on the command line?
If not, could you suggest a simple bash script to go over slide by slide in the odp / ppt file to convert to images?
Thanks.
One way to do this is to first convert it to PDF, and then use Ghostscript to convert to PNG files. The following works for me:
unoconv -f pdf presentation.ppt
gs -sOutputFile=presentation-%03d.png -dNOPAUSE -dSAFER -sDEVICE=png16m \
-dBATCH -q -r300 -dGraphicsAlphaBits=4 -dTextAlphaBits=4 presentation.pdf
(The -r300 parameter says to create 300 pixels-per-inch PNG files - you may want to adjust that.)
You can covert the PPT file to HTML:
unoconv -o image/ -f html SinoProbe_02_02_001.ppt
Then the image folder will fill with HTML and JPG files.
I just tested the Export as Images extension for Open Office v4.1.1 on Windows 7. Worked GREAT. I had more control over the graphics size etc than when exporting to HTML and using the included files.
http://extensions.services.openoffice.org/en/project/export-images