Last active
August 28, 2018 04:15
-
-
Save yoya/4f2d074d909d21451bd1bc3be4b22338 to your computer and use it in GitHub Desktop.
disintegration/imaging resize test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
go run imaging_resize.go input.png output.png