Skip to content

Instantly share code, notes, and snippets.

@yoya
Last active August 28, 2018 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoya/4f2d074d909d21451bd1bc3be4b22338 to your computer and use it in GitHub Desktop.
Save yoya/4f2d074d909d21451bd1bc3be4b22338 to your computer and use it in GitHub Desktop.
disintegration/imaging resize test
package main
import (
"flag"
"github.com/disintegration/imaging"
"image/png"
"os"
)
func main() {
flag.Parse()
inputname := flag.Arg(0)
outputname := flag.Arg(1)
ifd, _:= os.Open(inputname)
ofd, _ := os.Create(outputname)
image, _ := png.Decode(ifd)
width, height := 500, 375
// filter := imaging.Lanczos
// filter := imaging.Linear
// filter := imaging.MitchellNetravali
filter := imaging.CatmullRom
image = imaging.Resize(image, width, height, filter)
png.Encode(ofd, image)
}
@yoya
Copy link
Author

yoya commented Aug 26, 2018

go run imaging_resize.go input.png output.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment