Topic: GIF/PNG generation with JS? |
|
|---|---|
| Author | Thread |
|
Obsessive-Compulsive (I) Inmate From: |
posted 12-31-2007 04:04
Hey guys, |
|
Bipolar (III) Inmate From: Cranleigh, Surrey, England |
posted 12-31-2007 13:51
|
|
Paranoid (IV) Inmate From: Norway |
posted 12-31-2007 14:18
Gif, Png, absolutely anything ( yes! ) 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. 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 ) )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. |
|
Bipolar (III) Inmate From: |
posted 12-31-2007 14:28
Gents, let me take the opportunity to whine about Wrayal's web space being down too often |
|
Obsessive-Compulsive (I) Inmate From: |
posted 12-31-2007 16:42
Ah, BMP! I totally forgot about the existence of that format. That should work as well. Thanks for the links, guys. |
|
Paranoid (IV) Inmate From: Norway |
posted 12-31-2007 17:01
|
|
Paranoid (IV) Inmate From: Florida |
posted 12-31-2007 18:46
quote:
|
|
Paranoid (IV) Inmate From: cell 3736 |
posted 01-12-2008 12:57
quote:
|
|
Paranoid (IV) Inmate From: Norway |
posted 01-12-2008 13:16
Base64 conversion requires to mangle the bits and stuff. |
|
Paranoid (IV) Inmate From: cell 3736 |
posted 01-12-2008 16:14
Could someone tell me what's causing the huge memory leak in my code (firefox). |
|
Paranoid (IV) Inmate From: Norway |
posted 01-12-2008 16:39
Out of the top of my head, I'd say Fx is not garbage collecting the many images generated. |
|
Paranoid (IV) Inmate From: cell 3736 |
posted 01-12-2008 16:57
Do you know of a way to force firefox to garbage collect the old images? Seems pretty hopeless because even closing the tab or window doesn't help |
|
Paranoid (IV) Inmate From: Norway |
posted 01-12-2008 17:10
Dunno. It's never really been a problem for me. Does Neja leak like crazy in Fx2 ? It doesn't in Fx3b2. |
|
Paranoid (IV) Inmate From: cell 3736 |
posted 01-12-2008 17:53
ff2 with neja takes max 150mb ... my little script with ff2 stops rapidly climbing at around 200mb ... weird... I'm installing ff3 now |
|
Paranoid (IV) Inmate From: cell 3736 |
posted 01-12-2008 18:35
What do you mean my script doesn't leak on opera 9.5b ... it does :P ... neja doesn't start at all though on my opera :S ... |
|
Paranoid (IV) Inmate From: cell 3736 |
posted 01-12-2008 22:06
ok ... less whining, more programming |