开发者

How do I save a manipulated image?

I use a javascript image processing library to manipulate an image, and when I'm done I want to have the possibility to save the image (a new file) to the server and keep track of it in a database. The database part is no problem, but how do I save the image without losing the manipulation done?

Are there any l开发者_如何学Pythonibraries for that or is it easiest to just do it myself?


It doesn't seem like Pixastic provides an interface for this, specifically, but there is a property in the options giving you the resulting canvas:

var options = {};
Pixastic.process(image, "action", options);
options.resultCanvas; // <- holds new canvas

This canvas object you can use to obtain a "data URL":

options.resultCanvas.toDataURL('image/jpeg')

Uploading 'canvas' image data to the server

The "data URL" is a tiny header (see the so-post linked) and the file content in a string. You can post this to the server for storage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