예제 #1
0
파일: collage.go 프로젝트: loov/sketchure
func main() {
	flag.Parse()

	dir := flag.Arg(0)
	if dir == "" {
		fmt.Fprintf(os.Stderr, "Images not specified.")
		flag.Usage()
		os.Exit(1)
	}

	files, err := ioutil.ReadDir(dir)
	check(err)

	w, h := *width, *height
	collage := image.NewRGBA(image.Rect(0, 0, w*2, h*len(files)))
	draw.Draw(collage, collage.Bounds(), image.NewUniform(color.RGBA{0xFF, 0xFF, 0xFF, 0xFF}), image.Point{}, draw.Src)

	for i, file := range files {
		fmt.Println("Processing ", file.Name())
		m, err := ycbcr.FromFile(filepath.Join(dir, file.Name()))
		check(err)

		drawcell(collage, m, 0, i, w, h)
		process(m)
		drawcell(collage, m, 1, i, w, h)
	}

	check(ycbcr.ToFile(*output, collage))
}
예제 #2
0
파일: main.go 프로젝트: loov/sketchure
func main() {
	flag.Parse()
	files := flag.Args()

	if len(files) == 0 {
		fmt.Fprintf(os.Stderr, "Images not specified.")
		flag.Usage()
		os.Exit(1)
	}

	for _, filename := range files {
		m, err := ycbcr.FromFile(filename)
		check(err)
		process(m)

		name := filepath.Join(*outdir, filepath.Base(filename))
		ext := filepath.Ext(name)

		name = name[:len(name)-len(ext)] + *suffix + ext
		ycbcr.ToFile(name, m)
	}
}