navidrome/core/artwork
Deluan Quintão b38054b29c
perf(artwork): faster image resize + update gen2brain/webp to v0.6.0 (#5652)
* fix(artwork): convert decoded images to a fast-path type before resizing

x/image/draw's CatmullRom scaler only has optimized paths for *image.RGBA,
*image.NRGBA, *image.Gray and *image.YCbCr. Other concrete types — notably
*image.NYCbCrA (from WebP) and *image.Paletted (indexed PNGs) — fall back to
a generic per-pixel At()/RGBA() loop that is several times slower.

Convert such images to *image.RGBA once before scaling; fast-path types are
returned unchanged. This makes resize performance independent of which decoder
wins the image.Decode("webp") registration, and also speeds up indexed PNGs.

Signed-off-by: Deluan <deluan@navidrome.org>

* chore(deps): update gen2brain/webp to v0.6.0

v0.6.0 replaces the wazero WASM runtime with a self-contained
wasm2go-transpiled WebP decoder/encoder. This drops the webp -> wazero
dependency edge (wazero is still used by the plugin system) and makes the
WASM-only build path (32-bit / nodynamic) faster and far lighter on
allocations.

Signed-off-by: Deluan <deluan@navidrome.org>

* perf(artwork): defer fast-path conversion until a resize is needed

Move toFastScaleType to just before the CatmullRom.Scale call, after the
no-upscale early return. Previously the conversion ran right after decode, so a
request for a size >= the source dimensions would allocate and walk a full RGBA
copy only to discard it when resizeStaticImage returns nil. The resize path is
unchanged; the no-op path drops ~30-40% time and up to ~79% memory for large
indexed/WebP artwork.

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2026-06-22 16:33:01 -04:00
..
e2e fix(artwork): never serve artist folder images as album art (#5596) 2026-06-13 13:29:29 -04:00
animation.go feat(artwork): preserve animated image artwork during resize (#5184) 2026-03-13 18:11:12 -04:00
animation_test.go feat(artwork): preserve animated image artwork during resize (#5184) 2026-03-13 18:11:12 -04:00
artwork.go feat(ui): add cover art support for internet radio stations (#5229) 2026-03-18 18:57:33 -04:00
artwork_internal_test.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
artwork_suite_test.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
artwork_test.go Fix image stuttering (#3035) 2024-05-24 20:19:26 -04:00
benchmark_decode_test.go perf(artwork): improve image serving performance with WebP encoding and optimized pipeline (#5181) 2026-03-13 09:35:59 -04:00
benchmark_e2e_test.go chore: go fix 2026-05-28 22:13:05 -03:00
benchmark_encode_test.go perf(artwork): improve image serving performance with WebP encoding and optimized pipeline (#5181) 2026-03-13 09:35:59 -04:00
benchmark_helpers_test.go chore: go fix 2026-05-28 22:13:05 -03:00
benchmark_pipeline_test.go feat(artwork): preserve animated image artwork during resize (#5184) 2026-03-13 18:11:12 -04:00
benchmark_tag_test.go perf(artwork): improve image serving performance with WebP encoding and optimized pipeline (#5181) 2026-03-13 09:35:59 -04:00
cache_warmer.go fix(artwork): address WebP performance regression on low-power hardware (#5286) 2026-04-04 15:17:01 -04:00
cache_warmer_test.go fix(artwork): address WebP performance regression on low-power hardware (#5286) 2026-04-04 15:17:01 -04:00
image_cache.go Add lastUpdated to coverArt ids. Helps with invalidating art cache client-side. 2023-02-08 20:03:31 -05:00
library_fs.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
library_fs_test.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
reader_album.go fix(artwork): never serve artist folder images as album art (#5596) 2026-06-13 13:29:29 -04:00
reader_album_test.go fix(artwork): never serve artist folder images as album art (#5596) 2026-06-13 13:29:29 -04:00
reader_artist.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
reader_artist_test.go fix(artwork): never serve artist folder images as album art (#5596) 2026-06-13 13:29:29 -04:00
reader_disc.go fix(artwork): fix stale cache and top-level album artwork for multi-disc albums (#5457) 2026-05-04 17:26:39 -04:00
reader_disc_test.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
reader_mediafile.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
reader_playlist.go feat(ui): increase cover art size to 600px and use CatmullRom scaling 2026-03-22 14:55:14 -04:00
reader_radio.go feat(ui): add cover art support for internet radio stations (#5229) 2026-03-18 18:57:33 -04:00
reader_radio_test.go refactor(conf): replace eager dir creation with lazy Dir type (#5495) 2026-05-13 17:44:22 -03:00
reader_resized.go perf(artwork): faster image resize + update gen2brain/webp to v0.6.0 (#5652) 2026-06-22 16:33:01 -04:00
reader_resized_test.go fix(artwork): preserve animation for square thumbnails with animated images 2026-04-01 08:38:29 -04:00
sources.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
sources_internal_test.go refactor(artwork): migrate readers to storage.MusicFS and add e2e suite (#5379) 2026-04-26 18:16:14 -04:00
wire_providers.go Handle "naked" CoverArtIDs (IDs of album, mediafiles and playlists) 2022-12-28 15:31:56 -05:00