CamanJS icon indicating copy to clipboard operation
CamanJS copied to clipboard

CamanJS + NodeJs imageBase64

Open fukhaos opened this issue 12 years ago • 2 comments

How pass the Image Base64 and get the return in base64 ?

Caman = require('caman').Caman;

//Caman("./path/to/file.jpg", function () {
Caman( imageBlob, function () {
  this.brightness(40);
  this.render(function () {
     //this.save("./output.png");
     return imageWithFilterBlob;
  });
});

fukhaos avatar Nov 20 '13 01:11 fukhaos

I would try converting Base64 to image before passing it to CamanJS. There's a SO thread that shows how to achieve that.

bebraw avatar Dec 02 '13 11:12 bebraw

And to get back the result in base64 you can access the standard canvas object in Caman instance:

Caman( imageBlob, function () {
  this.brightness(40);
  this.render(function () {
     var base64 = this.canvas.toDataURL("image/jpeg");
  });
});

lukaszfiszer avatar Dec 10 '13 01:12 lukaszfiszer