Open rlaphoenix opened 1 year ago
Good research!
Can you upload a non-working image and a stripped one to this issue? I knew this issue existed but didn't know the reason. Now that you have proposed this, i was reading about that different image formats (JFIF/Exif) can exist for a single extension (JPEG).
Apparently JFIF is not supported by stb_image so i wonder if the images from steamgriddb that dont work are JFIF and your converting doesnt just strip the metadata but also converts it to Exif or if its, like you said, "just" the metadata that fucks up the image for the switch.
Hi,
I've updated the original post with links to the exact images on SteamGridDB. All three of them are PNG images, and so is the 4th image that works fine.
There doesn't seem to be any "extra" metadata that may affect it (though I haven't fully checked that), but one thing I have noticed is all three of the broken images are 32-bit RGB, while the working one is 24-bit RGB. All images are 8bpp, but the three broken images are RGBA (therefore a 32-bit image) while the working image is 24-bit.
I guess just see if you can convert from RGBA to RGB explicitly (remove the alpha channel). However, I still believe you should look into stripping metadata if possible as extra metadata WILL also cause this. I can confirm this from another project I have that deals with NSPs.
Sounds good, i will leave this open until i can fix it. I am actually working on a new version that is not yet on github, so this is perfect timing.
It's definitely the 32bit rgba images that are causing they grey "?" @rlaphoenix if you open the image on a pc the image displayed has a weird corrupt look like it's not processed correctly.
Metadata stripping should help towards filesize especially when 120kb is a good size to aim for (128kb being the maximum)
If you download an image, already JPEG or otherwise, it will not be immediately compatible with Horizon OS. Any single extra piece of metadata that is not strictly required for viewing the image, will cause Horizon OS to display a "?" icon rather than the icon selected. It's extremely annoying.
This is happening in some images from SteamGridDB. Ideally adding a function that strips downloaded metadata from any and all extra metadata would be ideal.
Example:
The following SteamGridDB Images for SONIC FORCES (600x900) all fail to display:
Whereas the Image 305235 for the same Title works flawlessly.
You can strip the unnecessary metadata using ImageMagick or Python Pillow/PIL. I'm sure there are also ways in C++.
Via ImageMagick (overwrites input):
Via Python Pillow (overwrites input):
Note that it's resizing to 256x256 as that's normally a required restriction for Icon files. However, with sys-tweak, I'm not sure if that's still the case.
I'm using a self-compiled build of sys-tweak as of the latest commit https://github.com/p-sam/switch-sys-tweak/commit/fe4cf8582023901afaacb0ac22cfbc39bd928445