Example #1
0
File: hxl.go Project: hawx/img
func runHxl(cmd *hadfield.Command, args []string) {
	i, data := utils.ReadStdin()

	if hxlCols > 0 {
		hxlWidth = utils.SizeForCols(i, hxlCols).W
	}

	i = pixelate.Hxl(i, hxlWidth)
	utils.WriteStdout(i, data)
}
Example #2
0
File: pixelate.go Project: hawx/img
func runPixelate(cmd *hadfield.Command, args []string) {
	i, data := utils.ReadStdin()

	// Default
	style := pixelate.FITTED

	if pixelateCrop {
		style = pixelate.CROPPED
	}

	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, style)
	utils.WriteStdout(i, data)
}