Skip to content

Commit

Permalink
command line interface - inverted behaviour of skip png format optimi…
Browse files Browse the repository at this point in the history
…sation (#5)

* - fixed skip-png-format-optimization:
uses transferformat 'zip' by default for maximum resolution and 'png' if this flag was used to save bandwidth

* - add skip-png-format-optimization parameter explanation to readme

* - update version to 2.0.3
  • Loading branch information
Andreas Braumann authored Sep 12, 2022
1 parent cbbc656 commit 234c16b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ by default to save credits. Specify this flag to force reprocessing.
- `--confirm-batch-over` (default `50`) - Prompt for confirmation before
processing batches over this size. Specify `-1` to disable this safeguard.

- `--skip-png-format-optimization` - By default the cli calls the API with `zip` format for maximum output resolution.
When specifying this flag it will use `png` format to save bandwidth by limiting the output resolution to 10 megapixels.


#### Image processing options

Please see the [API documentation][api-docs] for further details.
Expand Down
2 changes: 1 addition & 1 deletion lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function validateRemovebgOptions(removebgOptions) {
removebgOptions.channels = removebgOptions.channels || "rgba";
removebgOptions.format = removebgOptions.format || 'png';

if (removebgOptions['skip-png-format-optimization'] && removebgOptions.format == 'png') {
if (!removebgOptions['skip-png-format-optimization'] && removebgOptions.format == 'png') {
removebgOptions.transferFormat = 'zip';
} else {
removebgOptions.transferFormat = removebgOptions.format || 'png';
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Kaleido AI GmbH",
"email": "[email protected]",
"private": true,
"version": "2.0.1",
"version": "2.0.3",
"engines": {
"node": "14.18.1"
},
Expand Down

0 comments on commit 234c16b

Please sign in to comment.