|
html2jpg
|
|
What is it?
Converts HTML pages to images (gif, jpg, png, ps, etc..)
html2jpg requires Mozilla (only some versions) to work. It's
pretty kludgy. I needed a solution and couldn't find one, so
maybe this is useful to you. If you have KDE, I recommend
khtml2png
Features:
- Easy to automate.
- Attempts to remove borders, menus, scrollbars, etc..
- Supports many image types (even postscript!)
- Very kludgy and unlikely to work!
|
|
Requires:
- Perl, which kicks ass
- convert from ImageMagick
- xwininfo, xwd [standard unix utilities]
- mozilla
(or else modify find_window() for your browser)
Kludges:
From the usage:
- We don't know when the page is finished loading
- Rule of thumb for finding subwindow is guesswork!
If you're getting the wrong window, comment out call to subwindow()
- Browser geometry ignored if browser doesn't create a new window
(Such as opera in "mdi" mode)
- Dependent on xwd command and output of xwininfo and ...
- Browser can't be iconified or partially off-screen
- Only gets portion of html displayed in browser
- Requires mozilla browser - update find_window() for other browsers
- Opens up a bunch o' windows in your browser and leaves them there
- Might not even pick the right window... (the opera version is
better about this, but it is more version dependent)
License:
This software is essentially free, but please read my
payment spiel
Please read the
full license
Download:
It's a single perl script.
I also had it working with an older version of opera, but that's
not up to date: html2jpg.opera
Documentation?
See the usage for command-line options.
html2jpg supports all the image types that convert supports.
This also means you can specify the type for stdout with a file like: -o gif:-
If the script is renamed (or linked to) as "html2<type>" - then the default
image type will be <type>.
(Example: html2png, html2gif, html2jpg, html2ps, ...)
The script does the following:
- Loads your url in a browser (with -remote, and all the bugs that has..)
- Sleeps for a few seconds (because we don't know when the page is loaded!)
- Tries to find the browser window in the Xwindow tree
- Tries to find the proper subwindow (so we can ignore menus, window frames, scroll bars..)
- Takes a window dump and converts it to the appropriate image type.
This relies on a bunch of unix utilities working just the way they do on my system.
Caveat Emptor. :)
Install
It's just a perl script. No install required.
Revision History:
See the CHANGELOG
Freshmeat?
You bet.