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) } }
func runChannel(cmd *hadfield.Command, args []string) { i, data := 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.Adjust(i, adj, channel.Red) } if channelGreen { i = channel.Adjust(i, adj, channel.Green) } if channelBlue { i = channel.Adjust(i, adj, channel.Blue) } if channelHue { i = channel.Adjust(i, adj, channel.Hue) } if channelSaturation { i = channel.Adjust(i, adj, channel.Saturation) } if channelLightness { i = channel.Adjust(i, adj, channel.Lightness) } if channelBrightness { i = channel.Adjust(i, adj, channel.Brightness) } if channelAlpha { i = channel.Adjust(i, adj, channel.Alpha) } utils.WriteStdout(i, data) }