A command-line tool for interrogating greyscale images.
greyscale has a few commands and subcommands:
greyscale listlists the 16 grey names that theshowcommands usegreyscale show infoshows details about the image specified by the--infileflaggreyscale show colorsshows a histogram of the greys that make up the--infileimagegreyscale pickshow the grey color (0-255 or HTML hex string) at a given pixel
The show info command's output can be filtered using --dimensions, --width, or --height.
This can be useful for piping a single piece of information to another command.
show colors has several optional flags:
--nonzerofilters out any greys that have 0% representation in the image--csvskips the fancy table rendering and outputs comma-separated values--top nonly shows the histogram lines for the n most frequent greys in the image--pixels x,y:nfilters the input to only include pixels starting atx,yand includingnpixels only. If the value ofnwould extend the scope beyond the end of the image, it will include pixels fromx,yto the end of the image.
There are a number of sample images in the samples folder. The best image to test with is 8bitgreyscale.png. Some images are included to show how other colorspaces are displayed by greyscale show info.
Worthy of note is the difference between 8bitgreyscale.png and 32bitgreyscale.png. Both files look the same visually, but the latter has some slight variation in the grey squares, which is visible in the histogram shown by greyscale show colors
The easiest way to install is to download the appropriate archive file from the Releases page, place the greyscale binary somewhere in your path, and run it from your terminal (eg: Terminal.app in MacOS or Windows Terminal)
OR If you have go installed you can clone this repo and run mkdir -p ./bin && make build
OR If you want to use go install instead, you can run the following command while making sure to use the latest version number:
go install -ldflags="-X 'github.com/rahji/greyscale/cmd.version=1.0.1'" github.com/rahji/greyscale@latestIt's important to realize that greyscale assumes your image is actually
greyscale. You can run it against a color image. It just won't produce useful
results.
