I'm having problems converting some PDFs to JPG that apparently have transparency in them, which causes some of the colors to reverse. Elsewhere, I'd been told to try
-flatten , -alpha flatten or -alpha remove. This takes care of the reversing problem.
Unfortunately, in at least one case, it's also starts washing out my images, such that even black type becomes gray. Any ideas? Here's the last line I was using:
/home/mstucka/bin/convert a.pdf -alpha remove -gravity center -background white -resize x403 -extent 202x403 a.jpg
A straight conversion without resizing still causes the washing out. Some images process perfectly and can be composited with the faulty ones, e.g.:
Any ideas on what to try?
PDF with transparency gets reversed or washed out
Re: PDF with transparency gets reversed or washed out
I tried kicking this around in ImageMagick more, then saw where ImageMagick and Ghostscript really have different abilities. So a Ghostscript fix worked, e.g., pdf2ps, then using IM's convert to convert into JPG with the resizing and padding I've wanted. Apparently PostScript has no support for transparency, so Ghostscript's conversion to PostScript strips off the transparency:
Total command line to take three PDFs, convert, and stick into two pairs:
Total command line to take three PDFs, convert, and stick into two pairs:
Code: Select all
/home/mstucka/bin/pdf2ps a.pdf a.ps
/home/mstucka/bin/pdf2ps b.pdf b.ps
/home/mstucka/bin/pdf2ps c.pdf c.ps
/home/mstucka/bin/convert a.ps -alpha remove -gravity center -background white -resize x403 -extent 202x403 a.jpg
/home/mstucka/bin/convert b.ps -alpha remove -gravity center -background white -resize x403 -extent 201x403 b.jpg
/home/mstucka/bin/convert c.ps -alpha remove -gravity center -background white -resize x403 -extent 201x403 c.jpg
/home/mstucka/bin/convert a.jpg b.jpg +append ab.jpg
/home/mstucka/bin/convert a.jpg c.jpg +append ac.jpg
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: PDF with transparency gets reversed or washed out
Can you supply a sample PDF that gives the problem?
snibgo's IM pages: im.snibgo.com
Re: PDF with transparency gets reversed or washed out
Thanks for taking an interest! I think this'll let you at the original file -- download with control-S, supposedly:
https://docs.google.com/file/d/0ByagJWt ... sp=sharing
https://docs.google.com/file/d/0ByagJWt ... sp=sharing
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: PDF with transparency gets reversed or washed out
The image has dark text on a transparent background.
Using IM v6.8.6-0 on Windows 7, a simple conversion ...
... gives me a result with visually the same colours and tones as Adobe Reader X v10.1.7. I can't see any difference.
The above command leaves the transparent areas transparent. To turn them white:
Using IM v6.8.6-0 on Windows 7, a simple conversion ...
Code: Select all
convert 0726.pdf p.png
The above command leaves the transparent areas transparent. To turn them white:
Code: Select all
convert 0726.pdf -background White -alpha Remove p.png
snibgo's IM pages: im.snibgo.com