예제 #1
0
파일: img-lomo.go 프로젝트: hawx/img-ext
func main() {
	var (
		long  = flag.Bool("long", false, "")
		short = flag.Bool("short", false, "")
		usage = flag.Bool("usage", false, "")
	)

	os.Args = utils.GetOutput(os.Args)
	flag.Parse()

	if *long {
		fmt.Println(
			"  Applies a simple lomo effect to the image, boosting its saturation and\n" +
				"  composing with a black edged mask.",
		)

	} else if *short {
		fmt.Println("applies a simple lomo effect to the image")

	} else if *usage {
		fmt.Println("lomo [options]")

	} else {
		img, data := utils.ReadStdin()

		// http://the.taoofmac.com/space/blog/2005/08/23/2359
		img = contrast.Adjust(img, 1.2)
		img = channel.Adjust(img, utils.Multiplier(1.2), channel.Saturation)
		img = blend.Multiply(img, maskFor(img))

		utils.WriteStdout(img, data)
	}
}
예제 #2
0
파일: contrast.go 프로젝트: hawx/img
func runContrast(cmd *hadfield.Command, args []string) {
	i, data := utils.ReadStdin()

	if contrastSigmoidal {
		i = contrast.Sigmoidal(i, contrastFactor, contrastMidpoint)
	} else if contrastLinear {
		i = contrast.Linear(i, contrastFactor)
	} else {
		i = contrast.Adjust(i, contrastFactor)
	}

	utils.WriteStdout(i, data)
}