Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

auto orientation

  • Loading branch information...
commit 5e472a8e068b184405726791e08cb7af4122bf1c 1 parent 07a6f37
Hage Yaapa authored
Showing with 9 additions and 9 deletions.
  1. +8 −8 easyimage.js
  2. +1 −1  package.json
16 easyimage.js
View
@@ -172,8 +172,8 @@ exports.resize = function(options) {
options.height = options.height || options.width;
// options.src = quoted_name(options.src);
// options.dst = quoted_name(options.dst);
- if (options.quality === undefined) args = [options.src, '-resize', options.width + 'x' + options.height, options.dst];
- else args = [options.src, '-resize', options.width + 'x' + options.height, '-quality', options.quality, options.dst];
+ if (options.quality === undefined) args = [options.src, '-auto-orient', '-resize', options.width + 'x' + options.height, options.dst];
+ else args = [options.src, '-auto-orient', '-resize', options.width + 'x' + options.height, '-quality', options.quality, options.dst];
child = exec('convert', args, function(err, stdout, stderr) {
if (err) deferred.reject(err);
@@ -202,8 +202,8 @@ exports.crop = function(options) {
// options.src = quoted_name(options.src);
// options.dst = quoted_name(options.dst);
- if (options.quality === undefined) args = [options.src, '-gravity', options.gravity, '-crop', options.cropwidth + 'x'+ options.cropheight + '+' + options.x + '+' + options.y, options.dst];
- else args = [options.src, '-gravity', options.gravity, '-crop', options.cropwidth + 'x'+ options.cropheight + '+' + options.x + '+' + options.y, '-quality', options.quality, options.dst];
+ if (options.quality === undefined) args = [options.src, '-auto-orient', '-gravity', options.gravity, '-crop', options.cropwidth + 'x'+ options.cropheight + '+' + options.x + '+' + options.y, options.dst];
+ else args = [options.src, '-auto-orient', '-gravity', options.gravity, '-crop', options.cropwidth + 'x'+ options.cropheight + '+' + options.x + '+' + options.y, '-quality', options.quality, options.dst];
child = exec('convert', args, function(err, stdout, stderr) {
if (err) deferred.reject(err);
@@ -236,8 +236,8 @@ exports.rescrop = function(options) {
// options.src = quoted_name(options.src);
// options.dst = quoted_name(options.dst);
options.fill = options.fill ? '^' : '';
- if (options.quality === undefined) args = [options.src, '-resize', options.width + 'x' + options.height + options.fill, '-gravity', options.gravity, '-crop', options.cropwidth + 'x'+ options.cropheight + '+' + options.x + '+' + options.y, options.dst];
- else args = [options.src, '-resize', options.width + 'x' + options.height, options.fill, '-gravity' + options.gravity, '-crop', options.cropwidth + 'x'+ options.cropheight + '+' + options.x + '+' + options.y, '-quality', options.quality, options.dst];
+ if (options.quality === undefined) args = [options.src, '-resize', options.width + 'x' + options.height + options.fill, '-auto-orient', '-gravity', options.gravity, '-crop', options.cropwidth + 'x'+ options.cropheight + '+' + options.x + '+' + options.y, options.dst];
+ else args = [options.src, '-resize', options.width + 'x' + options.height, options.fill, '-auto-orient', '-gravity' + options.gravity, '-crop', options.cropwidth + 'x'+ options.cropheight + '+' + options.x + '+' + options.y, '-quality', options.quality, options.dst];
child = exec('convert', args, function(err, stdout, stderr) {
if (err) deferred.reject(err);
@@ -280,8 +280,8 @@ exports.thumbnail = function(options) {
else if (original.height > original.width) { resizeheight = ''; }
// resize and crop
- if (options.quality === undefined) args = [options.src, '-interpolate', 'bicubic', '-strip', '-thumbnail', resizewidth + 'x' + resizeheight, '-gravity', options.gravity, '-crop', options.width + 'x'+ options.height + '+' + options.x + '+' + options.y, options.dst];
- else args = [options.src, '-interpolate', 'bicubic', '-strip', '-thumbnail', resizewidth + 'x' + resizeheight, '-quality', options.quality, '-gravity', options.gravity, '-crop', options.width + 'x'+ options.height + '+' + options.x + '+' + options.y, options.dst];
+ if (options.quality === undefined) args = [options.src, '-interpolate', 'bicubic', '-strip', '-thumbnail', resizewidth + 'x' + resizeheight, '-gravity', options.gravity, '-auto-orient', '-crop', options.width + 'x'+ options.height + '+' + options.x + '+' + options.y, options.dst];
+ else args = [options.src, '-interpolate', 'bicubic', '-strip', '-thumbnail', resizewidth + 'x' + resizeheight, '-quality', options.quality, '-gravity', options.gravity, '-auto-orient', '-crop', options.width + 'x'+ options.height + '+' + options.x + '+' + options.y, options.dst];
child = exec('convert', args, function(err, stdout, stderr) {
if (err) return deferred.reject(err);
2  package.json
View
@@ -1,6 +1,6 @@
{
"name": "easyimage",
- "version": "1.2.1",
+ "version": "1.2.2",
"description": "A promise-based, user-friendly module for processing images in Node.js",
"main": "easyimage.js",
"scripts": {
Please sign in to comment.
Something went wrong with that request. Please try again.