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

Squoosh CLI incorrectly handles grayscale PNGs #971

Closed
shuding opened this issue Mar 10, 2021 · 1 comment · Fixed by #972
Closed

Squoosh CLI incorrectly handles grayscale PNGs #971

shuding opened this issue Mar 10, 2021 · 1 comment · Fixed by #972

Comments

@shuding
Copy link

shuding commented Mar 10, 2021

Before you start
Please take a look at the FAQ as well as the already opened issues! If nothing fits your problem, go ahead and fill out the following template:

Describe the bug
Squoosh CLI doubles the image and changed the hue for grayscale PNGs:

It can be reproduced with both WebP and OxiPNG, but it works expectedly in the web app.

To Reproduce
Steps to reproduce the behavior:

  1. Download https://imgur.com/wgqaUdn (or https://i.imgur.com/eTgdpzy.png)
  2. Run squoosh-cli --webp auto image.png
  3. See bug

Expected behavior
It should not change the image content.

Version:

  • OS w/ version: macOS 11.2.2
  • Browser w/ version: n/a
  • Node version: v14.16.0
  • npm version: 6.14.11

Is your issue related to the quality of image compression?
Please attach original and output images (you can drag & drop to attach).

  • Original image

test-2

  • Output image from Squoosh

test-2-output-oxipng

Additional context, screenshots, screencasts

Here's a full screenshot of commands I ran:

CleanShot 2021-03-11 at 03 00 39@2x

@developit
Copy link
Collaborator

As per @RReverser: this is likely caused by the Rust-based PNG decoder, which we don't use in the browser version of Squoosh (matches up with the bug description). We are configuring a greyscale-to-RGB transform, but it doesn't seem to be functioning as the decoding code expects:

// Transformations::EXPAND will make sure color_type is either
// RGBA or RGB. If it’s RGB, we need inject an alpha channel.

RReverser added a commit that referenced this issue Mar 11, 2021
Add conversions for all color types in PNG decoder used in CLI. (While at it, also made few minor cleanups.)

Fixes #971.
RReverser added a commit that referenced this issue Mar 11, 2021
Add conversions for all color types in PNG decoder used in CLI. (While at it, also made few minor cleanups.)

Fixes #971.
kodiakhq bot pushed a commit to vercel/next.js that referenced this issue Apr 1, 2021
This PR updates the Squoosh PNG decoder, which fixes #22929 in GoogleChromeLabs/squoosh#971.

## Bug

- [x] Fixes #22929
- [x] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
SokratisVidros pushed a commit to SokratisVidros/next.js that referenced this issue Apr 20, 2021
This PR updates the Squoosh PNG decoder, which fixes vercel#22929 in GoogleChromeLabs/squoosh#971.

## Bug

- [x] Fixes vercel#22929
- [x] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
flybayer pushed a commit to blitz-js/next.js that referenced this issue Apr 29, 2021
This PR updates the Squoosh PNG decoder, which fixes vercel#22929 in GoogleChromeLabs/squoosh#971.

## Bug

- [x] Fixes vercel#22929
- [x] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
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

Successfully merging a pull request may close this issue.

2 participants