| Presenting... | Afghan Hound in Hypertext - a total waste of bandwidth production. |
Afghan Hound's marvellous Image to HTML converter. |
| Games | Quake | Wibble | Computers | Home I | Home II |
Converts an image file into a HTML table, with each cell containing a transparent gif (so they stay square) and each cell's background colour set to the corresponding image pixel colour. Optionally scales the image, uses different sized cells and can output a full HTML page. Also generates alt tags so that some text based browsers (eg links but not, alas, lynx) will display the image in ascii art.
Is it not nifty?
Suitable for destruct testing browsers, annoying people, and, erm, *shrug*
Grab the download (32k). Unzip and untar.
You'll need the two modules included in the tarball (since they're only small), as well as having the program 'convert' from ImageMagick http://www.wizards.dupont.com/cristy/ImageMagick.html in your $PATH.
Next, adjust the line: $rgbfile = "/usr/X11/lib/X11/rgb.txt"; in img2html to point to the rgb.txt file on your system. If you haven't got one, put the included rgb.txt somewhere (/usr/lib, perhaps?) and adjust the line appropriatly.
Adjust the line: $xpmname = "/tmp/img2html.temp.xpm"; to an appropriate temporary file name, if the default isn't suitable.
Put the file t.gif somewhere your webserver/browser will be able to find it. The file name is delibratly short so that it won't use as much bandwidth transfering the filename.
Move img2html onto your path, and you're off.
Quickly: img2html -i input.(gif|jpg|etc) -o output.html
In full: img2html supports the following flags:
| -i filename | The input image file. Can be in any format supported by 'convert', except animations. |
| -o filename | The output filename. Note that .html is *not* added, specify it if you need it. |
| -s number | Size. The input image is scaled so that it's largest dimension is equal to 'number'. Default = 70. (Maximum=999, but most browsers seem to keel over around 200.) |
| -g filename | Filename and path to the transparent gif file. Note that this should be the path as the browser/server sees it. Default="./t.gif" |
| -r number | Resolution, the size of the table cells. Default = 1. |
| -p | Page mode. Emits <html>,<head><body> etc tags, otherwise just outputs the table. (<title> in this case is the basename of the image file.) |
| -q | Quiet. No progress reports. |
| -c | Centre the image. Puts a <center> </center> combination round the table. |
| -w | Waste bandwidth. Each pixel is dumped as a separate table cell, without the option, img2html tries to conserve bandwidth by amalgamating adjacent cells with the same colour. (Using the 'colspan' attribute to <td>) Note that this flag improves the look of the ascii version. ( - depending on image type.) |
| -v | Version info |
| -h | Help |
Written by Afghan Hound. Mail img2html@afghanhound.org.uk if you want.
Copyright (C) 2000 Afghan Hound Software
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***Afghan Hound Software***
M" " " " " " " " "o"
oo " " "o
"o" " " " " " " M
o" " " " " " " " " " " " "
oo" " " "o" " " "o" "oo
o" " " "o" " " " " " " "o o
o " " o" o" " " oM " " "oMo
M" " "oMoMo "o" " " " " "oM o"o"
o" oMo"oMo"o"oMoMoM " " "o" "oM
o" "oMo" "oMo"MMoMMMo"o"o"o"o" "o"
Mo" oMoMo"oM"oo""" "oMo"o"o"o"o oM
M "oMoM" " Mo oM Mo"o"o"o"o"o""
Mo"oMo" "" Mo"o"oMoMo"oM
Mo"oMo" "" Mo"o"oMoMo"oM
MoM o"o"oMMMo"o"
o "" o"o" ""Mo"oM
oM o"o"oMM"o"o"
MM oooMM" o o"o"o"MMo"o"
"M ooo""" MM "o"o"o"o"o"M
"Mo oooMMM M "o" "o"o"o"o
""MMMMoMoM " "o"o"o"o"o
MMMMM" "oM "MMo"o"o
oMMM" MoMoMoMoMoM"
" "
***Delivering pointless software since 1999***
|
Also by this author: If you've enjoyed this
page, you're probably insane. Why not try one of these as well?
| ||
| Comments? Links About | Last modified 03:34 pm, 29/04/03 |