AVIF - image format unsupported

Paul Webster <Paul.Webster.akxkun-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]> Tue, 24 May 2022 13:20:05 +0000
Newsgroups gmane.music.equipment.slimdevices.devel
Organization Logitech Squeezebox Forums
Message-ID <[email protected]>
I came across an issue with some station logos not being displayed.

The reason is that they were of type image/avif - which is not supported
by LMS.

An example

Code:
--------------------
    
  [22-05-24 13:43:37.4116] Slim::Web::Graphics::artworkRequest (83) Artwork request: imageproxy/https://images.feierfreund.de/files/streams/ff_stream-tile_karneval.png?auto=format&w=180&h=180&dpr=2/image_1024x1024_f.png
  [22-05-24 13:43:37.4124] Slim::Web::Graphics::artworkRequest (123)   Resize specification: 1024x1024_f.png
  [22-05-24 13:43:37.4129] Slim::Web::ImageProxy::getImage (110) Get artwork for URL: imageproxy/https://images.feierfreund.de/files/streams/ff_stream-tile_karneval.png?auto=format&w=180&h=180&dpr=2/image_1024x1024_f.png
  [22-05-24 13:43:37.4181] Slim::Web::ImageProxy::__ANON__ (151) Found URL to get artwork: https://images.feierfreund.de/files/streams/ff_stream-tile_karneval.png?auto=format&w=180&h=180&dpr=2
  [22-05-24 13:43:37.6300] Slim::Web::ImageProxy::_gotArtwork (217) Received artwork of type image/avif and 18196 bytes length
  [22-05-24 13:43:37.6314] Slim::Utils::ImageResizer::sync_resize (148) Error resizing : Can't resize unknown type, magic: "\0\0\0 ftyp"
  
  [22-05-24 13:43:37.6322] Slim::Web::ImageProxy::__ANON__ (318)   Resize failed, returning 500
  [22-05-24 13:43:37.6327] Slim::Web::ImageProxy::__ANON__ (319) Artwork resize for imageproxy/https://images.feierfreund.de/files/streams/ff_stream-tile_karneval.png?auto=format&w=180&h=180&dpr=2/image_1024x1024_f.png failed
  
--------------------


The parameters on the end of their URL were resulting in the remote site
re-encoding the original file (similar to LMS imageresizer) and
returning it as image/avif so I modified my plugin to strip them from
the URL before using it ... and it worked. While this is OK for me for
now, I can imagine that avif might appear from other sources in the
future so might need handling in LMS and converting to a format handled
by the players/controllers.

Note - if it is supported then might need to check more magic bytes
anyway - see
https://github.com/bigcat88/pillow_heif/issues/8



Paul Webster
author of \"now playing\" plugins covering radio france (fip etc),
planetradio (bauer - kiss, absolute, scala, jazzfm etc), kcrw, abc
australia and cbc/radio-canada
and, via the extra \"radio now playing\" plugin lots more - see
https://forums.slimdevices.com/showthread.php?115201-announce-radio-now-playing-plugin
------------------------------------------------------------------------
Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=116409