Reputation: 40671
We have an iOS app that uses canvas in PhoneGap. We can get the image out as a PNG, but what we're trying to do is get the canvas image out of PhoneGap as a JPG, as nearly all social sharing (Instagram, Facebook, etc.) prefer JPG.
This seems like a daunting task. Is it doable? I've spent some time searching and see the question asked here and there but no specific answer to the solution.
A more specific question, perhaps: What would you suggest for for getting an HTML5 Canvas object uploaded to a social photo sharing service (that provides an API for doing that) within PhoneGap?
Upvotes: 0
Views: 704
Reputation: 1967
I don't really know this PhoneGap, but the website says it's utilizing javascript and HTML5. If you are using Canvas.toDataURL method to get the PNG file. Well then try:
Canvas.toDataURL("image/jpg");
If iOS doesn't support that but you've managed to get .png
:
Send it to a server and convert to any extension you want.
It looks like this library even have methods to make it easier:
http://docs.phonegap.com/en/1.4.1/phonegap_file_file.md.html#FileTransfer
Upvotes: 2