Updated: 12 December 2010
Table Of Contents
pammosaicknit - validate a mosaic knitting pattern
This program is part of Netpbm.
pammosaicknit helps the user create mosaic knitting patterns. The program inputs a black-and-white Netpbm image that describes a mosaic knitting pattern and outputs a color Netpbm image of the same pattern but with invalid runs shown in red.
A valid knitting pattern starts with a "black" row on the bottom and alternates "white" and "black" rows. A "black" row can contain any arrangement of black pixels but no more than three consecutive white pixels. A "white" row can contain any arrangement of white pixels but no more than three consecutive black pixels. Columns wrap horizontally, so a "white" row that both begins and ends with two black pixels is deemed to contain four consecutive black pixels. Because this is an invalid number for a "white" row, those four pixels will be recolored red in the output image.
For clarity, there are two shades of red in the output image. Dark red pixels indicate pixels that were black in the input image but which must contain one or more white pixels. Light red pixels indicate pixels that were white in the input image but which must contain one or more black pixels.
If the output image contains no red pixels, then the input image represents a valid mosaic knitting pattern.
pammosaicknit's only argument, in_netpbmfile, is the name of an image file that represents a mosaic knitting pattern. If you don't specify in_netpbmfile, the program reads the image from Standard Input.
If the input image is not a black-and-white image, pammosaicknit converts it internally to black and white by thresholding each pixel's luminosity. The output image is always a color image containing at most four colors (black, white, dark red, light red).
pammosaicknit was new in Netpbm 10.53 (December 2010).
Copyright (C) 2010 Scott Pakin, email@example.com.