Page 1 of 1

Convert pdf to png/jpg hangs

Posted: 2014-11-01T03:11:38-07:00
by Skom
Hello.

When I trying to convert some pdf to png or jpg I got infinity loop in IM/gs
Here is output.

Code: Select all

 » convert -debug All test.pdf test.png
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Configure convert[8654]: utility.c/ExpandFilenames/945/Configure
  Command line: convert {-debug} {All} {test.pdf} {test.png}
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Policy convert[8654]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Path; rights=Read; pattern="test.pdf" ...
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Blob convert[8654]: blob.c/OpenBlob/2598/Blob
    read 3 magic header bytes
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Cache convert[8654]: cache.c/DestroyPixelCache/965/Cache
  destroy
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/usr/local/share/ImageMagick-6/magic.xml"
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/usr/local/lib/ImageMagick-6.8.9//config-Q16/magic.xml"
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/usr/local/etc/ImageMagick-6/magic.xml"
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/usr/local/share/doc/ImageMagick-6/magic.xml"
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/.config/ImageMagick/magic.xml"
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/.magick/magic.xml"
2014-11-01T12:43:05+03:00 0:00.000 0.000u 6.8.9 Configure convert[8654]: magic.c/LoadMagicCache/773/Configure
  Loading magic configure file "/usr/local/etc/ImageMagick-6/magic.xml" ...
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Policy convert[8654]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Coder; rights=Read; pattern="PDF" ...
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Policy convert[8654]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Path; rights=Read; pattern="test.pdf" ...
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Blob convert[8654]: blob.c/OpenBlob/2598/Blob
    read 3 magic header bytes
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Cache convert[8654]: cache.c/DestroyPixelCache/965/Cache
  destroy
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Policy convert[8654]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Path; rights=Read; pattern="test.pdf" ...
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Blob convert[8654]: blob.c/OpenBlob/2598/Blob
    read 3 magic header bytes
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Resource convert[8654]: resource.c/AcquireUniqueFileResource/468/Resource
  ...
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Resource convert[8654]: resource.c/AcquireUniqueFileResource/509/Resource
  Acquire /tmp/magick-8654AU3wt3V2GlaY
2014-11-01T12:43:05+03:00 0:00.010 0.000u 6.8.9 Resource convert[8654]: resource.c/RelinquishUniqueFileResource/895/Resource
  Relinquish /tmp/magick-8654AU3wt3V2GlaY
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Resource convert[8654]: resource.c/AcquireUniqueFileResource/468/Resource
  ...
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Resource convert[8654]: resource.c/AcquireUniqueFileResource/509/Resource
  Acquire /tmp/magick-8654fBxxztn6A3Qt
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/usr/local/share/ImageMagick-6/delegates.xml"
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/usr/local/lib/ImageMagick-6.8.9//config-Q16/delegates.xml"
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/usr/local/etc/ImageMagick-6/delegates.xml"
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/usr/local/share/doc/ImageMagick-6/delegates.xml"
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/.config/ImageMagick/delegates.xml"
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Configure convert[8654]: configure.c/GetConfigureOptions/679/Configure
  Searching for configure file: "/root/.magick/delegates.xml"
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Configure convert[8654]: delegate.c/LoadDelegateCache/1475/Configure
  Loading delegate configuration file "/usr/local/etc/ImageMagick-6/delegates.xml" ...
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Resource convert[8654]: resource.c/AcquireUniqueFileResource/468/Resource
  ...
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Resource convert[8654]: resource.c/AcquireUniqueFileResource/509/Resource
  Acquire /tmp/magick-8654ugv-THLFzUxZ
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Resource convert[8654]: resource.c/RelinquishUniqueFileResource/895/Resource
  Relinquish /tmp/magick-8654ugv-THLFzUxZ
