ImageMagick Errors: Convert PDF to Images - image

When I run the following command to convert a PDF to Image using ImageMagic Convert util with the following parameters :
C:\Windows\system32>"C:\Program Files\ImageMagick-6.5.8-Q16\convert.exe" "D:\RealDocs.pptx.pdf" "d:\hello.jpg"
I get the following error :
convert.exe: `%s': %s "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=C:/Users/Nupitch/AppData/Local/Temp/magick-xwOF7jbV" "-fC:/Users/Nupitch/AppData/Local/Temp/magick-BescEsek" "-fC:/Users/Nupitch/AppData/Local/Temp/magick-XfLll9WM" # utility.c/SystemCommand/1964.convert.exe: Postscript delegate failed `D:\RealDocs.pptx.pdf': No such file ordirectory # pdf.c/ReadPDFImage/634.convert.exe: missing an image filename `d:\hello.jpg' # convert.c/ConvertImageCommand/2838.
please help me ~

ImageMagick cannot handle PostScript and PDF files itself and by its own. For this it uses a third party software called Ghostscript as a 'delegate'.
Has your Windows system Ghostscript installed properly? Or is not installed at all?
Try to download and install the latest version from here.
Probably you'd get a different error message if the problem is caused by a missing Ghostscript installation. But your error is:
D:\RealDocs.pptx.pdf': No such file or directory
# pdf.c/ReadPDFImage/634.convert.exe: missing an image filename `d:\hello.jpg'
This could mean that the user account you run this command under does not have permission to write to the root of the D: drive.
To test this, you could run the conversion command in a cmd.exe window in a slightly modified way:
"C:\Program Files\ImageMagick-6.5.8-Q16\convert.exe" ^
"D:\RealDocs.pptx.pdf" ^
"%userprofile%\hello.jpg"
(On Windows XP, %userprofile% usually points to c:\documents and settings\<your username>\...)

Related

GhostScript generating damaged tiff file

I am trying to generate tiff file using ghost script from a pdf.
I am using this command
gs -dSAFER -dBATCH -dNOPAUSE -dFirstPage=2 -dLastPage=2 -r450x635 -sDEVICE=tiffgray -sCompression=lzw -sOutputFile=test2_local.tif foil.pdf
The tiff file is getting generated but it is not opening and i am getting message of damaged file. If I reduce resolution then it works fine. And it also works if remove the compression.
But i can not remove compression as file size generated is 174MB. I am using GS 9.22 on mac OS.

imagemagick won't recognize new path to Ghostscript

I'm trying to convert some PDFs to jpegs using imagemagick . I'm working on win 10, 64 with python 3.62 - 64 bit and wand 0.4.4. I've been able to get wand working with ImageMagick-6.9.9-Q16-HDRI. I have all this set up on a E USB flash drive. I've set both the Path and MAGICK_HOME env vars to
E:\ImageMagick-6.9.9-Q16-HDR;E:\gs\bin
Originally I installed ghostscript 9.22 - 64 at E:/gs9.22 , but the I read ( PythonMagick can't find my pdf files) that 64 bit may not work so I deleted that and got ghostscript 9.22 - 32 bit, which I installed as above.
I ran:
$ convert myfile.pdf test.jpg
convert.exe: FailedToExecuteCommand `"E:/gs9.22/bin/gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=png
alpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=C:/Users/MYaCCount/AppData/Local/Temp/magick-9524p6yKrXNmpJc3%d" "-fC:/Users/MYaCCount/AppData/Local/Te
mp/magick-9524TRGHmKoW5SkX" "-fC:/Users/MYaCCount/AppData/Local/Temp/magick-9524pKGelk0Un3Bp"' (The system cannot find the file specified.
) # error/delegate.c/ExternalDelegateCommand/459.
convert.exe: PDFDelegateFailed `The system cannot find the file specified.
' # error/pdf.c/ReadPDFImage/809.
convert.exe: no images defined `test.jpg' # error/convert.c/ConvertImageCommand/3258.
Why is the system looking for the 64 bit ghostscript path (which I deleted) ? I have closed and reopened my editor and the environmental var editor.
I ended up using the regedit utility to manually go through and remove all traces of 'ImageMagick'. The included uninstall utility in Imagemagick did not remove everything. After this I was able to install new versions.

PDF to PNG conversion using Ghostscript: only the fist page is in the output PNG file

I am using Ghostscript on Windows 7 machine to convert PDF to PNG. My input PDF has many pages but the PNG file only contain the first page !
I am using the following command line:
gswin64c -sDEVICE=png16m -r720x720 -dNOPAUSE -dBATCH -sOutputFile=79245340005_1602.png 79245340005_1602.pdf
and the logfile is as follow:
GPL Ghostscript 9.20 (2016-09-26)
Copyright (C) 2016 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Page 2
As you can see, it seems that both pages are processed but only the first one appear in the final PNG file. Any idea what is wrong in my command line ? I try to look a the documentation but didn't find what I am doing wrong. If I have a single PDF file with 10 pages, I wand a single output PNG file with 10 pages.
My original command line was as follow but had the same issue:
gswin64c -q -sPAPERSIZE=a4 -sDEVICE=png16m -dTextAlphaBits=4 -r720x720 -o 79245340005_1602.png -dNOPAUSE -dBATCH 79245340005_1602.pdf
Thanks
Fabien
PNG can hold only one image per file. Use TIFF or the like for multiple images per file.
Try to use following syntax to achieve rasterizing into several png's
gswin64c -q -sPAPERSIZE=a4 -sDEVICE=png16m -dTextAlphaBits=4 -r720x720 -o -sOutputFile='79245340005_1602_%00d.png' -dNOPAUSE -dBATCH 79245340005_1602.pdf

How to get page size(Trim/Bleed/Art/Media....) in PDF with GhostScript 9.19 in windows 10?

I want page size (Trim/Bleed/Art/Media....) in PDF with GS 9.19 in windows 10.
I tried this command :
gswin64c -dNODISPLAY -q -dDumpMediaSizes "../lib/PDFA_def.ps" test.pdf
, but I had below error.
Error: /undefinedfilename in --file--
Thank you for your information.
Why would you think that pdfa_def.ps, which is used to create a PDF/A compliant PDF file would give you any information ?
I suspect you actually mean pdf_info.ps, which is located in the toolbin folder, not the lib folder.

Ghostscript 9.14 - Create PDFA from PS

I have a requirement of creating PDFA Document from PS in my LINUX environment.
I am using the following command line to generate the same:
gs -q -dPDFA=2 -sColorConversionStrategy=/RGB -dBATCH -dPDFSETTINGS=/screen -dNOPAUSE -dNOOUTERSAVE -sProcessColorModel=DeviceRGB -sDEVICE=pdfwrite -sOutputFile=pdfA_New.pdf /project/mgos/9.14/lib/PDFA_def.ps Sample.ps
I am able to create PDFA Document however the Standards show the following:
1. Standard:PDF/A-2B . This should be 2U for me.
Also the Output Intent data is missing.
Let me know if I am missing anything.
Thanks,
Arun
Ghostscript doesn't support PDF/A-2U at all, just PDF/A-2b. I really really don't recommend use of PDFSETTINGS if you plan to request PDF/A output.
And you should upgrade to Ghostscript 9.15 as well.

Resources