ppmshift
Reorder color components in a PPM image
TLDR
Shift the lines in the input image by a randomized amount not exceeding s to the left or to the right
SYNOPSIS
ppmshift [-redshift shiftval] [-greenshift shiftval] [-blueshift shiftval] [ppmfile]
PARAMETERS
-redshift shiftval
shiftval is an integer that specifies the amount by which the red component of each pixel should be shifted. Positive values increase the red intensity, while negative values decrease it.
-greenshift shiftval
shiftval is an integer that specifies the amount by which the green component of each pixel should be shifted. Positive values increase the green intensity, while negative values decrease it.
-blueshift shiftval
shiftval is an integer that specifies the amount by which the blue component of each pixel should be shifted. Positive values increase the blue intensity, while negative values decrease it.
ppmfile
The path to the input PPM image file. If not specified, ppmshift reads the image data from standard input.
DESCRIPTION
ppmshift is a command-line utility from the Netpbm suite designed for basic color manipulation of Portable Pixmap (PPM) images. It allows users to adjust the red, green, and blue color components of an image by specified integer amounts. This shifting can be used for various purposes, such as correcting color casts, subtly altering the mood of an image, or creating simple special effects. The shifts are applied uniformly across all pixels in the image. If a color component value, after shifting, falls below 0 or exceeds the image's maximum color value (maxval), it is automatically clipped to 0 or maxval respectively, preventing values from going out of range. ppmshift operates on a single input PPM image, reading from standard input if no file is specified, and always writes the modified image to standard output.
CAVEATS
Color component values are clipped to 0 and the image's maxval. This means that if a shift would push a color beyond these limits, the color will be clamped, potentially leading to loss of detail in very dark or very bright areas.
ppmshift only operates on PPM (Portable Pixmap) format images. For grayscale (PGM) images, use pgmshift.
This command performs a simple linear shift. For more complex color adjustments like gamma correction or mixing, other Netpbm tools or more advanced image editors should be used.
HISTORY
ppmshift is a component of the comprehensive Netpbm toolkit, which is a collection of graphics programs and a programming library for handling graphical images. Netpbm itself evolved from the PBMPlus package, originally written by Jef Poskanzer in the late 1980s. PBMPlus revolutionized command-line image manipulation by introducing a simple, pipe-friendly format (PBM, PGM, PPM) that allowed chaining multiple image processing tools together. ppmshift, like many other Netpbm tools, adheres to this philosophy, enabling users to perform specific, atomic operations on images, often as part of a larger script or pipeline. Its design reflects the Unix philosophy of doing one thing well.