Convert PDF with font-size changes with density

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
akulabi
Posts: 3
Joined: 2011-04-18T01:10:05-07:00
Authentication code: 8675308

Convert PDF with font-size changes with density

Post by akulabi »

Hi everyone,

I try to convert single pdf file with several traditional chinese fonts to image (png,jpg) with convert command.

Sample file: test.pdf

Code: Select all

convert -density 300 test.pdf test.png
Some output characters has smaller font size than original document, as shown in the thumbnail images below:
Density 100
Density 300
Density 500
Density 700

I try to increase the density parameter and the characters grow larger. They grow to normal size when density reach 700.
However, as density increases, the conversion time becomes lengthy (> 3 sec per page).

I am using ImageMagick 6.6.5 Q 16 on windows 7 (and windows XP), using convert command on command prompt.

Anyone has idea to convert correctly, or shorten the conversion time? Thanks!

Dennis
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert PDF with font-size changes with density

Post by anthony »

First a lot of fonts only work at specific densities, As such the character sizes may suddeny jump. That depends on the font and the font designer.

Second as the density increases the number of pixels increase. This is a squared ratio. Double the density and you have 4 times the number of pixels. Also it means more I/O and eventually memory limits will cause disk caching to slow it down even more.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
akulabi
Posts: 3
Joined: 2011-04-18T01:10:05-07:00
Authentication code: 8675308

Re: Convert PDF with font-size changes with density

Post by akulabi »

Thanks for the clear response.

Is there any method to shorten the time of pdf conversion if the density is required to be 700?
e.g. resize, compress before conversion, use gs directly

Thanks,
Dennis
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert PDF with font-size changes with density

Post by anthony »

Better method to reduce time is to do the gs conversion yourself, and pipe the results into IM "convert" to convert it to the final image format (with whatever other image modifications needed.

IM does a lot of double handling for GS, due to security requirements, :-( that is best avoided if possible.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
akulabi
Posts: 3
Joined: 2011-04-18T01:10:05-07:00
Authentication code: 8675308

Re: Convert PDF with font-size changes with density

Post by akulabi »

It is clear. Thanks a lot =)
Post Reply