PDF to PNG Conversion dropped black text

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sunrise828

PDF to PNG Conversion dropped black text

Post by sunrise828 »

Hi,

I'm new to imagemagick and trying to support an old program that converted PDFs to PNGs. It was successful in a prior version of ImageMagick (6.2.5 I believe), but the PC that it ran on crashed and now has a corrupted C drive. So I ran a copy of the VB6 program on another pc with the most recent version of ImageMagick (6.6.2.4) and ghostscript (8.71). It created the PNGs, but there is black text missing. Would anyone know why? I've looked for a similar problem and aside of finding information about vector formats and how ImageMagic doesn't handle them well (but keep in mind the old version worked fine). Below is some of the VB6 code ...

filein = "F:\" & filenamin & "[" & ctpage & "]"
fileout = "F:\" & filenamout
msgs = img.Convert("-density", "300x300", filein, "-resize", "33%", "-unsharp", "0x.1+1.0+0.10", fileout)

I'm having trouble with many pages of the PDF, but the first page I have trouble with is one that has a lot of black text and black bar down the right side, with some text embedded in it and a page number at the bottom. In this scenario the only item that showed up on the page is the black bar down the right side of the page. There was no paragraph text, no page number and no wording in the Bar.

On a different page that has black, red and blue text (of the same size), all the black text is missing. The red and blue text is present. I thought about playing around with threshold or another option having to do with color, but I am not sure if that is the way to go.

Thank you for any help you could provide.

Dawn
sunrise828

Re: PDF to PNG Conversion dropped black text

Post by sunrise828 »

I dropped the "-unsharp", "0x.1+1.0+0.10" part of the convert and that made the black text reappear.

I do have another question though, my PNGs are much larger than they used to be. They are about 3 times as large as they used to be (and that was before I removed the "-unsharp" setting). For example, with the old ImageMagick, one file was 584 KB and now it's 1,566 KB. Is there a setting to change that?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to PNG Conversion dropped black text

Post by fmw42 »

try adding -depth 8 and see if that helps
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: PDF to PNG Conversion dropped black text

Post by Drarakel »

There are several possibilites for the missing elements.
First try to run a simple command (e.g. "convert file.pdf file.png") directly from the commandline - not as VB script. If that doesn't help, then you could try to run a Ghostscript command (without ImageMagick). Perhaps you can narrow down the problem that way.
If you keep having problems with the PDF, you could upload it somewhere, so that we can test it.
sunrise828

Re: PDF to PNG Conversion dropped black text

Post by sunrise828 »

Thanks Drarakel

I already removed the -unsharp option and that solved my missing elements problem.

fmw42, I'll give the -depth option a try. Thank you for the suggestion.

Dawn
Post Reply