Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error for any CPU effort outside of the 0...6 range #92

Open
marijo-macet opened this issue Sep 15, 2024 · 1 comment
Open
Labels

Comments

@marijo-macet
Copy link

CPU effort is one of the output options (--effort) for the PNG, WebP, GIF, AVIF, HEIF and JPEG XL image file formats. According to Sharp's API documentation, the following values are allowed:

  • PNG: number between 1 (fastest) and 10 (slowest)
  • WebP: number between 0 (fastest) and 6 (slowest)
  • GIF: number between 1 (fastest) and 10 (slowest)
  • AVIF: number between 0 (fastest) and 9 (slowest)
  • HEIF: number between 0 (fastest) and 9 (slowest)
  • JPEG XL: number between 3 (fastest) and 9 (slowest)

But the CLI for Sharp throws an unexpected error for any CPU effort outside of the 0...6 range.

Example:

sharp -i "image.jpg" -o "image.avif" --effort 9 -f "avif"

Expected result:

The input file is converted from JPEG to AVIF with a CPU effort of 9.

Actual result:

An InvalidParameterError is thrown. Error message: "Expected integer between 0 and 6 for effort but received 9 of type number"

@vseventer vseventer added the bug label Sep 15, 2024
@vseventer
Copy link
Owner

Yes, this seems to be a bug in the CLI - thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants