kaeli said:
That's very odd. A hex image generated by script.
There are not that many browsers that understand this application of the
javascript pseudo protocol:. The image string used is a string
representation of the contents of an image file. XBM images were the
only format that could be used in Netscape < 4.04 because its string
representation was null terminated so image files containing binary, and
so including bytes with zero values, would prematurely terminate the
string definitions (XBM files are ASCII text anyway). These days that
problem is gone (though I wonder about the implications of Unicode in
this context) so in theory other image formats can be used (I have never
tried).
XBM is a two color format so it is very limited. And some browsers do
not know how to interpret it anyway (even assuming they understand the
javascript: SRC).
And of course useless to people without javascript.
And if it were a large image, probably very bad on
slow computers, but I dunno.
It is 40+ bits to the byte storage, with no compression at all. That was
never going to be quick or efficient.
Has anyone done this with a real, viewable image?
It is a means by with a script generated image can be displayed so it
has been used, as the display end or javascript games for one. With XBM
being balck and white, and alternative image file formats requiring
compression (making it too time consuming to go form a script generated
bitmap to a string containing the image data) you won't see this used
often (I don't think I have ever seen it used outside of a javascript
game).
It's hard to play with a blank 1 pixel image.
If you would like to play with some XBM images that you can see try
these two:-
var crossImg = "#define cross_width 32\n"+
"#define cross_height 32\n"+
"static char cross_bits[] = {"+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0xe0, 0x0f, 0x00, "+
"0x00, 0x18, 0x31, 0x00, "+
"0x00, 0x04, 0x41, 0x00, "+
"0x00, 0x02, 0x81, 0x00, "+
"0x00, 0x01, 0x01, 0x01, "+
"0x80, 0x00, 0x01, 0x02, "+
"0x80, 0x00, 0x01, 0x02, "+
"0x40, 0x00, 0x01, 0x04, "+
"0x40, 0x00, 0x01, 0x04, "+
"0x40, 0x00, 0x01, 0x04, "+
"0xff, 0xff, 0xff, 0xff, "+
"0x40, 0x00, 0x01, 0x04, "+
"0x40, 0x00, 0x01, 0x04, "+
"0x40, 0x00, 0x01, 0x04, "+
"0x80, 0x00, 0x01, 0x02, "+
"0x80, 0x00, 0x01, 0x02, "+
"0x00, 0x01, 0x01, 0x01, "+
"0x00, 0x02, 0x81, 0x00, "+
"0x00, 0x04, 0x41, 0x00, "+
"0x00, 0x18, 0x31, 0x00, "+
"0x00, 0xe0, 0x0f, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00, "+
"0x00, 0x00, 0x01, 0x00 "+
"};"
var trash = "#define trash_width 16\n"+
"#define trash_height 16\n"+
"static char trash_bits[] = {"+
"0x00, 0x01, 0xe0, 0x0f, "+
"0x10, 0x10, 0xf8, 0x3f, "+
"0x10, 0x10, 0x50, 0x15, "+
"0x50, 0x15, 0x50, 0x15, "+
"0x50, 0x15, 0x50, 0x15, "+
"0x50, 0x15, 0x50, 0x15, "+
"0x50, 0x15, 0x10, 0x10, "+
"0xe0, 0x0f, 0x00, 0x00 "+
"};";
Note that low bits in the hex numbers are to the left of the byte when
displayed as pixels, but byte order is correct: left to right, top to
bottom).
Of course, screen caps work no matter what, but
the quality isn't always that great.
As a notion of preventing the saving of images this script generated XBM
idea ranks alongside all George Hester's other ideas; best dismissed out
of hand.
Richard.