Isotr0py / pillow-jpegxl-plugin

Pillow plugin for JPEG-XL, using Rust for bindings.
GNU General Public License v3.0
21 stars 6 forks source link

Images don't open in Safari #46

Open rphlo opened 6 months ago

rphlo commented 6 months ago

I tested this package to dynamically serve jxl from my server, however the images do not open in ios safari or mac safari which are supporting jxl by default.

Isotr0py commented 6 months ago

Emmm, I don't have an iphone/macbook to test this on safari, so I'm not sure if it would be an issue of safari instead.

The jxl image that I encoded using the plugin is able to be opened in Firefox Nightly and displayed normally: QQ截图20240501194905

Can you provide me some failed jxl image so that I can investigate this further?

rphlo commented 6 months ago

I investigated further and the issue seems to be with images having a transparency layer. The images I tested with a transparency layer do not open in firefox nightly while the one without transparency (from JPEG) convert and open properly.

I used the following code:

import pillow_jxl
from PIL import Image

# Lossless encode a png image
with Image.open("example.png") as img:
    img.save("example-lossless.jxl", lossless=True)

# encode image with JPEG-Style quality
with Image.open("example.png") as img:
    img.save("example-lossy.jxl", quality=40)

Here the images: example.zip

Isotr0py commented 6 months ago

However, all example images can be opened in Firefox Nightly 127.0a1 (2024-05-01) (64-bit): QQ截图20240502112433

I guess this is a decoder issue about the browser instead...

rphlo commented 6 months ago

Yes, seems to works with windows firefox, but no success on macos or linux

ajslater commented 3 months ago

All the images in this thread display on my iPhone in the iOS GitHub app as well as in mobile safari.

rphlo commented 3 months ago

@ajslater you should as Github re-encode all pictures in posts as png. What about the images in the example.zip file of my previous message?

ajslater commented 3 months ago

Woops, my bad. I just tried with desktop safari on the zipped images and while they do show as "JPEG XL Container" to the file utility, they do not open with desktop Mac Safari or the Preivew app. And indeed using this plugin to covert the enclosed png produces a similarly undisplayable jxl.

rphlo commented 2 months ago

As I commented in my PR #61 the Exif metadata seems to be the problem, I modified the code to be able to generate file that open on Apple OSs.

rphlo commented 2 months ago

Any release scheduled?

Isotr0py commented 2 months ago

The new release has been uploaded to pypi :)