We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
image "save" to webpage??? (Read 1840 times)
image "save" to webpage???
Jan 18th, 2009, 7:04pm
 
Hi All:
I was wondering if there is a way (via javascript?) to  copy an image from a Processing applet out to an HTML image to the wrapping page?
Re: image "save" to webpage???
Reply #1 - Jan 19th, 2009, 1:14pm
 
I don't think so. At least not in a simple (and portable) way...

I can think of some convoluted ways...

I shown somewhere else in this forum (save to web --- image export) how to save an image on a Web server. You can then call JavaScript to tell it to update the page dynamically to show this image.

Another possibility, purely working on client side, but excluding some browsers (the Internet Explorer family!), could be to encode in Base-64 the image (in Jpeg/PNG format), then to transmit it to JavaScript and use the "data:image/png;base64," method in the src to display it.
Re: image "save" to webpage???
Reply #2 - Jan 20th, 2009, 1:21pm
 
Thanks for the quick reply
I was hoping to avoid send the image back to the server
oh well
THANXS!!
amb
Re: image "save" to webpage???
Reply #3 - Jan 20th, 2009, 6:46pm
 
If you use Processing.js (http://ejohn.org/blog/processingjs/), you're able to right click and save the applet as an image.. at least in Firefox.

-edit-
apparently not working anymore

-edit2-
BUT you could use http://ajaxian.com/archives/canvas2image-save-out-your-canvas-data-to-images with Processing.js, and some links outside the applets that save the content of the canvas using Javascript

-seltar
Page Index Toggle Pages: 1