LinuxCommandLibrary

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

$ ppmshift [s] [path/to/input_file.ppm] > [path/to/output_file.ppm]
copy

SYNOPSIS

ppmshift [options] [ppmfile]

PARAMETERS

-rows shift
    Shift each row shift positions to the right. A negative value shifts to the left.

-cols shift
    Shift each column shift positions down. A negative value shifts up.

ppmfile
    The input PPM file. If not specified, it reads from standard input.

DESCRIPTION

The ppmshift command horizontally and vertically shifts the colors in a portable pixmap image. It takes an input PPM image and produces a new PPM image where each color component (red, green, blue) is independently shifted by a specified number of positions. Shifting effectively cycles the color values within each row or column. This tool is useful for creating artistic effects or manipulating color data within an image. ppmshift offers flexibility in shifting rows (horizontally) and columns (vertically) and handles wrapping of color values automatically. It's a simple but powerful way to modify the color palette of a PPM image for creative purposes. It is a part of the netpbm package.

CAVEATS

The shift values wrap around the width or height of the image, so a shift of width is the same as a shift of 0.

EXAMPLE

To shift the rows of an image 'input.ppm' by 5 positions to the right and the columns by 2 positions down, creating a new image named 'output.ppm', use the following command:
ppmshift -rows 5 -cols 2 input.ppm > output.ppm

SEE ALSO

ppm(5), pnmshift(1)

Copied to clipboard