Real-image posters: scale to the box's pixel size
Ghostty shows an image smaller than its placement at its own size, so library posters (Radarr's poster-500 is 333x500, not 500x750) came out smaller than the 426x640 remote ones. Images are now scaled (bilinear) to exactly cols*cellWidth x rows*cellHeight pixels before upload, and library titles use the original poster for real images. The disk cache stores posters as decoded (JPEG) instead of the possibly large originals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,9 +6,9 @@ import (
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
_ "image/gif" // poster formats
|
||||
_ "image/jpeg" // (Radarr and Sonarr store the provider's bytes under a .jpg name,
|
||||
_ "image/png" // whatever format they are in)
|
||||
_ "image/gif" // poster formats (Radarr and Sonarr store the provider's bytes
|
||||
"image/jpeg" // under a .jpg name, whatever format they are in); jpeg also
|
||||
_ "image/png" // encodes the copies kept on disk
|
||||
|
||||
_ "golang.org/x/image/webp"
|
||||
"net/url"
|
||||
@@ -563,7 +563,12 @@ func (a *App) loadCover(ref coverRef, done func(*image.RGBA, error)) {
|
||||
img, err = decodeCover(data, maxHeight)
|
||||
}
|
||||
if err == nil {
|
||||
a.disk.writePoster(ref.key, large, data)
|
||||
// Stored as decoded (at most maxHeight tall), not as downloaded:
|
||||
// originals can be megabytes.
|
||||
var shrunk bytes.Buffer
|
||||
if jpeg.Encode(&shrunk, img, &jpeg.Options{Quality: 90}) == nil {
|
||||
a.disk.writePoster(ref.key, large, shrunk.Bytes())
|
||||
}
|
||||
}
|
||||
}
|
||||
a.post(func() {
|
||||
|
||||
Reference in New Issue
Block a user