Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Yes, convert has an -antialias switch, but not GhostScript — at least not the jpeg driver (there's an x11alpha screen driver, but I think that's the only one which does anti-aliasing by itself).  And ImageMagick (i.e. convert) cannot render PDF/PS itself; it uses GhostScript for that under the hood, anyway...

Personally, I prefer to use both tools separately, because then I have fine control over the parameters used during conversion, and so far, I've always achieved better results (in less time) than when trying to convince convert alone to do what I want.

For example, the naive approach (which I figure should be comparable to the conversions I posted above) when using convert directly would be something like this:

$ convert input.pdf -density 150 -geometry 1240x1754 -antialias -quali +ty 90 img%d.jpg

But the results are much worse than when doing the steps separately... (example: test1.jpg, test2.jpg — where test1.jpg has been produced by using gs and convert separately, and test2.jpg when calling gs indirectly via convert (the command right above)).

As I read the docs, -density is supposed to set the resolution ("set resolution of an image for rendering to devices"), however, for some reason this doesn't seem to be passed on to Ghostscript (as can be revealed using strace)...  In case you have the patience to figure out the correct incantation of options for convert that achieves the quality of test1.jpg, please let me know (input PDF here) — IMHO, there's too much Magick going on :)


In reply to Re^3: Convert PDF to HTML (or JPEG) by almut
in thread Convert PDF to HTML (or JPEG) by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found