Convert PDF to JPG: 64-Bit Postscript delegate. Please help

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.
vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Convert PDF to JPG: 64-Bit Postscript delegate. Please help

Post by vielhuber » 2011-09-28T04:23:20-07:00

Hello friends.

I have 2 PDFs (created from LaTeX).

http://vielhuber.de/files/test1.pdf
http://vielhuber.de/files/test2.pdf

One has got another PDF inside it (the graphic) and the other one only has text.
As you can see, the two pdfs only differ from the graphic.

If I do now

Code: Select all

convert -colorspace RGB -interlace none -density 104.6x104.6 -quality 100 -bordercolor white test1.pdf test1.jpg
and

Code: Select all

convert -colorspace RGB -interlace none -density 104.6x104.6 -quality 100 -bordercolor white test2.pdf test2.jpg
I get two different outputs and quality:

Image
Image

Look at the text, it seems a lot is going wrong here.
It seems that antialiasing is not applied to the text.
What can I do to fix this problem?

Feel free to take the 2 PDFs and try it on your own.
Thank you VERY MUCH for your time.
Last edited by vielhuber on 2011-09-29T03:07:45-07:00, edited 2 times in total.

User avatar
fmw42
Posts: 25654
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PDF to JPG: Strange problem!! Please help

Post by fmw42 » 2011-09-28T09:59:31-07:00

-bordercolor white will do nothing without adding -border X. So it can be removed. I tried your command as:

convert -colorspace RGB -interlace none -density 104.6x104.6 -quality 100 test1.pdf test1.jpg

and had no problem. I suspect it is your IM version or version of Ghostscript.

Image

You can do supersampling, though it will take more time, increase the density by 4x and then resize the result by 1/4

convert -colorspace RGB -interlace none -density 420x420 -quality 100 test1.pdf -resize 25% test1.jpg

vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Re: Convert PDF to JPG: Strange problem!! Please help

Post by vielhuber » 2011-09-28T16:54:57-07:00

Thank you for this profund answer.

Now I want to update all my imagemagick (and gs) environment.

I'm on ubuntu 10.10.

I did the following steps:

downloaded ghostscript 9.04, unpacked it and did:

Code: Select all

./configure
make
make install
reboot.
A

Code: Select all

gs -v
shows: 9.04

thats OK!

moreover:

Code: Select all

gs -sDEVICE=jpeg -sOutputFile=test.jpg test.pdf
works also fine and converts PDF to JPG.

Then I downloaded imagemagick 6.7.2-9, unpacked it and did

Code: Select all

./configure
make
make install
sudo ldconfig /usr/local/lib
reboot.
A

Code: Select all

identify -version
shows: 6.7.2-9

thats OK!

A

Code: Select all

make check
says:

Code: Select all

All 48 tests passed
thats OK.

I can convert pictures (e.g. bmp to jpg) without any problems.

