greyscale

command module
v0.0.0-...-8254a1b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 1 Imported by: 0

README

▧▩▤▥▦ greyscale

A command-line tool for interrogating greyscale images.

An animation of the greyscale command running

Usage

greyscale has a few commands and subcommands:

  • greyscale list lists the 16 grey names that the show commands use
  • greyscale show info shows details about the image specified by the --infile flag
  • greyscale show colors shows a histogram of the greys that make up the --infile image
  • greyscale pick show 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:

  • --nonzero filters out any greys that have 0% representation in the image
  • --csv skips the fancy table rendering and outputs comma-separated values
  • --top n only shows the histogram lines for the n most frequent greys in the image
  • --pixels x,y:n filters the input to only include pixels starting at x,y and including n pixels only. If the value of n would extend the scope beyond the end of the image, it will include pixels from x,y to the end of the image.

Sample Images

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

Installation

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@latest

Notes

It'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.

Documentation

Overview

Copyright © 2024 Rob Duarte <me@robduarte.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL