Skip to content

Commit

Permalink
fix: make sure encoding options are passed to encode when no format i…
Browse files Browse the repository at this point in the history
…s specified
  • Loading branch information
stropitek committed Feb 21, 2024
1 parent 0446468 commit 6a6c0e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/save/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function getDataToWrite(
if (!options || !('format' in options)) {
const extension = nodePath.extname(destinationPath).slice(1).toLowerCase();
if (extension === 'png' || extension === 'jpg' || extension === 'jpeg') {
return encode(image, { format: extension });
return encode(image, { ...options, format: extension });
} else {
throw new RangeError(
'image format could not be determined from file extension. Use a supported extension or specify the format option',
Expand Down

0 comments on commit 6a6c0e7

Please sign in to comment.