-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P5.image to base64 POSTable image #2326
Comments
something like this should work: var img;
function setup() {
img = loadImage("cat.jpg");
}
function mousePressed() {
img.loadPixels();
console.log( img.canvas.toDataURL() );
} |
Worked like a charm - thank you. @lmccart - Lauren, a question: Do you think it would be helpful to propose and create some functions for beginners to get() the canvas encoded images - or parts of it (with get()) in case they would like to upload them somewhere per POST? Like lets say - upload sketches by users to a server? I just did it for one project and it wasn't easy for me to figure everything out.. What do you think? Anyway big thank you :) |
This is nowhere in the documentation. Thanks for this. |
Is it possible to add the
which feels very hacky... |
Nature of issue?
Most appropriate sub-area of p5.js?
New feature details:
Is there a way on how to convert P5.image object into base64 png image object?
I would like to:
Note:
If I wanted to post my whole canvas (already solved) I simply grab the canvas contents with canvas.toDataURL() and use that - but since cropped result is what I need - this isnt the way.
Thank you
Oliver
The text was updated successfully, but these errors were encountered: