Example #1
0
func runPxl(cmd *Command, args []string) {
	i := utils.ReadStdin()

	triangle := pixelate.BOTH
	if pxlLeft {
		triangle = pixelate.LEFT
	}
	if pxlRight {
		triangle = pixelate.RIGHT
	}

	if pxlRows > 0 && pxlCols > 0 {
		pxlSize = utils.SizeForRowsAndCols(i, pxlRows, pxlCols)
	} else if pxlRows > 0 {
		pxlSize = utils.SizeForRows(i, pxlRows)
	} else if pxlCols > 0 {
		pxlSize = utils.SizeForCols(i, pxlCols)
	}

	if pxlAlias {
		i = pixelate.AliasedPxl(i, pxlSize, triangle)
	} else {
		i = pixelate.Pxl(i, pxlSize, triangle)
	}

	utils.WriteStdout(i)
}
Example #2
0
func runPixelate(cmd *Command, args []string) {
	i := utils.ReadStdin()

	if pixelateRows > 0 && pixelateCols > 0 {
		pixelateSize = utils.SizeForRowsAndCols(i, pixelateRows, pixelateCols)
	} else if pixelateRows > 0 {
		pixelateSize = utils.SizeForRows(i, pixelateRows)
	} else if pixelateCols > 0 {
		pixelateSize = utils.SizeForCols(i, pixelateCols)
	}

	i = pixelate.Pixelate(i, pixelateSize)
	utils.WriteStdout(i)
}