Esempio n. 1
0
func runLevelsOnChannel(cmd *Command, args []string, img image.Image,
	ch levels.Channel) image.Image {

	if levelsAuto {
		img = levels.Auto(img, ch)

	} else if levelsAutoBlack {
		img = levels.AutoBlack(img, ch)

	} else if levelsAutoWhite {
		img = levels.AutoWhite(img, ch)

	} else if utils.FlagVisited("black", cmd.Flag) {
		img = levels.SetBlack(img, ch, levelsBlack)

	} else if utils.FlagVisited("white", cmd.Flag) {
		img = levels.SetWhite(img, ch, levelsWhite)

	} else if utils.FlagVisited("curve", cmd.Flag) {
		img = levels.SetCurve(img, ch, levels.ParseCurveString(levelsCurve))
	}

	return img
}
Esempio n. 2
0
func runChannel(cmd *Command, args []string) {
	i := utils.ReadStdin()
	var adj utils.Adjuster

	if utils.FlagVisited("by", cmd.Flag) {
		adj = utils.Adder(channelBy)
	} else {
		adj = utils.Multiplier(channelRatio)
	}

	if !(channelRed || channelGreen || channelBlue || channelHue ||
		channelSaturation || channelLightness || channelBrightness || channelAlpha) {
		channelRed = true
		channelGreen = true
		channelBlue = true
	}

	if channelRed {
		i = channel.Red(i, adj)
	}
	if channelGreen {
		i = channel.Green(i, adj)
	}
	if channelBlue {
		i = channel.Blue(i, adj)
	}

	if channelHue {
		i = channel.Hue(i, adj)
	}
	if channelSaturation {
		i = channel.Saturation(i, adj)
	}
	if channelLightness {
		i = channel.Lightness(i, adj)
	}
	if channelBrightness {
		i = channel.Brightness(i, adj)
	}

	if channelAlpha {
		i = channel.Alpha(i, adj)
	}

	utils.WriteStdout(i)
}