PDF to TIF produces all or mostly black pages
-
- Posts: 5
- Joined: 2014-07-01T09:24:26-07:00
- Authentication code: 6789
PDF to TIF produces all or mostly black pages
Using convert.exe to produce .tif files from PDF's. The PDFs come from vendors as email attachments so I have no control over creation. 95% of the time everything works fine. From certain vendors I get PDFs that, when converted, are all black or mostly black. Here is the command:
convert.exe -density 300 <input.pdf> -monochrome -compress Group4 <output.tif>
I have played around with setting -alpha off, -flatten, -background to none or white; no luck.
here is a link to the pdf if you want to test: http://1drv.ms/1pH8H1M
This PDF converts fine using GhostScript with: gswin64c -q -dNOPAUSE -dUseCropBox -sDEVICE=tiffg4 -r300 -sOutputFile=<outputfile.tif> <inputfile.pdf> -c quit
Other Info:
Running on Windows Server 2008. Testing on Windows 8.1
Version: ImageMagick 6.8.9-2 Q16 x64 2014-05-27 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsvg tiff webp xml zlib
Thanks,
Pat McGrath
GSWP
convert.exe -density 300 <input.pdf> -monochrome -compress Group4 <output.tif>
I have played around with setting -alpha off, -flatten, -background to none or white; no luck.
here is a link to the pdf if you want to test: http://1drv.ms/1pH8H1M
This PDF converts fine using GhostScript with: gswin64c -q -dNOPAUSE -dUseCropBox -sDEVICE=tiffg4 -r300 -sOutputFile=<outputfile.tif> <inputfile.pdf> -c quit
Other Info:
Running on Windows Server 2008. Testing on Windows 8.1
Version: ImageMagick 6.8.9-2 Q16 x64 2014-05-27 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsvg tiff webp xml zlib
Thanks,
Pat McGrath
GSWP
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PDF to TIF produces all or mostly black pages
this works fine for me on IM 6.8.9.5 Q16 Mac OSX
Perhaps you need to upgrade your Ghostscript and/or libtiff
See
convert -list format
for your current versions
Code: Select all
convert -density 300 test1.pdf -alpha off -monochrome -compress group4 test1.tif
See
convert -list format
for your current versions
-
- Posts: 5
- Joined: 2014-07-01T09:24:26-07:00
- Authentication code: 6789
Re: PDF to TIF produces all or mostly black pages
Thanks for the quick reply.
-alpha off does not seem to have any effect.
from the -list command:
TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.3)
TIFF64* TIFF rw- Tagged Image File Format (64-bit) (LIBTIFF, Version 4.0.3)
Not seeing GhostScirpt in the -list command
gs9.14 is installed on the pc.
-alpha off does not seem to have any effect.
from the -list command:
TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.3)
TIFF64* TIFF rw- Tagged Image File Format (64-bit) (LIBTIFF, Version 4.0.3)
Not seeing GhostScirpt in the -list command
gs9.14 is installed on the pc.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PDF to TIF produces all or mostly black pages
Your pdf image has transparency. That may be the issue
Check your delegates.xml file and be sure it is using -sDEVICE=pngalpha for ps:alpha rather than pnmraw
<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""/>
Check your delegates.xml file and be sure it is using -sDEVICE=pngalpha for ps:alpha rather than pnmraw
<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""/>
-
- Posts: 5
- Joined: 2014-07-01T09:24:26-07:00
- Authentication code: 6789
Re: PDF to TIF produces all or mostly black pages
Here is the line copied as is from my delegates.xml:
<delegate decode="ps:alpha" stealth="True" command=""@PSDelegate@" -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""/>
I have also updated to 6.8.9-5 Q16, and installed the Q8 version of ImageMagick. No joy with either. Same result, black pages.
I may try the x86 versions for fun and giggles.
<delegate decode="ps:alpha" stealth="True" command=""@PSDelegate@" -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""/>
I have also updated to 6.8.9-5 Q16, and installed the Q8 version of ImageMagick. No joy with either. Same result, black pages.
I may try the x86 versions for fun and giggles.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PDF to TIF produces all or mostly black pages
Sorry. I am out of ideas. Perhaps some other Windows user can test this. On my Mac it works fine.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: PDF to TIF produces all or mostly black pages
Code: Select all
convert -density 300 test11.pdf -alpha off -monochrome -compress Group4 o.tif
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PDF to TIF produces all or mostly black pages
I do not see gslib in this list. Are you sure IM can find Ghostscript? I do not know if it shows in the list on Windows, but it does show in the list for Linux/Mac OS.Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsvg tiff webp xml zlib
GS is needed to properly read PDF files.
-
- Posts: 5
- Joined: 2014-07-01T09:24:26-07:00
- Authentication code: 6789
Re: PDF to TIF produces all or mostly black pages
I uninstalled both GS and all version of IM from my test pc and started from scratch.
First installed just IM 6.8.9-5 Q16 x64. Ran the convert, it failed as expected not being able to find GS.
I then installed GS 9.14. Ran the convert. This time no error, but output is still black.
I'm installing GS 9.10 to give that a try.
@fnw42 I'm a little confused by your post. Where did you find that Delegates list?
First installed just IM 6.8.9-5 Q16 x64. Ran the convert, it failed as expected not being able to find GS.
I then installed GS 9.14. Ran the convert. This time no error, but output is still black.
I'm installing GS 9.10 to give that a try.
@fnw42 I'm a little confused by your post. Where did you find that Delegates list?
-
- Posts: 5
- Joined: 2014-07-01T09:24:26-07:00
- Authentication code: 6789
Re: PDF to TIF produces all or mostly black pages
Further Testing:
Uninstalled GS 9.14, installed GS 9.10. Ran convert. WORKED!
to verify; uninstalled GS 9.10, installed GS9.14. Ran convert. BLACK.
So it seems to be an issue with the interaction between IM and GS 9.14.
if I just run the file through GS 9.14 with
gswin64c -q -dNOPAUSE -dUseCropBox -sDEVICE=tiffg4 -r300 -sOutputFile=<outputfile.tif> <inputfile.pdf> -c quit
It works fine.
Uninstalled GS 9.14, installed GS 9.10. Ran convert. WORKED!

to verify; uninstalled GS 9.10, installed GS9.14. Ran convert. BLACK.

So it seems to be an issue with the interaction between IM and GS 9.14.
if I just run the file through GS 9.14 with
gswin64c -q -dNOPAUSE -dUseCropBox -sDEVICE=tiffg4 -r300 -sOutputFile=<outputfile.tif> <inputfile.pdf> -c quit
It works fine.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PDF to TIF produces all or mostly black pages
On my system it is installed at /usr/local/etc/ImageMagick-6/delegates.xml@fnw42 I'm a little confused by your post. Where did you find that Delegates list?
However, the original file is included in the source code downloads folder in folder config.