photoprism/thumbnails.go
2018-02-04 17:34:07 +01:00

19 lines
467 B
Go

package photoprism
import (
"github.com/disintegration/imaging"
"log"
)
func CreateThumbnail () {
src, err := imaging.Open("testdata/lena_512.png")
if err != nil {
log.Print("Open failed: %v", err)
}
// Crop the original image to 350x350px size using the center anchor.
src = imaging.CropAnchor(src, 350, 350, imaging.Center)
// Resize the cropped image to width = 256px preserving the aspect ratio.
src = imaging.Resize(src, 256, 0, imaging.Lanczos)
}