Page 1 of 1

Changing density causes an exeution comand error

Posted: 2015-10-15T08:03:51-07:00
by guysoft
Hey,
On certain PDF files, when I run this command with -density 200 like this:

Code: Select all

convert -density 200 "/mnt/git/tmp/E33.pdf" -quality 100 /tmp/aaaa.png
I get this error:

Code: Select all

convert: FailedToExecuteCommand `"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r200x200"  "-sOutputFile=/tmp/magick-2957kte8nXSWCLOh%d" "-f/tmp/magick-2957ERH_nxorvD7R" "-f/tmp/magick-2957J7WL_niXZyqs"' (-1) @ error/delegate.c/ExternalDelegateCommand/461.
convert: no images defined `/tmp/aaaa.png' @ error/convert.c/ConvertImageCommand/3210.
However,
1. it works fine with -density 100, eg:

Code: Select all

convert -density 100 "/mnt/git/tmp/E33.pdf" -quality 100 /tmp/aaaa.png
Moreover this command works fine on Imagemagick 6.6.9-7 Ubuntu 12.04, but fails on Imagemagick 6.7.7-10 Ubuntu 14.10 and later versions.

Is there a way to debug what gs command is being ran? Is there a way to figure out what is breaking?

Thanks!

Re: Changing density causes an exeution comand error

Posted: 2015-10-15T09:08:42-07:00
by fmw42
IM was undergoing some major changes during the 6.7.7.x versions. Both are very old. Can you upgrade to a more current version. IM is now at 6.9.2.4.

Also -quality 100 does not mean the same thing for PNG as it does for JPG. See http://www.imagemagick.org/script/comma ... hp#quality

Re: Changing density causes an exeution comand error

Posted: 2015-10-15T09:43:19-07:00
by guysoft
This also happens on later versions, I gave a version where this did not happen, this was to show this is a regression, and not a problem in the pdf (which unfortunately does not belong to me and I can't share).
Just to be safe, I have checked out the git repo and built from the ImageMagick-6 branch. commit e69bdbeba63b2fb25d485383da9d17d4ed78cc0f.
That means I am on the going-to-be 6.9.2-5, the commit is from yesterday.

The error I get now is:

Code: Select all

guy@golem4:~/tmp/ImageMagick$ /opt/imagemagick/bin/convert -density 200 "/mnt/git/tmp/E33.pdf" -quality 100 /tmp/aaaa.png
convert: FailedToExecuteCommand `"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r200x200"  "-sOutputFile=/tmp/magick-13863--A45JDwYfAj%d" "-f/tmp/magick-138634G1-M1Y0j17F" "-f/tmp/magick-13863cFTsyeXL2RF2"' (-1) @ error/delegate.c/ExternalDelegateCommand/483.
convert: no images defined `/tmp/aaaa.png' @ error/convert.c/ConvertImageCommand/3230.
So now we have the exact source:
http://git.imagemagick.org/repos/ImageM ... d4ed78cc0f

And the line is:
http://git.imagemagick.org/repos/ImageM ... ate.c#L483

This execution is printing something relevant, it looks like the gs command is failing, but I am not sure why from the actual error, is there a way to compare the executed command parameters?

Re: Changing density causes an exeution comand error

Posted: 2015-10-15T09:51:53-07:00
by fmw42
convert: FailedToExecuteCommand `"gs"
Do you have Ghostscript installed (in the right locations for IM to find it) and what version of GS?

Re: Changing density causes an exeution comand error

Posted: 2015-10-15T09:54:49-07:00
by guysoft

Code: Select all

guy@golem4:~/tmp/ImageMagick$ /usr/bin/gs -version
GPL Ghostscript 9.15 (2014-09-22)
Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.
Just making sure you didnt mess- the command *works* with -quality 100.
How could a parameter effect finding the binary?

Re: Changing density causes an exeution comand error

Posted: 2015-10-15T10:02:26-07:00
by fmw42
Just making sure you didnt mess- the command *works* with -quality 100.
How could a parameter effect finding the binary?
It was just a comment that you might want to review your quality setting as 100 may not be optimal.

Re: Changing density causes an exeution comand error

Posted: 2015-10-15T10:09:15-07:00
by fmw42
This works just fine for me on IM 6.9.2.5 beta Q16 Mac OSX with GS 9.10 and libpng 1.6.12_0

Code: Select all

convert logo: logo.pdf
im6925beta convert logo.pdf -quality 100 logo.png

Perhaps the newer GS you are using is buggy?

Check you delegates.xml file for ps

<delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>

<delegate decode="ps:cmyk" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>

<delegate decode="ps:color" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>

Do you have the same -sDEVICEs?

Re: Changing density causes an exeution comand error

Posted: 2015-10-15T10:44:21-07:00
by guysoft
The problem is not quality, its density

Try:

Code: Select all

convert -density 200 "logo.pdf" -quality 100 /tmp/aaaa.png
Note, Had to change from -sDEVICE=pam&quot to -sDEVICE=pamcmyk32" and it did not help

Re: Changing density causes an exeution comand error

Posted: 2015-10-15T11:15:14-07:00
by guysoft
SOVLED IT!
Checked out ghostscript from the git repo, built that and did a symbolic link, GPL Ghostscript GIT PRERELEASE 9.19 (2015-09-23) fixes it.

There is likely a bug in Ghostscript 9.15