pic2graph
Convert image data to graph data
SYNOPSIS
pic2graph [options] [imagefile]
PARAMETERS
-width
Specifies the width of the output graph in characters.
-height
Specifies the height of the output graph in characters.
-invert
Inverts the pixel values (black becomes white, and vice versa).
-density
Defines the set of characters used to represent different intensity levels, from darkest to lightest. Example: `-density " .:-=+*#%@"`.
-xasp
Sets the x aspect ratio. Float number.
-yasp
Sets the y aspect ratio. Float number.
DESCRIPTION
The `pic2graph` command is a utility that transforms image data into ASCII-based graphs or data plots suitable for display in a terminal or printing. It analyzes the pixel values of an image file (typically in formats like PPM, PGM, or PBM) and generates a corresponding output representation using ASCII characters. The intensity or color values of pixels are mapped to different ASCII characters, with darker pixels often represented by denser characters and lighter pixels by sparser characters. This allows users to visualize image data in environments where graphical displays are unavailable or impractical. The command provides options to adjust the size and aspect ratio of the output, the characters used for plotting, and whether to invert the pixel values. It's often used for quick data analysis, generating visual representations for text-based reports, or for artistic purposes.
The output is intended for simple visualiztion, for precise analysis of the image, it is best to use specialized tools.
CAVEATS
The quality of the resulting graph depends heavily on the image resolution and the chosen density characters. It is best used with grayscale images. Color information is usually lost or simply ignored.
FILE FORMATS
pic2graph generally expects input images in a simple, uncompressed format like Portable Pixmap Format (PPM), Portable Graymap Format (PGM), or Portable Bitmap Format (PBM). These formats are easy to parse and manipulate, making them suitable for simple command-line tools. If your image is in a different format (JPEG, PNG, etc.), you'll need to convert it to PPM, PGM, or PBM first, usually using a tool like `convert` from the ImageMagick suite.
Example: `convert input.jpg output.ppm`
SEE ALSO
convert(1), ppm(5), pgm(5), pbm(5)