Page 1 of 1

PDF to TIF produces all or mostly black pages

Posted: 2014-07-01T09:52:01-07:00
by pmcgrath90
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

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-01T10:10:51-07:00
by fmw42
this works fine for me on IM 6.8.9.5 Q16 Mac OSX

Code: Select all

convert -density 300 test1.pdf -alpha off -monochrome -compress group4 test1.tif
Perhaps you need to upgrade your Ghostscript and/or libtiff

See

convert -list format

for your current versions

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-01T10:34:54-07:00
by pmcgrath90
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.

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-01T14:59:02-07:00
by fmw42
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""/>

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-02T05:46:04-07:00
by pmcgrath90
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.

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-02T09:42:54-07:00
by fmw42
Sorry. I am out of ideas. Perhaps some other Windows user can test this. On my Mac it works fine.

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-02T11:03:53-07:00
by snibgo

Code: Select all

convert -density 300 test11.pdf -alpha off -monochrome -compress Group4 o.tif
Works fine for me, with or without "-alpha off", IM 6.8.9-0 Q16 on Windows 8.1, Ghostscript 9.10.

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-02T11:15:15-07:00
by fmw42
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsvg tiff webp xml zlib
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.

GS is needed to properly read PDF files.

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-03T08:54:19-07:00
by pmcgrath90
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?

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-03T09:07:05-07:00
by pmcgrath90
Further Testing:

Uninstalled GS 9.14, installed GS 9.10. Ran convert. WORKED! :D

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.

Re: PDF to TIF produces all or mostly black pages

Posted: 2014-07-03T10:26:38-07:00
by fmw42
@fnw42 I'm a little confused by your post. Where did you find that Delegates list?
On my system it is installed at /usr/local/etc/ImageMagick-6/delegates.xml

However, the original file is included in the source code downloads folder in folder config.