diff --git a/collage/collage.go b/collage/collage.go index c29c0f3..12064a0 100644 --- a/collage/collage.go +++ b/collage/collage.go @@ -11,7 +11,6 @@ import ( "io/fs" "github.com/disintegration/imaging" - "go.oneofone.dev/resize" ) type Dimension struct { @@ -65,13 +64,13 @@ func Make(req *Request, source fs.FS, output io.Writer) error { } destRect := FrameTranslate(req.Aspect, req.Dimension, photo.Frame).ToImgRect() - resizedImg := resize.Resize(uint(destRect.Dx()), uint(destRect.Dy()), croppedImage, resize.Lanczos3) + resizedImg := imaging.Resize(croppedImage, destRect.Dx(), destRect.Dy(), imaging.Lanczos) draw.Draw(canvas, destRect, resizedImg, image.Point{0, 0}, draw.Src) } - var opt jpeg.Options - opt.Quality = 100 - return jpeg.Encode(output, canvas, &opt) + return jpeg.Encode(output, canvas, &jpeg.Options{ + Quality: 100, + }) } func FrameTranslate(resolution Dimension, frameSize Dimension, frame Rectangle) Rectangle { diff --git a/go.mod b/go.mod index cff588a..150e304 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.22 require ( github.com/disintegration/imaging v1.6.2 go.balki.me/anyhttp v0.3.0 - go.oneofone.dev/resize v1.0.1 ) require golang.org/x/image v0.1.0 // indirect diff --git a/go.sum b/go.sum index 3611a6a..742f545 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,6 @@ github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44am github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.balki.me/anyhttp v0.3.0 h1:WtBQ0rnkg567sX/O4ij/+qBbdCIUt5VURSe718sITBY= go.balki.me/anyhttp v0.3.0/go.mod h1:JhfekOIjgVODoVqUCficjpIgmB3wwlB7jhN0eN2EZ/s= -go.oneofone.dev/resize v1.0.1 h1:HjpVar/4pxMGrjO44ThaMX1Q5UOBw0KxzbxxRDZPQuA= -go.oneofone.dev/resize v1.0.1/go.mod h1:zGFmn7q4EUZVlnDmxqf+b0mWpxsTt0MH2yx6ng8tpq0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= diff --git a/web/choose.js b/web/choose.js index ab707ab..6987f78 100644 --- a/web/choose.js +++ b/web/choose.js @@ -43,7 +43,7 @@ function main() { loadPhotosBtn.onclick = () => loadPhotos() makeCollageBtn.onclick = () => gotoCollage() - /** @type HTMLImageElement[] */ + /** @type HTMLCollectionOf */ const selectedPhotos = selectedPhotosDiv.getElementsByTagName("img") for (const img of selectedPhotos) { img.onclick = () => { @@ -110,7 +110,7 @@ function loadPhotos() { albumPhotosDiv.appendChild(img) } - /** @type HTMLImageElement[] */ + /** @type HTMLCollectionOf */ const photoImgs = albumPhotosDiv.children for(const photo of photoImgs) { photo.onclick = () => { @@ -124,7 +124,7 @@ function loadPhotos() { } function gotoCollage() { - /** @type HTMLImageElement[] */ + /** @type HTMLCollectionOf */ const selectedPhotos = selectedPhotosDiv.getElementsByTagName("img") /** @type String[] */ const photoUrls = [];