imagejs
imagejs copied to clipboard
When a bitmap comes from readFile rotate crashes
Given the following code:
var ImageJS = require('imagejs');
var bitmap = new ImageJS.Bitmap();
bitmap.readFile('image.png')
.then(function() {
// bitmap is ready
var rotated = bitmap.rotate({degrees: -10, fit: 'crop'});
bitmap.writeFile("rotated-image.png", {type: ImageJS.ImageType.PNG})
});
I get an error:
Unhandled rejection TypeError: Cannot read property 'data' of undefined
at module.exports (...node_modules/imagejs/lib/bitmap.js:46:46)
Not sure if I'm using the tool as intended, but was referencing the readme.
Seems to be related to using a negative value for the degrees
attribute.