Viewer zoom and sharper tiles

Mouse wheel, trackpad and two-finger pinch zoom in the album viewer,
up to one image pixel per device pixel; drag pans while zoomed and
only the visible tiles of the needed level are loaded.

Default WebP quality raised to top 90, mid 88, low 88, with
smart_subsample for WebP tiles and the seed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
lucioandClaude Opus 5.5 committed 2026-11-04 20:56:12 -08:00
1 parent ae898a2787
commit aaf7cafdf9
9 files changed
+302 -18

No files matched your search

+5 -1
View File
@@ -113,11 +113,15 @@ func New(ctx context.Context, cfg *config.Config) (*Processor, error) {
}
img := cfg.Images
keySum := sha256.Sum256(key)
format := img.Format
if format == "webp" {
format += "+smart_subsample"
}
fingerprint := strings.Join([]string{
processorVersion,
"tile=" + strconv.Itoa(img.TileSize),
"overlap=" + strconv.Itoa(img.Overlap),
"format=" + img.Format,
"format=" + format,
fmt.Sprintf("q=%d,%d,%d", img.Quality.Top, img.Quality.Mid, img.Quality.Low),
"min_levels=" + strconv.Itoa(img.MinLevels),
"seed=" + strconv.Itoa(img.SeedPx),
+3 -3
View File
@@ -107,7 +107,7 @@ func (p *Processor) renderOG(ctx context.Context, job *Job) (*Record, error) {
}
final := filepath.Join(p.OGDir, job.Hash+".jpg")
tmp := fsutil.TempName(final) + ".jpg"
if err := p.vips.Run(ctx, "thumbnail", prepared, tmp+p.vips.SaveOptions(OGQuality),
if err := p.vips.Run(ctx, "thumbnail", prepared, tmp+p.vips.SaveOptions("jpeg", OGQuality),
strconv.Itoa(OGWidth), "--height", strconv.Itoa(OGHeight), "--crop", "centre"); err != nil {
_ = os.Remove(tmp)
return nil, err
@@ -323,7 +323,7 @@ func (p *Processor) resize(ctx context.Context, src, dst string, from, to [2]int
func (p *Processor) seed(ctx context.Context, src, work string) (string, error) {
out := filepath.Join(work, "seed."+p.images.Format)
if err := p.vips.Run(ctx, "thumbnail", src, out+p.vips.SaveOptions(p.images.Quality.Low),
if err := p.vips.Run(ctx, "thumbnail", src, out+p.vips.SaveOptions(p.images.Format, p.images.Quality.Low),
strconv.Itoa(p.images.SeedPx), "--height", strconv.Itoa(p.images.SeedPx)); err != nil {
return "", fmt.Errorf("seed: %w", err)
}
@@ -373,7 +373,7 @@ func (p *Processor) cutLevel(ctx context.Context, hash, src, stage string, level
"--depth", "one",
"--tile-size", strconv.Itoa(p.images.TileSize),
"--overlap", strconv.Itoa(p.Overlap()),
"--suffix", ext+p.vips.SaveOptions(quality)); err != nil {
"--suffix", ext+p.vips.SaveOptions(p.images.Format, quality)); err != nil {
return Level{}, err
}
dir, err := levelDir(base + "_files")
+4 -1
View File
@@ -99,7 +99,10 @@ func (v *Vips) Run(ctx context.Context, args ...string) error {
return nil
}
func (v *Vips) SaveOptions(quality int) string {
func (v *Vips) SaveOptions(format string, quality int) string {
if format == "webp" {
return "[Q=" + strconv.Itoa(quality) + ",smart_subsample=true," + v.Strip + "]"
}
return "[Q=" + strconv.Itoa(quality) + "," + v.Strip + "]"
}