Paid: Fix issue converting PDF to JPG

Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.
Post Reply
alex123456
Posts: 5
Joined: 2019-09-20T08:39:58-07:00
Authentication code: 1152

Paid: Fix issue converting PDF to JPG

Post by alex123456 » 2019-09-20T08:56:13-07:00

I have a PDF file that has a logo in it. The logo looks normal when viewed in a PDF viewer. Here is a portion of the logo: Image.

I need to convert the PDF to a png (or jpg) file. I do this using the following command:
/usr/bin/convert -colorspace sRGB -antialias -alpha off -opaque "#e3e3e3" -density 150 -background white -verbose inputPDF.pdf output.png

The output file has a set of weird lines in the logo portion. See the output here:
Image.

This is running on CentOS7.
ImageMagick verison 6.7.8.9 displays this issue.
I upgrade to ImageMagick 7.0.8 and this issue persists

I'll pay to get this issue resolved (email money transfer). Please email me at mootsalex@gmail.com with the subject:
ImageMagick Convert Consulting
I can send you the original PDF file so that you can test and figure this out.

Thanks
Alex.

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

Re: Paid: Fix issue converting PDF to JPG

Post by fmw42 » 2019-09-20T09:04:24-07:00

Post the PDF file here so we can test it. I suspect it is the version of Ghostscript you are using. Find the version and post here or upgrade to 9.23, 9.24, or 9.25. I have heard of issues with 9.26 and 9.27.

Your syntax is not correct. -antialias will have no effect. -opaque only works if you set a -fill prior to it. Some of your settings and operators need to be after reading the PDF. So try

Code: Select all

convert -colorspace sRGB -density 150 -verbose inputPDF.pdf -background white -alpha background -alpha off output.png
If you want the background to be white where it might have been transparent. If you want the background to be "#e3e3e3", then use that in place of white in my -background command.

alex123456
Posts: 5
Joined: 2019-09-20T08:39:58-07:00
Authentication code: 1152

Re: Paid: Fix issue converting PDF to JPG

Post by alex123456 » 2019-09-23T08:58:28-07:00

I tried running the convert using your suggested settings but I get the same result.

Any other suggestions?
Thanks!

alex123456
Posts: 5
Joined: 2019-09-20T08:39:58-07:00
Authentication code: 1152

Re: Paid: Fix issue converting PDF to JPG

Post by alex123456 » 2019-09-23T09:01:14-07:00

Just for reference, here is the output of the convert command. I don't see anything out of the ordinary. This is a multi-page PDF file.

Code: Select all

/tmp/magick-1874ITFPwiF7Q0061 PNG 1275x2100 1275x2100+0+0 8-bit sRGB 331686B 0.150u 0:00.089
/tmp/magick-1874ITFPwiF7Q0062 PNG 1275x2100 1275x2100+0+0 8-bit sRGB 228197B 0.120u 0:00.080
/tmp/magick-1874ITFPwiF7Q0063 PNG 1275x2100 1275x2100+0+0 8-bit sRGB 136587B 0.120u 0:00.073
/tmp/magick-1874ITFPwiF7Q0064 PNG 1275x2100 1275x2100+0+0 8-bit sRGB 148571B 0.130u 0:00.076
/tmp/magick-1874ITFPwiF7Q0065 PNG 1275x2100 1275x2100+0+0 8-bit sRGB 143079B 0.130u 0:00.085
NG40-0003-A.pdf[0] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 331686B 0.500u 0:00.318
NG40-0003-A.pdf[1] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 228197B 0.380u 0:00.237
NG40-0003-A.pdf[2] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 136587B 0.260u 0:00.163
NG40-0003-A.pdf[3] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 148571B 0.130u 0:00.086
NG40-0003-A.pdf[4] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 143079B 0.000u 0:00.000
[ghostscript library 9.07] -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r150x150'  '-sOutputFile=/tmp/magick-1874ITFPwiF7Q006%d' '-f/tmp/magick-1874xlmWPFkp2P8I' '-f/tmp/magick-1874XRqLZtp4bKgl'writing raw profile: type=xmp, length=3338
NG40-0003-A.pdf=>output.png[0] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 331686B 0.780u 0:00.300
writing raw profile: type=xmp, length=3338
NG40-0003-A.pdf=>output.png[1] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 228197B 1.130u 0:00.534
writing raw profile: type=xmp, length=3338
NG40-0003-A.pdf=>output.png[2] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 136587B 1.520u 0:00.737
writing raw profile: type=xmp, length=3338
NG40-0003-A.pdf=>output.png[3] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 148571B 1.860u 0:00.909
writing raw profile: type=xmp, length=3338
NG40-0003-A.pdf=>output.png[4] PDF 1275x2100 1275x2100+0+0 16-bit sRGB 143079B 2.190u 0:01.088


alex123456
Posts: 5
Joined: 2019-09-20T08:39:58-07:00
Authentication code: 1152

Re: Paid: Fix issue converting PDF to JPG

Post by alex123456 » 2019-09-23T09:01:37-07:00

Here is the version info:

Code: Select all

[alex@alex PDFToPNG]$ convert -version
Version: ImageMagick 7.0.8-65 Q16 x86_64 2019-09-15 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(3.1) 
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib


snibgo
Posts: 12289
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Paid: Fix issue converting PDF to JPG

Post by snibgo » 2019-09-23T09:09:47-07:00

But what version of Ghostscript? See Fred's advice above.
snibgo's IM pages: im.snibgo.com

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

Re: Paid: Fix issue converting PDF to JPG

Post by fmw42 » 2019-09-23T10:05:16-07:00

Post the PDF file here so we can test it. I suspect it is the version of Ghostscript you are using. Find the version and post here or upgrade to 9.23, 9.24, or 9.25. I have heard of issues with 9.26 and 9.27.

alex123456
Posts: 5
Joined: 2019-09-20T08:39:58-07:00
Authentication code: 1152

Re: Paid: Fix issue converting PDF to JPG

Post by alex123456 » 2019-09-23T12:37:11-07:00

Thanks for your help. Upgrading to the latest version of ghostscript resolves this problem. On my Centos7 machine this means upgrading to 9.25.
Thanks for your help.
I'd be happy to email (interac) transfer some money to you for your help with this. Send me an email to mootsalex@gmail.com.

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

Re: Paid: Fix issue converting PDF to JPG

Post by fmw42 » 2019-09-23T15:08:05-07:00

alex123456 wrote:
2019-09-23T12:37:11-07:00
Thanks for your help. Upgrading to the latest version of ghostscript resolves this problem. On my Centos7 machine this means upgrading to 9.25.
Thanks for your help.
I'd be happy to email (interac) transfer some money to you for your help with this. Send me an email to mootsalex@gmail.com.
No need. But thanks.

Post Reply