Error converting pdf to jpgs

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Plorkie

Error converting pdf to jpgs

Post by Plorkie »

Hi,

I'm currently working on a script that converts a pdf to a bunch of jpgs. Everything works fine on my local windows pc, but on my shared host it works on some pdfs and on some it doesn't which is strange. It always seems to stop on pdfs that are a bit more "complex", like images etc. Whenever I try the following command:

Code: Select all

exec("convert -blur 0 -density 300 -quality 95 fout_resultaat.pdf -scale 800x1033 fout_resultaat.jpg", $array); 
I get the error:

Code: Select all

Error: /ioerror in --showpage--
Operand stack:
 1   true
Execution stack:
%interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   --nostringval--   --nostringval--   7   1   9   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   1793   0   9   %oparray_pop   --nostringval--   --nostringval--
Dictionary stack:
--dict:1161/1684(ro)(G)--   --dict:1/20(G)--   --dict:82/200(L)--   --dict:82/200(L)--   --dict:108/127(ro)(G)--   --dict:293/300(ro)(G)--   --dict:23/30(L)--   --dict:6/8(L)--   --dict:22/40(L)--
Current allocation mode is local
Last OS error: 122
In my error log I get the following error:

Code: Select all

[Fri Oct 01 11:15:46 2010] [error] [client 83.163.187.108] convert: Postscript delegate failed `/home/pdfbroch/public_html/app/webroot/files/123/fout_resultaat.pdf':  @ error/pdf.c/ReadPDFImage/645., referer: http://www.pdfbrochure.nl/categories/view/1
The output of the command

Code: Select all

command -list configure
is the following:

Code: Select all

Array
(
    [0] => 
    [1] => Path: /usr/lib/ImageMagick-6.6.4/config/configure.xml
    [2] => 
    [3] => Name          Value
    [4] => -------------------------------------------------------------------------------
    [5] => CC            gcc -std=gnu99 -std=gnu99
    [6] => CFLAGS        -fopenmp -g -O2 -Wall -pthread
    [7] => CONFIGURE     ./configure  '--prefix=/usr'
    [8] => COPYRIGHT     Copyright (C) 1999-2010 ImageMagick Studio LLC
    [9] => CPPFLAGS      -I/usr/include/ImageMagick
    [10] => CXX           g++
    [11] => CXXFLAGS      -g -O2 -pthread
    [12] => DEFS          -DHAVE_CONFIG_H
    [13] => DELEGATES     fontconfig freetype jpeg jng jp2 png tiff x11 xml zlib
    [14] => DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-perl=no
    [15] => EXEC-PREFIX   /usr
    [16] => FEATURES      OpenMP
    [17] => HOST          x86_64-unknown-linux-gnu
    [18] => LDFLAGS       -L/usr/lib
    [19] => LIB_VERSION   0x664
    [20] => LIB_VERSION_NUMBER 6,6,4,8
    [21] => LIBS          -lMagickCore -ltiff -lfreetype -ljasper -ljpeg -lpng -lfontconfig -lXext -lXt -lSM -lICE -lX11 -lxml2 -lz -lm -lgomp -lpthread
    [22] => NAME          ImageMagick
    [23] => PCFLAGS       -fopenmp
    [24] => PREFIX        /usr
    [25] => QuantumDepth  16
    [26] => RELEASE_DATE  2010-09-30
    [27] => VERSION       6.6.4
    [28] => WEBSITE       http://www.imagemagick.org
    [29] => 
    [30] => Path: [built-in]
    [31] => 
    [32] => Name          Value
    [33] => -------------------------------------------------------------------------------
    [34] => NAME          ImageMagick
)
My host has been very helpful so far and updated imagemagick and ghostscript to the latest versions, but it didn't change anything. Is there anyway I can see which version of ghostscript imagemagick is using, because I'm thinking its still using the old version.

I hope you guys can help me on this one, because I can't figure this out.

Thank you.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Error converting pdf to jpgs

Post by Drarakel »

You could execute "convert -verbose file.pdf file.jpg".
With "-verbose", you should be able to see the Ghostscript command that ImageMagick is using. If you see e.g. "gs" as filename there, then just execute "gs -ver" and you should have the version that IM tries to use.
(The latest Ghostscript version - v9.00 - has quite improved, by the way.)
Plorkie

Re: Error converting pdf to jpgs

Post by Plorkie »

Hi, I've tried the verbose option, but I'm still running into the following problems.

On some pdfs everything works fine and I get the following feedback:

Code: Select all

Array
(
    [0] => /home/pdfbroch/public_html/app/webroot/files/149/goed_resultaat.pdf=>/home/pdfbroch/public_html/app/webroot/img/149/zoom/goed_resultaat-0.jpg[0] PDF 2479x3508=>730x1033 730x1033+0+0 16-bit DirectClass 303KB 17.940u 0:09.850
    [1] => /home/pdfbroch/public_html/app/webroot/files/149/goed_resultaat.pdf=>/home/pdfbroch/public_html/app/webroot/img/149/zoom/goed_resultaat-1.jpg[1] PDF 2479x3508=>730x1033 730x1033+0+0 16-bit Grayscale DirectClass 283KB 9.140u 0:04.960
    [2] => /home/pdfbroch/public_html/app/webroot/files/149/goed_resultaat.pdf=>/home/pdfbroch/public_html/app/webroot/img/149/zoom/goed_resultaat-2.jpg[2] PDF 2479x3508=>730x1033 730x1033+0+0 16-bit DirectClass 119KB 1.830u 0:01.150
)

But on most pdfs, nothing happens. The convert command doesn't give any feedback and everything just stops. My host can't find the problem.

On my local computer everything works fine and I get the following feedback from the command:

Code: Select all

[ghostscript library] Files/gs/gs9.00/bin/gswin32c.exe" -q -dQUIET -dPARANOIDSAF
ER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=
0 -dGridFitTT=2 "-sDEVICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r
72x72" -dUseCIEColor  "-sOutputFile=C:/Users/David/AppData/Local/Temp/magick-7Jh
jtEOF" "-fC:/Users/David/AppData/Local/Temp/magick-bVEvUrC5" "-fC:/Users/David/A
ppData/Local/Temp/magick-sR1_rGyT"C:/Users/David/AppData/Local/Temp/magick-7Jhjt
EOF[0] PNM 421x595 421x595+0+0 8-bit ColorSeparation DirectClass 16.03MB 0.062u
0:00.063
C:/Users/David/AppData/Local/Temp/magick-7JhjtEOF[1] PNM 842x595 842x595+0+0 8-b
it ColorSeparation DirectClass 16.03MB 0.062u 0:00.069
C:/Users/David/AppData/Local/Temp/magick-7JhjtEOF[2] PNM 842x595 842x595+0+0 8-b
it ColorSeparation DirectClass 16.03MB 0.047u 0:00.069
C:/Users/David/AppData/Local/Temp/magick-7JhjtEOF[3] PNM 842x595 842x595+0+0 8-b
it ColorSeparation DirectClass 16.03MB 0.062u 0:00.069
C:/Users/David/AppData/Local/Temp/magick-7JhjtEOF[4] PNM 842x595 842x595+0+0 8-b
it ColorSeparation DirectClass 16.03MB 0.047u 0:00.069
C:/Users/David/AppData/Local/Temp/magick-7JhjtEOF[5] PNM 842x595 842x595+0+0 8-b
it ColorSeparation DirectClass 16.03MB 0.047u 0:00.070
C:/Users/David/AppData/Local/Temp/magick-7JhjtEOF[6] PNM 842x595 842x595+0+0 8-b
it ColorSeparation DirectClass 16.03MB 0.031u 0:00.069
C:/Users/David/AppData/Local/Temp/magick-7JhjtEOF[7] PNM 842x595 842x595+0+0 8-b
it ColorSeparation DirectClass 16.03MB 0.031u 0:00.069
C:/Users/David/AppData/Local/Temp/magick-7JhjtEOF[8] PNM 421x595 421x595+0+0 8-b
it ColorSeparation DirectClass 16.03MB 0.016u 0:00.069
fout_resultaat.pdf[0] PDF 421x595 421x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.016u 0:00.078
fout_resultaat.pdf[1] PDF 842x595 842x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.016u 0:00.076
fout_resultaat.pdf[2] PDF 842x595 842x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.016u 0:00.074
fout_resultaat.pdf[3] PDF 842x595 842x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.000u 0:00.073
fout_resultaat.pdf[4] PDF 842x595 842x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.000u 0:00.072
fout_resultaat.pdf[5] PDF 842x595 842x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.000u 0:00.071
fout_resultaat.pdf[6] PDF 842x595 842x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.000u 0:00.070
fout_resultaat.pdf[7] PDF 842x595 842x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.000u 0:00.069
fout_resultaat.pdf[8] PDF 421x595 421x595+0+0 16-bit ColorSeparation DirectClass
 16.03MB 0.000u 0:00.068
fout_resultaat.pdf=>fout_resultaat-0.jpg[0] PDF 421x595 421x595+0+0 16-bit Color
Separation DirectClass 65.5KB 0.016u 0:00.082
fout_resultaat.pdf=>fout_resultaat-1.jpg[1] PDF 842x595 842x595+0+0 16-bit Color
Separation DirectClass 229KB 0.047u 0:00.113
fout_resultaat.pdf=>fout_resultaat-2.jpg[2] PDF 842x595 842x595+0+0 16-bit Color
Separation DirectClass 295KB 0.094u 0:00.154
fout_resultaat.pdf=>fout_resultaat-3.jpg[3] PDF 842x595 842x595+0+0 16-bit Color
Separation DirectClass 410KB 0.140u 0:00.196
fout_resultaat.pdf=>fout_resultaat-4.jpg[4] PDF 842x595 842x595+0+0 16-bit Color
Separation DirectClass 393KB 0.172u 0:00.238
fout_resultaat.pdf=>fout_resultaat-5.jpg[5] PDF 842x595 842x595+0+0 16-bit Color
Separation DirectClass 246KB 0.203u 0:00.273
fout_resultaat.pdf=>fout_resultaat-6.jpg[6] PDF 842x595 842x595+0+0 16-bit Color
Separation DirectClass 262KB 0.250u 0:00.308
fout_resultaat.pdf=>fout_resultaat-7.jpg[7] PDF 842x595 842x595+0+0 16-bit Color
Separation DirectClass 295KB 0.281u 0:00.343
fout_resultaat.pdf=>fout_resultaat-8.jpg[8] PDF 421x595 421x595+0+0 16-bit Color
Separation DirectClass 16.4KB 0.296u 0:00.357
Which makes me think that maybe there is problem with 'ColorSeperation', whatever that might be.
Post Reply