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

Can't produce a Quality 0 JPEG #4439

Closed
Queuecumber opened this issue Feb 20, 2020 · 1 comment · Fixed by #4440
Closed

Can't produce a Quality 0 JPEG #4439

Queuecumber opened this issue Feb 20, 2020 · 1 comment · Fixed by #4440
Labels

Comments

@Queuecumber
Copy link

Queuecumber commented Feb 20, 2020

What did you do?

im.save(output_path / i.with_suffix('.jpg').name, quality=0)

What did you expect to happen?

A JPEG with libjpeg quantization equivalent to zero quality to be output.

What actually happened?

A JPEG with libjpeg quantization equivalent to quality 75 was output

What are your OS, Python and Pillow versions?

  • OS: Linux
  • Python: 3.5
  • Pillow:

Comments

I do research in image compression and as part of that research I wanted to produce some quality 0 JPEG files, the quantization matrix for that should filled with 255, dumping the resulting JPEGs quantization tables with djpeg I see that they are quality 75, and from the source code it looks like quality=0 indicates to use the defaulty quality which is 75.

Quality zero is a completely valid quality for libjpeg, but it doesn't work in Pillow. I'm not sure how many people care about quality 0 JPEGs so it might not be worth fixing but I still figured I'd leave this here.

@radarhere
Copy link
Member

I've created PR #4440 to resolve this.

@radarhere radarhere changed the title Can't Produce a Quality 0 JPEG Can't produce a Quality 0 JPEG Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants