Skip to content

Commit

Permalink
Merge pull request #63 from ernestopye/master
Browse files Browse the repository at this point in the history
Allowing enlargement when generating padded images.
  • Loading branch information
jimmynicol committed Aug 4, 2015
2 parents d8ec5cc + 9fc01a1 commit e5e5167
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/streams/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ module.exports = function () {

var r = sharp(image.contents);

// never enlarge an image beyonds its original size
r.withoutEnlargement();
// never enlarge an image beyond its original size, unless we're padding
// the image, as even though this can count as an "enlargement" the padded
// result can be reasonably generated in most cases.
if (image.modifiers.action !== 'crop' && image.modifiers.crop !== 'pad') {
r.withoutEnlargement();
}

// if allowed auto rotate images, very helpful for photos off of an iphone
// which are landscape by default and the metadata tells them what to show.
Expand Down

0 comments on commit e5e5167

Please sign in to comment.