mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
API serves some logos in non-transparent format #6936
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @samglt on GitHub (Apr 21, 2025).
Description of the bug
The API's get item image endpoint (/Items/{itemId}/Images/{imageType}) sometimes gets transparent logos in jpeg format when it should return a transparent format like webp or png. This doesn't affect the webUI because it has an Accept header that doesn't include jpeg, but does affect clients like Swiftfin and can be replicated by downloading the image with wget.
This issue affects only some items. Examples given in a Swiftfin issue are Redline and House.
Looking at GetItemImage and the functions it calls, I see that ProcessImage is checks that the file it's processing is saved in a transparency-supporting format and returns a webp/png in that case, so I don't know why this bug happens.
Reproduction steps
What is the current bug behavior?
The image downloaded is a jpeg, not a png or webp like it should be to have transparency
What is the expected correct behavior?
The image should be transparent
Jellyfin Server version
10.10.0+
Specify commit id
No response
Specify unstable release number
No response
Specify version number
10.10.6
Specify the build version
10.10.6
Environment
Jellyfin logs
FFmpeg logs
Client / Browser logs
No response
Relevant screenshots or videos
No response
Additional information
No response
@samglt commented on GitHub (Apr 21, 2025):
After a bit of looking, all the logos that have this problem are stored as SVGs (run
find /config/data -name 'logo.svg'to find these in your server) and indeed, the list of _transparentImageTypes only contains png, webp, gif. So SVG's are treated as opaque formats and thus get delivered as jpeg. I think just adding ".svg" to that list will solve this issue, but at the moment I don't have a development instance of Jellyfin running to confirm that.@gnattu commented on GitHub (Apr 21, 2025):
The client should explicitly tell the server that it supports one of the transparent format because the server cannot make unsafe assumptions. When the client does not explicitly require a format or has not pass a supported image format in its request header, the server will fallback to jpeg as safest option.
I do agree that it’s extremely rare for a client to be unable to read PNG files though.
@crobibero commented on GitHub (Apr 21, 2025):
SVG images have specific handling (https://github.com/jellyfin/jellyfin/pull/11077)
It's possible there is a bug in how I implemented it but it's been a year so I don't recall my testing results.
@samglt commented on GitHub (Apr 21, 2025):
I don't think it's a problem with SVG handling, because explicitly requesting png/webp results in a correctly transparent logo.
In that case, the real issue is that images in webp/png/gif format get served as webp/png even when no supported formats are specified, not that svg images get served as jpeg when no formats are specified. GetClientSupportedFormats always adds jpeg and png, so when GetOutputFormat determines what format to use for an originally transparent image, it will always use PNG if webp isn't supported and will never fall back to jpeg.