Jpeg XL breaks things pretty badly.
Closed this issue ยท 6 comments
Description
JPEG XL (JXL) images cause Thunder to break output. They're not technically supported by Pictrs so are not used often.
How to Reproduce
Steps to reproduce the behavior:
- Go to https://lemmy.world/post/11021604
- Screen briefly loads then changes to an empty black screen
Expected Behavior
Even if the image fails the comment thread should still be visible.
Device & App Version:
- Device: Pixel 6 Pro
- OS: Android 14
- App Version: 0.2.9-1
I wonder if we'd need to open an issue with Extended Image.
@micahmo are you able to get the specific error that occurs when trying to load a jpeg xl image?
So I took a deeper look into this, and it seems like this may be out of scope to support jxl
at this moment. Flutter itself does not support jxl
as mentioned here: flutter/flutter#113476. Flutter does provide fallback to using the OS's media codecs so it depends on the OS. For example, Apple currently has support for jxl
but Android still has an open issue for this: https://issuetracker.google.com/issues/259900694?pli=1
It seems like the only solutions here are to either create a jxl
codec plugin, or have some resolution on Android's end to implement support for jxl
.
What we can do, is add in a check to see if its jxl
, and either fallback to showing an error, or request the image in a different format using ?format=
for the pictrs endpoint (e.g., ?format=png
or ?format=jpeg
.
Just a quick update on this, I've fixed the issue where the comment section breaks when attempting to load a failed image. This handles the more generic case where unsupported formats should fallback gracefully.
In terms of providing support for jxl
, that may come in the future. The problem with my suggestion previously is that not all images may come from pictrs
, so some additional thought will be needed to come up with a more robust solution.
That being said, since pictrs
does not technically support jxl
, I dont believe there will be too many instances of this happening so we can revisit jxl
support in the future (and maybe then, it'll be more widely adopted!)