meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.56k stars 406 forks source link

Rotate image in nodejs environment fails #91

Closed srinathgs closed 11 years ago

srinathgs commented 11 years ago

Hi,

I just used the caman.full.js from this repo and copied to the node_modules folder.

then I wrote a sample code to test the image rotation feature of camanJS. but it fails throwing the following error.

/home/dastan/node_modules/caman/dist/caman.full.js:284
        throw err;
          ^
TypeError: Cannot call method 'replaceChild' of undefined
    at Caman.Root.Caman.Caman.replaceCanvas (/home/dastan/node_modules/caman/dist/caman.full.js:490:28)
    at Caman.mul_table (/home/dastan/node_modules/caman/dist/caman.full.js:3280:17)
    at Function.Plugin.execute (/home/dastan/node_modules/caman/dist/caman.full.js:1653:33)
    at Renderer.Caman.Renderer.Renderer.executePlugin (/home/dastan/node_modules/caman/dist/caman.full.js:1755:14)
    at Renderer.Caman.Renderer.Renderer.processNext (/home/dastan/node_modules/caman/dist/caman.full.js:1702:23)
    at Renderer.processNext (/home/dastan/node_modules/caman/dist/caman.full.js:7:61)
    at Renderer.Caman.Renderer.Renderer.blockFinished (/home/dastan/node_modules/caman/dist/caman.full.js:1861:21)
    at Renderer.Caman.Renderer.Renderer.eachBlock (/home/dastan/node_modules/caman/dist/caman.full.js:1732:30)
    at Renderer.Caman.Renderer.Renderer.executeFilter   (/home/dastan/node_modules/caman/dist/caman.full.js:1747:21)
    at Renderer.Caman.Renderer.Renderer.processNext (/home/dastan/node_modules/caman/dist/caman.full.js:1704:23)

Help!! Thanks and Regards,

Srinath

xrmx commented 11 years ago

It's not a rotate plugin specific issue, the script beelow using crop fails the same way:

var Caman = require('caman').Caman;
Caman("tshirt.jpg", function () {
  this.crop(50, 50);
  this.render(function () {
    this.save("output.jpg");
  });
});