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

+1 -1
View File
@@ -105,7 +105,7 @@ func Defaults() Config {
TileSize: 512,
Overlap: 1,
Format: "webp",
Quality: Quality{Top: 82, Mid: 85, Low: 88},
Quality: Quality{Top: 90, Mid: 88, Low: 88},
MinLevels: 6,
SeedPx: 48,
TileNames: "hashed",
+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 + "]"
}
+1 -1
View File
@@ -1 +1 @@
"use strict";(()=>{(function(r){let t={from:"Guoliang",to:"Lucio",letters:[{ch:"G",kind:"keep",shared:"M8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50",fullA:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",fullB:"M8.50 0.00L8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50L80.00 91.50",out:[{d:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00",P:79.21,j:"end"},{d:"M58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",P:73.21,j:"start"}],in:[{d:"M8.50 22.00L8.50 0.00",P:22,j:"start"},{d:"M58.00 91.50L80.00 91.50",P:22,j:"start"}],x0:0,x1:0,dot:null},{ch:"u",kind:"keep",shared:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullA:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullB:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",out:[],in:[],x0:88.8,x1:88,dot:null},{ch:"o",kind:"keep",shared:"M38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullB:"M60.00 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50L60.00 91.50",out:[{d:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50",P:60.41,j:"both"}],in:[{d:"M38.00 46.50L60.00 46.50",P:22,j:"start"},{d:"M38.00 91.50L60.00 91.50",P:22,j:"start"}],x0:159,x1:158.2,dot:null},{ch:"l",kind:"fade",d:"M8.50 0.00L8.50 100.00",x0:230.8,x1:230.8,dot:null},{ch:"i",kind:"keep",shared:"M8.50 38.00L8.50 100.00",fullA:"M8.50 38.00L8.50 100.00",fullB:"M8.50 38.00L8.50 100.00",out:[],in:[],x0:262.8,x1:227.9,dot:[0,14,17]},{ch:"a",kind:"fade",d:"M38.00 91.50L51.50 91.50L51.50 78.00L51.50 60.00L51.50 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",x0:291.6,x1:291.6,dot:null},{ch:"n",kind:"fade",d:"M51.50 100.00L51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00L8.50 100.00",x0:362.7,x1:362.7,dot:null},{ch:"g",kind:"keep",shared:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M0.00 127.50L38.00 127.50A13.50 13.50 0 0 0 51.50 114.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00",fullB:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",out:[{d:"M51.50 60.00L51.50 114.00A13.50 13.50 0 0 1 38.00 127.50L0.00 127.50",P:113.21,j:"start"}],in:[],x0:432.9,x1:256.7,dot:null}],pad:17,vbw:526.9,vbh:170,stroke:17,raysT:"translate(0.000 22.727) scale(0.7727)"},e="M47.6 70.7L71.9 61.1L71.1 58.2L45.2 62.0ZM44.9 61.5L61.2 40.9L59.1 38.8L38.5 55.1ZM38.0 54.8L41.8 28.9L38.9 28.1L29.3 52.4Z",i="http://www.w3.org/2000/svg",s=(c,w)=>{let d=document.createElementNS(i,c);for(let u in w)d.setAttribute(u,w[u]);return d},n=()=>r.matchMedia&&r.matchMedia("(prefers-reduced-motion: reduce)").matches,o=c=>Math.max(0,Math.min(1,c)),a=c=>c*c*(3-2*c),l=.5;function h(c,w){let d=0,u=0,p=null,g=0;function A(y){let b=(y-g)/w;g=y,d=d<u?Math.min(u,d+b):Math.max(u,d-b),c(d),p=d===u?null:requestAnimationFrame(A)}function v(y){if(u=y,n()){d=y,c(d);return}p===null&&(g=performance.now(),p=requestAnimationFrame(A))}return{play:()=>v(1),reverse:()=>v(0),toggle:()=>v(u?0:1),set:y=>{cancelAnimationFrame(p),p=null,u=d=y,c(d)},stop:()=>{cancelAnimationFrame(p),p=null},get t(){return d}}}function m(c,w,d,u){let p=o(u)*w;if(c.style.visibility=p<.05?"hidden":"visible",d==="both"){let g=p/2;c.setAttribute("stroke-dasharray",g.toFixed(2)+" "+Math.max(0,w-2*g).toFixed(2)+" "+g.toFixed(2)),c.setAttribute("stroke-dashoffset","0")}else d==="end"?(c.setAttribute("stroke-dasharray",p.toFixed(2)+" "+(2*w+20).toFixed(2)),c.setAttribute("stroke-dashoffset",(-(w-p)).toFixed(2))):(c.setAttribute("stroke-dasharray",p.toFixed(2)+" "+(2*w+20).toFixed(2)),c.setAttribute("stroke-dashoffset","0"))}function M(c,w={}){let d=Object.assign({trigger:"hover",color:"currentColor",rays:"#FFF3CF",duration:450,autoDelay:1800},w),u=s("svg",{viewBox:"0 0 "+t.vbw+" "+t.vbh,role:"img","aria-label":"Guoliang Chen, Lucio"});u.style.display="block",u.style.width="100%",u.style.height="auto";let p=sLine truncated
"use strict";(()=>{(function(r){let t={from:"Guoliang",to:"Lucio",letters:[{ch:"G",kind:"keep",shared:"M8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50",fullA:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",fullB:"M8.50 0.00L8.50 22.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L58.00 91.50L80.00 91.50",out:[{d:"M80.00 8.50L58.00 8.50L22.00 8.50A13.50 13.50 0 0 0 8.50 22.00",P:79.21,j:"end"},{d:"M58.00 91.50A13.50 13.50 0 0 0 71.50 78.00L71.50 56.00L41.50 56.00",P:73.21,j:"start"}],in:[{d:"M8.50 22.00L8.50 0.00",P:22,j:"start"},{d:"M58.00 91.50L80.00 91.50",P:22,j:"start"}],x0:0,x1:0,dot:null},{ch:"u",kind:"keep",shared:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullA:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",fullB:"M8.50 38.00L8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00L51.50 38.00",out:[],in:[],x0:88.8,x1:88,dot:null},{ch:"o",kind:"keep",shared:"M38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullB:"M60.00 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50L60.00 91.50",out:[{d:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50",P:60.41,j:"both"}],in:[{d:"M38.00 46.50L60.00 46.50",P:22,j:"start"},{d:"M38.00 91.50L60.00 91.50",P:22,j:"start"}],x0:159,x1:158.2,dot:null},{ch:"l",kind:"fade",d:"M8.50 0.00L8.50 100.00",x0:230.8,x1:230.8,dot:null},{ch:"i",kind:"keep",shared:"M8.50 38.00L8.50 100.00",fullA:"M8.50 38.00L8.50 100.00",fullB:"M8.50 38.00L8.50 100.00",out:[],in:[],x0:262.8,x1:227.9,dot:[0,14,17]},{ch:"a",kind:"fade",d:"M38.00 91.50L51.50 91.50L51.50 78.00L51.50 60.00L51.50 46.50L38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",x0:291.6,x1:291.6,dot:null},{ch:"n",kind:"fade",d:"M51.50 100.00L51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00L8.50 100.00",x0:362.7,x1:362.7,dot:null},{ch:"g",kind:"keep",shared:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",fullA:"M0.00 127.50L38.00 127.50A13.50 13.50 0 0 0 51.50 114.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00",fullB:"M38.00 91.50A13.50 13.50 0 0 0 51.50 78.00L51.50 60.00A13.50 13.50 0 0 0 38.00 46.50L22.00 46.50A13.50 13.50 0 0 0 8.50 60.00L8.50 78.00A13.50 13.50 0 0 0 22.00 91.50L38.00 91.50",out:[{d:"M51.50 60.00L51.50 114.00A13.50 13.50 0 0 1 38.00 127.50L0.00 127.50",P:113.21,j:"start"}],in:[],x0:432.9,x1:256.7,dot:null}],pad:17,vbw:526.9,vbh:170,stroke:17,raysT:"translate(0.000 22.727) scale(0.7727)"},e="M47.6 70.7L71.9 61.1L71.1 58.2L45.2 62.0ZM44.9 61.5L61.2 40.9L59.1 38.8L38.5 55.1ZM38.0 54.8L41.8 28.9L38.9 28.1L29.3 52.4Z",i="http://www.w3.org/2000/svg",s=(d,x)=>{let c=document.createElementNS(i,d);for(let u in x)c.setAttribute(u,x[u]);return c},n=()=>r.matchMedia&&r.matchMedia("(prefers-reduced-motion: reduce)").matches,o=d=>Math.max(0,Math.min(1,d)),a=d=>d*d*(3-2*d),h=.5;function l(d,x){let c=0,u=0,f=null,g=0;function A(y){let b=(y-g)/x;g=y,c=c<u?Math.min(u,c+b):Math.max(u,c-b),d(c),f=c===u?null:requestAnimationFrame(A)}function v(y){if(u=y,n()){c=y,d(c);return}f===null&&(g=performance.now(),f=requestAnimationFrame(A))}return{play:()=>v(1),reverse:()=>v(0),toggle:()=>v(u?0:1),set:y=>{cancelAnimationFrame(f),f=null,u=c=y,d(c)},stop:()=>{cancelAnimationFrame(f),f=null},get t(){return c}}}function m(d,x,c,u){let f=o(u)*x;if(d.style.visibility=f<.05?"hidden":"visible",c==="both"){let g=f/2;d.setAttribute("stroke-dasharray",g.toFixed(2)+" "+Math.max(0,x-2*g).toFixed(2)+" "+g.toFixed(2)),d.setAttribute("stroke-dashoffset","0")}else c==="end"?(d.setAttribute("stroke-dasharray",f.toFixed(2)+" "+(2*x+20).toFixed(2)),d.setAttribute("stroke-dashoffset",(-(x-f)).toFixed(2))):(d.setAttribute("stroke-dasharray",f.toFixed(2)+" "+(2*x+20).toFixed(2)),d.setAttribute("stroke-dashoffset","0"))}function L(d,x={}){let c=Object.assign({trigger:"hover",color:"currentColor",rays:"#FFF3CF",duration:450,autoDelay:1800},x),u=s("svg",{viewBox:"0 0 "+t.vbw+" "+t.vbh,role:"img","aria-label":"Guoliang Chen, Lucio"});u.style.display="block",u.style.width="100%",u.style.height="auto";let f=sLine truncated