meltingice / CamanJS

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

Node version runs out of memory with big images #68

Closed bebraw closed 11 years ago

bebraw commented 11 years ago

I am trying to perform various operations on a reasonably big image (5616 x 3744 px) using Node version of Caman. Unfortunately it seems to run out of memory (gives "FATAL ERROR: JS Allocation failed - process out of memory" error) and gets stuck around finishInit (at this.originalPixelData.push(pixel); loop).

Considering this.originalPixelData is used only by revert perhaps you could add some kind of an option either to disable it temporarily or make revert optional (saves memory by default!). Either way would work.

meltingice commented 11 years ago

Good call. I agree that's something that should be optionally disabled.

meltingice commented 11 years ago

Just pushed this option. Try doing:

Caman.allowRevert = false

before initializing your image. You'll have to grab the latest from master branch right now. Let me know how it goes.

bebraw commented 11 years ago

Works great! Thanks a lot. :)

Feel free to close this issue. :)

meltingice commented 11 years ago

Great! I'll push out a version bump soon. One other thing that needs fixing first...