Skip to content

Commit cee3342

Browse files
committed
do not upscale image
1 parent 596a04e commit cee3342

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ios/UIImage+CropScaleOrientation.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ - (UIImage*)imageByScalingNotCroppingForSize:(CGSize)targetSize
151151
} else {
152152
scaleFactor = widthFactor; // scale to fit width
153153
}
154+
if (scaleFactor > 1.0) {
155+
// do not upscale image
156+
return nil;
157+
}
154158
scaledSize = CGSizeMake(MIN(width * scaleFactor, targetWidth), MIN(height * scaleFactor, targetHeight));
155159
}
156160

0 commit comments

Comments
 (0)