pdf to png text thickness

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
TreborAlmasy
Posts: 3
Joined: 2014-06-11T18:57:49-07:00
Authentication code: 6789

pdf to png text thickness

Post by TreborAlmasy »

So after searching through google reading all the documentation and trying just about every combo of 'filter' and 'blur' and 'unsharpen' I'm out of ideas.
Essentially what I'm trying to do is get the imagemagick preview of a pdf to look like photoshop:
Photoshop:
Image

ImageMagick:
Image

All that was done in photoshop was a simple resize, with bilinear interpolation.

I read... somewhere... that photoshop applies a sharpening mask after a reduction in size, but that just seems to make things worse in imagemagick. I tried all the examples in the 'help section (http://www.imagemagick.org/Usage/filter ... downsample), but none really even came close to photoshop.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: pdf to png text thickness

Post by snibgo »

Have you played with "-density"? That's the most important option for getting quality from a pdf.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: pdf to png text thickness

Post by fmw42 »

As user snibgo suggested, try

Code: Select all

convert -density 288 image.pdf -resize 25% image.jpg
density 288 = 72*4 (four times nominal 72 dpi) so we are getting 4 times the quality from the pdf

So we resize by 1/4=25% to get back to nominal size. If the size is not quite correct, either adjust the density or the resize percent. Or just resize to whatever size you want.
TreborAlmasy
Posts: 3
Joined: 2014-06-11T18:57:49-07:00
Authentication code: 6789

Re: pdf to png text thickness

Post by TreborAlmasy »

I had the density set to 330, but it still wasn't working.
BUT when I moved the density to before the 'image.pdf' it worked like a charm.
Huzzah!
Thanks for the help guys.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: pdf to png text thickness

Post by fmw42 »

Vector files such as pdf, eps, etc have no size until you read them in. But you need to specify the density before reading them so the reader knows what value to apply. Raster images have a size and density is used afterwards simply to apply a setting in the file so that printers know how to translate pixels to physical dimensions such as inches or centimeters.
TreborAlmasy
Posts: 3
Joined: 2014-06-11T18:57:49-07:00
Authentication code: 6789

Re: pdf to png text thickness

Post by TreborAlmasy »

Ah, that actually makes sense.
Is that in the documentation anywhere? Because I searched for HOURS trying to figure out what was causing the issue with no luck (or examples) to go on.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: pdf to png text thickness

Post by snibgo »

http://www.imagemagick.org/script/comma ... hp#density says: "This option specifies the image resolution to store while encoding a raster image or the canvas resolution while rendering (reading) vector formats such as Postscript, PDF, WMF, and SVG into a raster image."

I think some words could be added to the effect that "-density" should be set before the read or write.


http://www.imagemagick.org/Usage/basics/#density says: "You can set the resolution or density of an image as it is being read into IM by using the "-density" function, before reading or writing the image, or using "-set density" after reading the image. "


A search in these forums should also have helped. When I read the list of questions and see one about PDF, I automatically think, "The answer is to use density."
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: pdf to png text thickness

Post by fmw42 »

Something about -density should be mentioned in http://www.imagemagick.org/Usage/formats/#ps, but it is now. But the link to http://www.imagemagick.org/Usage/text/#postscript does have some information about supersampling there.
Post Reply