-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Compatibility with mozjpeg #539
Comments
Probably, but it might take passing different options in. We already work with libjpeg-turbo, as it's the default on at least one of the linux platforms. As long as they keep the api the same, I don't think it's going to be a major issue to drop it in. |
Does jpeg2000 support affect this in any way? |
Nope. Different format. |
From mozjpeg's readme:
So there may be some caveats even if it's compatible. |
I intalled mozjpeg as default libjpeg in my Arch Linux, and Pillow can't save JPEG files with it:
Pillow still can't work with mozjpeg? Or this is my local problem somewhere? libjpeg-turbo works good. |
As far as I know, it's never been tested with mozjpeg. |
+1 , @andreymal its still a problem. |
Same here |
Yes, is the quality actually better when the JPEG file is written by mozjpeg instead of passing mozjpeg an existing JPEG file? Only if Pillow can directly write a JPEG using mozjpeg from a raw/lossless buffer this can be realized without intermediary files like PNGs. |
Yep, there is a problem on a OS X. Used following snippet: from PIL import Image
with open('example.jpg', 'rb') as f:
image = Image.open(f)
width, height = image.size
offer_image = image.crop((0, 0, 20, 20))
with open('result.jpg') as f:
offer_image.save(f, "JPEG", quality=90) On Ubuntu works like a charm. On OS X i see following error when opening JPEG file:
If i open PNG and convert it to RGB, i can't save it as JPEG: from PIL import Image
with open('example.png', 'rb') as f:
image = Image.open(f)
image = image.convert('RGB')
width, height = image.size
offer_image = image.crop((0, 0, 20, 20))
with open('result.jpg') as f:
offer_image.save(f, "JPEG", quality=90) Error:
How is it possible to fix the issue? Could somebody please give an advice where to dig further? |
Do you get this error with any image file? Seems to me like a broken jpeg file or maybe a broken connection during file opening on a remote filesystem or something like this. Try with other files first.
Here you have an updated jpeg library (version 90) and pil expects 80. Probably you should upgrade all modules. |
@DonnaRosa Thank very much for your response!
I've tried several files. For example, that one. They are opened and saved correctly using jpeg, jpeg-turbo (last jpeg-turbo test failed, hovewer previously it was working well, need to investigate that) and openjpeg libraries. But problem with mozjpeg remains on OS X.
How could i do that? I am trying to install latest Pillow/Pillow-SIMD versions (tried both) UPD:
|
I have tried to open your example image. But Ubuntu's EyeOfGnome couldn't open it: |
The image from the last few comments no longer seems available for download. Apart from that, I've created #8645 as a possible resolution to this. |
Hi there, I was just wondering whether it's possible to use pillow with the newly announced https://github.com/mozilla/mozjpeg/ . Sorry if this is a dumb question
The text was updated successfully, but these errors were encountered: