#lwip-jpeg-autorotate
Rotate images automatically based on EXIF orientation tag.
- Reads the EXIF orientation tag from jpeg file
- Automatically rotates/flips using lwip
- Fails silently when EXIF data is not present or image is not a jpeg
Please have a look at the following module as it is much more active: https://github.com/johansatge/jpeg-autorotate
$ npm install lwip-jpeg-autorotate --save
var lwipJpegAutorotate = require('lwip-jpeg-autorotate');
lwipJpegAutorotate.autorotate(inputpath, outputpath).then(function (res) {
// ok
console.log(res);
/* =>
{
inputpath: '/home/lwip-jpeg-autorotate/test/images/Landscape_2.jpg',
outputpath: '/home/lwip-jpeg-autorotate/test/images/Landscape_2.output.jpg',
buffer: <Buffer ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 00 48 00 48 00 00 ff e2 07 b8 49 43 43 5f 50 52 4f 46 49 4c 45 00 01 01 00 00 07 a8 61 70 70 6c 02 20 00 00 ... >,
operations: { mirror: { axes: 'x' } },
extension: 'jpg',
image: { __lwip: {}, __locked: false, __trans: false }
}
*/
}, function (err) {
// unexpected error
});
Simple log messages are managed using debugging utility
To display them, set env variable:
DEBUG=lwip-jpeg-autorotate
Tests are run by Mocha test framework and Chai assertion library.
Test images are provided by EXIF Orientation-flag example images under MIT licence.
To run tests + coverage:
npm test
or
gulp
To run tests only
gulp test
To enable logs:
DEBUG=lwip-jpeg-autorotate gulp test
Project originally generated with Yeoman Node Generator.
Apache-2.0 © Nicolas Toublanc