Skip to content
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

Export to PNG or JPG #3

Closed
matj opened this issue Mar 12, 2013 · 4 comments
Closed

Export to PNG or JPG #3

matj opened this issue Mar 12, 2013 · 4 comments

Comments

@matj
Copy link

matj commented Mar 12, 2013

Hello,

beautiful tool. Is there any way to export the result to PNG or JPG?

@boblemarin
Copy link
Owner

It shouldn't be a problem since the toDataURL() method of the canvas allows to get the encoded png or jpeg data.

This functionality is not yet present in the plugin, though. I'm wondering if it might not be out of its scope.
Maybe a method exposing the canvas or context used by the eraser would allow you to easily implement what you need.
What you think ?

@matj
Copy link
Author

matj commented Mar 12, 2013

Yes yes, toDataUrl() is good solution. Thank you very much.

I need to merge the top layer after erase, with the background. But I solved it quickly by your tip.

@boblemarin
Copy link
Owner

great !
is there any modification to do to the plugin to ease the process or is it good as it is ?

@matj
Copy link
Author

matj commented Mar 12, 2013

A good idea is to add two methods:

First select the top layer as PNG

function getpng(event){
var canvas = document.getElementById("kabelka"); // best $("#kabelka").get(0).toDataUrl();
var dataUrl = canvas.toDataURL();
$("textarea[name=image]").val(dataUrl);
$("form").submit();
event.preventDefault();
}

Second merges with the FG and BG chooses them as common picture (here is needed to canvas BG) - this is only idea

My simple test: http://test.matj.sk/eraser/

I creating Facebook app for handbag seller. I need dynamically change handbag from the left menu and user can erase area on hand. User also can with drag&drop change position of handbag. Result is shared to Facebook or Email as image.

Sorry for my bad english :)

@matj matj closed this as completed Mar 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants