exports

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

exports

Owen Densmore
Administrator
Check this out:
.. it runs for 200 ticks then creates dataUrl images out the individual layers being used (Patches, Links, Turtles). And then creates a composite of all the layers (export world sort of thing)

One fascinating thing: if you click on the layers & composite, and save-as, the resulting images are real pngs! Like tiny!

So the browser has the ability to create pngs and download them. This is maybe useful. Surprisingly, the dataUrls are not that much larger. 

Example: on the run I just made, the composite dataUrl was 55K, while the saved .png was 42K. Possibly the png is not as compressed as it could be .. when I read it into Graphic Converter and wrote it back out, it shrank to 36K. But still, the dataUrl is not that bad.

There's a hack that I've seen on Stack Overflow where you put the image in a hidden <a> then use JS to "click" it and it downloads it! Weird.

I've also use canvas.toBlob, and createImageBitmap(blob). They're pretty compressed, say 1/3 smaller. But only on modern browsers etc...

   -- Owen

============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
Reply | Threaded
Open this post in threaded view
|

Re: exports

Owen Densmore
Administrator
Oops, sorry, fat fingered the "to".

On Fri, Apr 1, 2016 at 10:08 PM, Owen Densmore <[hidden email]> wrote:
Check this out:
.. it runs for 200 ticks then creates dataUrl images out the individual layers being used (Patches, Links, Turtles). And then creates a composite of all the layers (export world sort of thing)

One fascinating thing: if you click on the layers & composite, and save-as, the resulting images are real pngs! Like tiny!

So the browser has the ability to create pngs and download them. This is maybe useful. Surprisingly, the dataUrls are not that much larger. 

Example: on the run I just made, the composite dataUrl was 55K, while the saved .png was 42K. Possibly the png is not as compressed as it could be .. when I read it into Graphic Converter and wrote it back out, it shrank to 36K. But still, the dataUrl is not that bad.

There's a hack that I've seen on Stack Overflow where you put the image in a hidden <a> then use JS to "click" it and it downloads it! Weird.

I've also use canvas.toBlob, and createImageBitmap(blob). They're pretty compressed, say 1/3 smaller. But only on modern browsers etc...

   -- Owen


============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com