Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Feb 122010
 

Convert HTML to image

Answer:

Firstly, you need to install html2ps

# sudo apt-get install html2ps

Then install the ImageMagick

# sudo apt-get install imagemagick

Finally run the command:

# convert -density 72 input.html output.png

  2 Responses to “Convert HTML to image”

  1. Does anyone know what to do if style tags don't seem to be included in the images? I even manually put in the styles instead of leaving the stylesheet links there, and it still didn't work. :/

    Thanks!

  2. @trilobite, for complicated HTML, probably you would need other methods such as integrate with QT, e.g.
    https://github.com/AdamN/python-webkit2png/

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>