2014-11-01T12:43:05+03:00 0:00.140 0.130u 6.8.9 Policy convert[8654]: policy.c/IsRightsAuthorized/574/Policy
  Domain: Delegate; rights=Execute; pattern="gs" ...
   **** Unknown operator: '70.761.396137.516' looks like a malformed number, replacing with 0.
   **** Unknown operator: '334..6' looks like a malformed number, replacing with 0.
   **** Unknown operator: '322.822.32' looks like a malformed number, replacing with 0.
   **** Unknown operator: '523.676365.832' looks like a malformed number, replacing with 0.
   **** Unknown operator: '70.761.396137.516' looks like a malformed number, replacing with 0.
   **** Unknown operator: '334..6' looks like a malformed number, replacing with 0.
   **** Unknown operator: '322.822.32' looks like a malformed number, replacing with 0.
   **** Unknown operator: '523.676365.832' looks like a malformed number, replacing with 0.
   **** Unknown operator: '57.807955.34..6.8296' looks like a malformed number, replacing with 0.
   **** Unknown operator: '32634..6.77816' looks like a malformed number, replacing with 0.
   **** Unknown operator: '3161.34..6.7.791' looks like a malformed number, replacing with 0.
   **** Unknown operator: '57562.6.791' looks like a malformed number, replacing with 0.
   **** Unknown operator: '70.76.2156131791' looks like a malformed number, replacing with 0.
   **** Unknown operator: '57562.6.791' looks like a malformed number, replacing with 0.
   **** Unknown operator: '321334..41.102' looks like a malformed number, replacing with 0.
   **** Unknown operator: '.416.80' looks like a malformed number, replacing with 0.
   **** Unknown operator: '32.041..6.024' looks like a malformed number, replacing with 0.
   **** Unknown operator: '3231511..6.071' looks like a malformed number, replacing with 0.
   **** Unknown operator: '.6.138' looks like a malformed number, replacing with 0.
   **** Unknown operator: '31..032' looks like a malformed number, replacing with 0.
   **** Unknown operator: '31..061' looks like a malformed number, replacing with 0.
   **** Unknown operator: '70.76.32' looks like a malformed number, replacing with 0.
   **** Unknown operator: '8222.21562.57791' looks like a malformed number, replacing with 0.
   **** Unknown operator: '31.2.21562.57795606621562.3032556.555' looks like a malformed number, replacing with 0.
   **** Unknown operator: '91..754' looks like a malformed number, replacing with 0.
   **** Unknown operator: '59.793222.0633' looks like a malformed number, replacing with 0.
   **** Unknown operator: '7267.89322.484' looks like a malformed number, replacing with 0.
   **** Unknown operator: '702.159322320.8702.1591' looks like a malformed number, replacing with 0.
   **** Unknown operator: '66.8439322.484' looks like a malformed number, replacing with 0.
   **** Unknown operator: '66.7159322320.866.71596' looks like a malformed number, replacing with 0.
   **** Unknown operator: '67.7.9' looks like a malformed number, replacing with 0.
   **** Unknown operator: '3971923..196' looks like a malformed number, replacing with 0.
   **** Unknown operator: '7222.3132323.196' looks like a malformed number, replacing with 0.
   **** Unknown operator: '23..196' looks like a malformed number, replacing with 0.
   **** Unknown operator: '361.323.3465' looks like a malformed number, replacing with 0.
   **** Unknown operator: '361.332323.0' looks like a malformed number, replacing with 0.
   **** Unknown operator: '361.323.6314' looks like a malformed number, replacing with 0.
   **** Unknown operator: '23..196' looks like a malformed number, replacing with 0.
   **** Unknown operator: '68.62132323.196' looks like a malformed number, replacing with 0.
   **** Unknown operator: '5018923..196' looks like a malformed number, replacing with 0.
   **** Unknown operator: '70..7545' looks like a malformed number, replacing with 0.
   **** Unknown operator: '70..7544' looks like a malformed number, replacing with 0.
   **** Unknown operator: '70..7545' looks like a malformed number, replacing with 0.
   **** Unknown operator: '702320.7.196956195' looks like a malformed number, replacing with 0.
   **** Unknown operator: '693042.7.196956195' looks like a malformed number, replacing with 0.
   **** Unknown operator: '.353042.1' looks like a malformed number, replacing with 0.
   **** Unknown operator: '.353042.1' looks like a malformed number, replacing with 0.
   **** Unknown operator: '54102936.4824353196436.465435319144' looks like a malformed number, replacing with 0.
   **** Unknown operator: '36644343531849456.41343531801456.3734353176564' looks like a malformed number, replacing with 0.
   **** Unknown operator: '66232493531841456.15993531841456.189353184564' looks like a malformed number, replacing with 0.
   **** Unknown operator: '3486221353765934861914353819.34861497.353874' looks like a malformed number, replacing with 0.
   **** Unknown operator: '353479.34739.696565324347691345536159347688744' looks like a malformed number, replacing with 0.
   **** Unknown operator: '353699.3473861435376934768.696568019347681294' looks like a malformed number, replacing with 0.
   **** Unknown operator: '4766794553929.34736334553929.347357894' looks like a malformed number, replacing with 0.
   **** Unknown operator: '583.79.347318291' looks like a malformed number, replacing with 0.
Then it hangs and in top I could see

Code: Select all

15209 root      20   0 1030176 966340   6204 R  99.3  0.4   1:02.67 gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pam -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r72x72 -dUseCIEColor -sOutputFile=/tmp/magick-15207mI_npATUgwSg%d -f/tmp/magick-15207TUPZw3q7ze04 -f/tmp/magick-15207o-msKazvN47S
It can be finished by ^C only.
Tons of other pdf's can be converted normally.

Some information

Code: Select all

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:        14.04
Codename:       trusty
__________________________________________________

 » convert --version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2014-10-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib fontconfig freetype jng jpeg pangocairo png x xml zlib

__________________________________________________

» gs -v
GPL Ghostscript 9.15 (2014-09-22)
Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.

__________________________________________________

 » convert -list resource 
  File       Area     Memory        Map       Disk   Thread  Throttle       Time
--------------------------------------------------------------------------------
   768   540.92GB  251.89GiB  503.77GiB  unlimited       32         0  unlimited


This pdf source for reproducing
http://dlcdnet.asus.com/pub/ASUS/EB1501 ... garian.zip

I think that this pdf is little bugged but I'd like to got any converts to be finished with some errors strings in stdout.
I don't skilled in IM/GS. Maybe should I do some tricks?

Re: Convert pdf to png/jpg hangs

Posted: 2014-11-01T05:22:21-07:00
by magick
Post a bug report to the Ghostscript maintainers. This Ghostscript command hangs indefinitely:

Code: Select all

gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 \
   "-sDEVICE=pam" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor  \
   "-sOutputFile=EB1501_Hungarian.pam" EB1501_Hungarian.pdf

Re: Convert pdf to png/jpg hangs

Posted: 2014-11-01T16:07:27-07:00
by Skom
Thank you very much.

Bug reported

http://bugs.ghostscript.com/show_bug.cgi?id=695661