thedesk/app/node_modules/jimp/browser/examples/jimp-worker.js

14 lines
459 B
JavaScript
Raw Normal View History

2018-02-19 04:41:25 +11:00
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();
});
});
});