This project is a small Node.js CLI script that generates patterned PNG images.
It uses:
index.js creates an image pattern and writes the result to:
output/<shape>_1px_<width>x<height>.png
When a mask is applied, the output file is named:
output/<shape>_1px_<width>x<height>_<mask>_<mask-color>.png
Run the script with width and height values (and optional shape/mask options):
node index.js -w 256 -h 256 -s checkersBoth -w (width) and -h (height) are required and must be positive integers. The script will exit with a non-zero status and print an error message if they are missing or invalid.
Available shapes:
checkers(default)stripesdiamondscircle
If an unrecognized shape is provided, the script will print a warning and default to checkers.
Example output file:
output/checkers_1px_256x256.png
A mask can be applied over the generated image using --mask. Pixels outside the mask area are replaced with the configured mask color.
node index.js -w 256 -h 256 -s checkers --mask circle --mask-color blackAvailable masks:
circle— circular mask centered in the image, sized to fit the shortest dimensiondiamond— diamond mask centered in the image, sized to fit the shortest dimension
Available mask colors (area outside the mask):
black(default)whitetransparent
Example output file:
output/checkers_1px_256x256_circle_black.png