Now when I convert a PDF (doesn't matter which) to JPG with

Code: Select all

convert test.pdf test.jpg
it says:

Code: Select all

convert: no decode delegate for this image format `/tmp/magick-9N5xYUxe-00000001' @ error/constitute.c/ReadImage/532.
convert: Postscript delegate failed `test.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/664.
convert: missing an image filename `test.jpg' @ error/convert.c/ConvertImageCommand/3016.
What am I doing wrong?

If I install the package version that is shipped with ubuntu (old version, 6.6.2.6-1),
everything works fine!!!

User avatar
fmw42
Posts: 25654
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PDF to JPG: Strange problem!! Please help

Post by fmw42 » 2011-09-28T17:30:35-07:00

I am no expert on this, but it appears that IM did not find your new version of Ghostscript. So look at the config.log for Ghostscript and for IM and see if it shows any errors or clues?

Did you install IM after installing GS?

Did they get installed in the same directory structure (not one in /usr/bin and the other in /usr/local/bin? Look for differences of that nature.

vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Re: Convert PDF to JPG: Strange problem!! Please help

Post by vielhuber » 2011-09-29T02:07:45-07:00

Code: Select all

convert -list configure
shows:
DELEGATES fontconfig freetype x11 zlib
There is no "gs" here. Seems that it has to do that I am on a 64-bit machine.

I installed IM after GS (both from source). Please help.

vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by vielhuber » 2011-09-29T03:11:51-07:00

I did again:

Code: Select all

./configure --with-gslib
Here is an excerpt of the output:

Code: Select all

FontConfig        --with-fontconfig=yes         yes
FreeType          --with-freetype=yes           yes
GhostPCL          None                          pcl6 (unknown)
GhostXPS          None                          gxps (unknown)
Ghostscript       None                          gs (9.04)
Ghostscript fonts --with-gs-font-dir=default    /usr/share/fonts/type1/gsfonts/
Ghostscript lib   --with-gslib=yes              no
Graphviz          --with-gvc=yes                no
JBIG              --with-jbig=yes               no
JPEG v1           --with-jpeg=yes               no
JPEG-2000         --with-jp2=yes                no
LCMS v1           --with-lcms=yes               no
Why is there "no" at "option" at Ghostscript? Please help.

vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by vielhuber » 2011-09-29T12:55:18-07:00

I'm ready to further investigate in this problem.

You can reproduce the problem by simply doing the following steps:

Download and set up the latest Ubuntu Server Edition 11.04 64-bit


First, we test the normal environment:

Code: Select all

apt-get install ghostscript

Code: Select all

apt-get install imagemagick

Code: Select all

convert test.pdf test.jpg
conversion works like a charm.

Now get the newest IM and build from source:
Download and unpack the newest unix imagemagick version in /usr/local/imagemagick/ImageMagick-6.7.2-9

Code: Select all

./configure

Code: Select all

make

Code: Select all

make install

Code: Select all

ldconfig /usr/local/lib
reboot

Code: Select all

identify -version
says
6.7.2-9.

The problem is:

Code: Select all

convert test.pdf test.jpg

Code: Select all

convert: no decode delegate for this image format `/tmp/magick-mg0UeINT-00000001' @ error/constitute.c/ReadImage/532.
convert: Postscript delegate failed `test.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/664.
convert: missing an image filename `test.jpg' @ error/convert.c/ConvertImageCommand/3016.
Sorry, but this issue is NOT related to my machine.
This happens and everybody can reproduce it.

Somebody from the development team, please help!
Does IM not have a 64-bit support?!?

User avatar
magick
Site Admin
Posts: 11070
Joined: 2003-05-31T11:32:55-07:00

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by magick » 2011-09-29T17:10:28-07:00

Try
  • apt-get install imagemagick-devel
Now run the configure command line and build. ImageMagick requires the delegate library development headers before it can validate a particular delegate library (e.g. ghostscript).

vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by vielhuber » 2011-09-29T23:53:41-07:00

I tried it under ubuntu 10.10 and ubuntu 11.04:

Code: Select all

apt-get install imagemagick-devel
There is no such a package called "imagemagick-devel".

I only have got three packages atm which I can install:

- imagemagick
- imagemagick-dbg
- imagemagick-doc

Do i have to extend my sources.list?

User avatar
magick
Site Admin
Posts: 11070
Joined: 2003-05-31T11:32:55-07:00

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by magick » 2011-09-30T06:21:48-07:00

Guess that only works for CentOS / Redhat / Fedora. ImageMagick validates all its delegate libraries and programs. To do so it looks for the delegate header files. For Ghostscript, it looks for the header file, ghostscript/iapi.h. If that's not installed on your system, the Ghostscript library is not validated and ImageMagick instead will look for the 'gs' program in your execution path. After you run the configure command line, check config.log to determine exactly why the Ghostscript delegate library failed to validate. Fix the problem and rerun the configure script until Ghostscript validates. Now install ImageMagick and it will utilize the Ghostscript delegate library to interpret Postscript and PDF.

vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by vielhuber » 2011-09-30T09:30:52-07:00

Code: Select all

configure:34095: result: -------------------------------------------------------------
configure:34097: checking for Ghostscript
configure:34099: result: 
configure:34101: checking for Ghostscript version
configure:34108: result: 9.04
configure:34112: checking for gs alpha device
configure:34119: result: pngalpha
configure:34123: checking for gs color device
configure:34130: result: pnmraw
configure:34134: checking for gs CMYK device
configure:34141: result: pam
configure:34145: checking for gs mono device
configure:34152: result: pbmraw
configure:34156: checking for gs PDF writing device
configure:34163: result: pdfwrite
configure:34167: checking for gs PS writing device
configure:34174: result: pswrite
configure:34178: checking for gs EPS writing device
configure:34185: result: epswrite
configure:34643: result: -------------------------------------------------------------
Sorry, it seems that there is everything OK.
Can you help me please furthermore?

How do I install the delegates in ubuntu 64-bit?

Here is my full config.log to examine:
http://vielhuber.de/files/config.log

User avatar
magick
Site Admin
Posts: 11070
Joined: 2003-05-31T11:32:55-07:00

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by magick » 2011-09-30T10:50:46-07:00

Your log shows you have the Ghostscript program installed. ImageMagick reverts to using the Ghostscript program if the Ghostscript delegate library and its headers are not installed. The only difference between using the program rather than the library is just a few tens of a second in start-up time (starting a command line program is generally slower than making direct API calls to the library).

vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by vielhuber » 2011-09-30T11:30:01-07:00

Yes it works now!

I installed, as the user "magick" said, the libraries with

Code: Select all

apt-get install ghostscript imagemagick libmagick9-dev libmagickcore-dev libmagickwand-dev
under ubuntu 64-bit and then made
./configure
make
make install

Now I can convert PDFs to JPGs with the newest IM environment.

Unfortunately this is nowhere documentated. Why? Please document it for further users,
this is a standard problem for every ubuntu user.

Thank you for this awesome support and keep the good up work!
It's "Magick"!

vielhuber
Posts: 23
Joined: 2010-09-05T15:40:14-07:00
Authentication code: 8675308

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by vielhuber » 2011-09-30T11:45:33-07:00

Now let's get back to the original problem:

I now use the newest IM environment (and ghostscript).

Code: Select all

gs -v
GPL Ghostscript 9.04 (2011-08-05)
Copyright (C) 2011 Artifex Software, Inc. All rights reserved.

Code: Select all

identify -version
Version: ImageMagick 6.7.2-9 2011-09-30 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
Now a funny problem arises: The FIRST picture now is very good, the second picture now is crapped up.
What the hell is going on here? (I tried this on several machines).

http://vielhuber.de/files/test1.pdf

Code: Select all

convert -colorspace RGB -interlace none -density 104.6x104.6 -quality 100 -bordercolor white test1.pdf test1.jpg
Image

and

http://vielhuber.de/files/test2.pdf

Code: Select all

convert -colorspace RGB -interlace none -density 104.6x104.6 -quality 100 -bordercolor white test2.pdf test2.jpg
Image

Can somebody try it?
Thank you very much.

User avatar
fmw42
Posts: 25654
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PDF to JPG: 64-Bit Postscript delegate. Please h

Post by fmw42 » 2011-09-30T11:58:23-07:00

I ran this command in the proper IM 6 syntax order and it works perfectly fine every time I try it. IM 6.7.2.9 Q16 Mac OSX Tiger, GS 9.04


convert -colorspace RGB -density 104.6x104.6 test1.pdf -interlace none -quality 100 test1.jpg

Image

Post Reply