thedesk/app/node_modules/jimp/browser/examples/jimp-worker.js
2018-02-19 02:41:25 +09:00

14 lines
459 B
JavaScript

importScripts("../lib/jimp.min.js");
self.addEventListener("message", function(e) {
Jimp.read(e.data).then(function (lenna) {
lenna.resize(256, Jimp.AUTO) // resize
.quality(60) // set JPEG quality
.greyscale() // set greyscale
.getBase64(Jimp.AUTO, function (err, src) {
self.postMessage(src);
self.close();
});
});
});