Open Renatico opened 10 years ago
Here is what I managed to come up with
var fs = require('fs');
Caman(src, function () {
var caman = this;
this.render(function () {
var out = fs.createWriteStream(dst);
var stream = caman.canvas.createJPEGStream({
quality : 90
});
stream.pipe(out);
});
});
src
and dst
are source and destination files.
Probably this should be built-in Caman API, becasue this low-lvel abstraction directly from canvas library.
Thank you, Coagulant, very much! Your solution works for me!
Please, anybody! Who can answer my question: Can I save the modified image via CamanJS in a format of JPG/JPEG? By default, the module saves the pictures using the algorithm of PNG. It would be wrong if we just save files with the extension of .jpg because the file's algorithm is PNG. Can anybody help me?