Skip to content

Commit

Permalink
fix: ignore strict option when maxWidth/Height is set smaller
Browse files Browse the repository at this point in the history
fix #134
  • Loading branch information
fengyuanchen committed Sep 19, 2021
1 parent 926fcf4 commit 8e761ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## next

- Ignore the `strict` option when the `maxWidth/Height` option is set and its value is less than the natural width/height of the image (#134).
.

## 1.0.7 (Nov 28, 2020)

- Update the built-in dependencies for better adaptability.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ Indicates if output the original image instead of the compressed one when the si
- The `height` option is set and its value is greater than the natural height of the image.
- The `minWidth` option is set and its value is greater than the natural width of the image.
- The `minHeight` option is set and its value is greater than the natural height of the image.
- The `maxWidth` option is set and its value is less than the natural width of the image.
- The `maxHeight` option is set and its value is less than the natural height of the image.

### checkOrientation

Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ export default class Compressor {
|| options.height > naturalHeight
|| options.minWidth > naturalWidth
|| options.minHeight > naturalHeight
|| options.maxWidth < naturalWidth
|| options.maxHeight < naturalHeight
)) {
result = file;
} else {
Expand Down

0 comments on commit 8e761ab

Please sign in to comment.