2016-11-18 07:36:36 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2017-11-18 00:03:21 +00:00
|
|
|
"code.ivysaur.me/thumbnail"
|
2016-11-18 07:36:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
width := flag.Int("Width", 100, "Width")
|
|
|
|
height := flag.Int("Height", 100, "Height")
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
if flag.NArg() != 1 {
|
|
|
|
fmt.Fprintf(os.Stderr, "Expected one filename")
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
fname := flag.Arg(0)
|
|
|
|
|
2018-06-09 05:18:07 +00:00
|
|
|
th := thumbnail.NewThumbnailer(*width, *height)
|
|
|
|
data, err := th.RenderFile(fname)
|
2016-11-18 07:36:36 +00:00
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintln(os.Stderr, err.Error())
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Print(string(data))
|
|
|
|
os.Exit(0)
|
|
|
|
|
|
|
|
}
|