OZONE Asylum
Forums
DHTML/Javascript
GIF/PNG generation with JS?
This page's ID:
29823
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Gif, Png, absolutely anything [small]( yes! )[/small] can be generated in JavaScript and used in the browser through the data: URI scheme. So far the most common application I've seen/done was BMP because the file format is dead simple and small-ish images ( e.g. 96x64 ) can be generated on the fly at ~20 fps. Check out [url=http://www.p01.org/releases/Demoscene/#neja]Neja[/url] or my [url=http://poi.ribbon.free.fr/data_uri/]old and dirty texture generator[/url] ( ca 2004 ). Notice the bytes to ISO conversion is sub optimal in these examples. Since then I simply use a LUT of [i]escape( String.fromCharCode( value ) )[/i] or the following function:[code]/* * bytes2iso * argument any number or values * return a String with the arguments casted to byte and converted to ISO format */ function bytes2iso() { return escape( String.fromCharCode.apply( String, arguments ) ); } alert( bytes2iso( 64,20,40,65,69, "string will give %00", Math.PI, foo ) )[/code]Also I always work with an LFB that I join('') and concatenate to the BMP header before flushing to an IMG tag or similar. One more thing, 8bits BMP might be faster ... unless the values put in the LFB are already converted to ISO. Hope that helps, [url=http://www.p01.org/][img]http://poi.ribbon.free.fr/files/p01_ozoneasylum_sig_teapot.png[/img][/url] [small](Edited by [url=http://www.ozoneasylum.com/user/2185]poi[/url] on 12-31-2007 14:30)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »