http://www.perlmonks.org?node_id=795214


in reply to Re^3: Convert PDF to HTML (or JPEG)
in thread Convert PDF to HTML (or JPEG)

Hi Almut,

Now I had the time to check my old computer for these 8 year old bash scripts I used :)

And ... well ... it's really strange, but I'm not experiencing your problems!

test.pdf.00.jpg

test.pdf.00.png

that's the script I used:

cd /home/lanx/tmp; SOURCE="test.pdf"; ILTYPE="plane" ; GEOMETRY="1240x1754"; QUALITY=90; DENSITY="150x150"; for OUT in "jpg" "png"; do echo $OUT; DEST="$SOURCE.%02d.$OUT"; convert +adjoin -interlace $ILTYPE -geometry $GEOMETRY \ -density $DENSITY -quality $QUALITY $SOURCE $DEST done

Maybe some other installations like latex2html or GraphicsMagick are altering the behavior of convert on my box?

Cheers Rolf

PS: Große Vallüla ??? xD (SCNR)

UPDATE: just noticed I didn't even use the -antialias switch ...

Replies are listed 'Best First'.
Re^5: Convert PDF to HTML (or JPEG)
by almut (Canon) on Sep 14, 2009 at 23:29 UTC

    Thanks, that's already a lot better (placing the -density option before the source file name seems to have caused the major improvement).

    Yet, I'm not really convinced of the quality that can be achieved that way. Maybe I'm little picky in these things, but I still feel the text looks a bit ragged, and the graphics don't seem to be anti-aliased at all (I also tried putting -antialias in various places — couldn't see a difference, though).  In other words, I can't help thinking that the results of running gs separately somehow look better (the version on the right in the side-by-side comparison (300%-zoom, cropped)) — at least smoother.  Anyhow, I guess I'll stick with my technique for the time being.

    ___

    PS: Große Vallüla ??? xD

    Yeah well, that was the first adequate PDF file I found in my temp directory.  Rest assured, I have no affiliation with Maria & Margot, or that kind of music, whatsoever ;) — I just like hiking in the mountains.

      Right, I remember reading somewhere that with convert switches order counts ...

      UPDATE< convert can process several files at a time, and the switches have to be before the corresponding filename! >

      > Yet, I'm not really convinced of the quality that can be achieved that way.

      UPDATE< Did you try a higher density yet? 300 works fine for me and filesize even drops!>

      Actually I switched 7 years ago to pstoimg from the latex2html distribution producing very neat png's.

      (but it's -as I noticed today - just a perl wrapper around gs ;)

      Anyway pstoimg has two switches for antialiasing : -antialias and -aaliastext so I suppose thats the point where convert may loose the necessary information...

      Cheers Rolf