printimg is a set of command-line tools for manipulating images.
-
pimprints images to the terminal in an ANSI-encoded fashion. It supports reading images from the filesystem or using piped image data. -
kpimprints images to the terminal using the Kitty Graphics Protocol. It supports reading images from the filesystem or using piped image data. -
rimreads images from the filesystem and allows you to pipe them into another program. -
wimwrites piped image data to the filesystem -
istatsprints metadata of a piped image. Currently that is only the resolution -
blankcreates a new image with a specified resolution and, optionally, a background color. -
rectdraws a rectangle -
linedraws a line -
circledraws a circle -
cropcrops an image -
reszresizes an image -
iover: overlay an image on top of another one:rim C_Logo.png | iover 100 100 100 100 grass.png | pim -
imul: multiply two images (aka apply a mask):rim C_Logo.png | imul mask.png | pim- If you want to generate a mask also using printimg you can use
wim -:rim C_Logo.png | imul <(blank 860 1008 '#ff0000' | circle 200 200 200 '#ffffff' | wim -) | pim
- If you want to generate a mask also using printimg you can use
blank 400 400 #ff0000 | rect 100 100 100 100 #00ff00 | pim
Create a 400x400 image filled with red, with a green rectangle at (100, 100)
istats C_Logo.png
rim C_Logo.png | istats
Get resolution of C_Logo.png
rim C_Logo.png | rect 100 100 100 100 #ff0000 | pim
Read C_Logo.png, draw a red 100-pixel square at coordinates (100, 100), and print it.
rim C_Logo.png | rect 100 100 100 100 #ff0000 | wim out.png
Same as the above command, but writes the result to out.png. Note that no matter the file extension, it will be encoded in a PNG format. Also note that, although pim prints images in a reduced resolution, the manipulations are done at full scale, as can be observed by using a traditional image viewer. If you don't want to lose resolution and your terminal supports the Kitty Graphics Protocol, you can use kpim instead of pim
$ cc -o nob nob.c
$ ./nob --parallelize