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

[BUG] PNG output forced into indexed color #48

Closed
jeff-bowman opened this issue Sep 3, 2022 · 0 comments
Closed

[BUG] PNG output forced into indexed color #48

jeff-bowman opened this issue Sep 3, 2022 · 0 comments
Assignees

Comments

@jeff-bowman
Copy link

Since v1.5.0, PNG files that puppeteer-screenshot-tester generates are forced into indexed color (256 color limit).

This appears to be due to the use of quality on lines 117 and 147. As on the sharp PNG docs, setting quality implicitly sets palette to true.

Incidentally, line 93 sets compressionLevel instead of quality and therefore the diff files are properly saved losslessly.

Workarounds

Fixes

  • Switch lines 117 and 147 to set compressionLevel.

  • Pass outputSettings or one of its keys directly to sharp's output functions, allowing for passthrough control of Sharp. This could also be specified through something like:

    .png({ quality: outputSettings.compressionLevel || DEFAULT_PNG_COMPRESSION, ...outputSettings.overrides })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants