Doug Stewart on 22 Nov 2015 10:56:07 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Solved: Need to Convert HTML Page to jpg Image

We've used PhantomJS for just this sort of an application in the past:

On Nov 22, 2015, at 12:52 PM, Casey Bralla <> wrote:

Well, as usual, another 15 minutes of searching found a solution.    

If "html2ps" is installed, imagemagick's "convert" can do this easily.

Convert page.html page.jpg


On Sunday, November 22, 2015 12:29:20 PM Casey Bralla wrote:
Good questions, Steve.

I want a simple screen-shot of the first page.  I'll shrink this down to
about 20% of full size and display it next to a pull-down list of uploaded
pages. This way the user will have both a saved name, and simple visual
image of the page they uploaded.

The user won't have to actually read the details of the page;  he'll just be
able to recognize it so he can remember what is on it.

On Sunday, November 22, 2015 12:13:03 PM Steve Litt wrote:
On Sun, 22 Nov 2015 11:58:33 -0500

Casey Bralla <> wrote:
I'm writing a web application where users will upload an HTML page
which will be shown on another page.   I want to allow the user to
see a miniature image of the HTML file they uploaded.

Anybody know how to convert an HTML page into a jpg or png file?
I've seen online tools to do this, but I need to have my application
automatically convert them on the fly (ie: I need a cli program to
convert HTML into a png or jpg.)

I think you need to define your requirements more tightly. Do you want
the .png to include every single word of a 500K word web page? A sort
of 8.5" x 3000" .png? Or do you want the .png to be what the viewer sees
in the browser after the HTML file has been loaded but before any
scrolling or navigation has taken place? Do you need just the raw text,
or do you need the appearance and fonts too? Do you want the containing
browser to be part of the image (a screenshot, in other words)?


Steve Litt
November 2015 featured book: Troubleshooting Techniques

    of the Successful Technologist
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --


Casey Bralla

Chief Nerd in Residence
The NerdWorld Organisation
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --