LinuxCommandLibrary

pgmtexture

Create texture patterns as a PGM image

TLDR

Extract textural features from a PGM image

$ pgmtexture [path/to/image.pgm] > [path/to/output.pgm]
copy

Specify the distance parameter for the feature extraction algorithm
$ pgmtexture -d [distance] [path/to/image.pgm] > [path/to/output.pgm]
copy

SYNOPSIS

pgmtexture -width N -height N -texture texturefile [-xtexture X] [-ytexture Y] [-random | -seed N] [-xrandom X] [-yrandom Y] [-xrandomstep X] [-yrandomstep Y] [-invert] [-halftonemap halftonefile] [-comment text]

PARAMETERS

-width N
    Sets the width of the output PGM image in pixels.

-height N
    Sets the height of the output PGM image in pixels.

-texture texturefile
    Specifies the PGM file to use as the texture map.

-xtexture X
    Sets the initial X-offset for texture placement when tiling.

-ytexture Y
    Sets the initial Y-offset for texture placement when tiling.

-random
    Enables random pixel selection from the texture map instead of tiling.

-seed N
    Uses a specific seed for random generation, ensuring reproducibility. Implies -random.

-xrandom X
    Sets the X-offset for random texture selection within the map.

-yrandom Y
    Sets the Y-offset for random texture selection within the map.

-xrandomstep X
    Defines the horizontal step for random texture selection.

-yrandomstep Y
    Defines the vertical step for random texture selection.

-invert
    Inverts the pixel values of the texture map before application (black to white, vice-versa).

-halftonemap halftonefile
    Applies halftoning using the specified PGM file as a halftone map.

-comment text
    Adds a comment string to the header of the output PGM file.

DESCRIPTION

pgmtexture is a utility from the Netpbm package that generates a grayscale (PGM) image based on a provided texture map. It takes a smaller PGM image as the texture source and "paints" it onto a larger output image of specified dimensions. The command allows for various texture application methods, including tiling, random placement, and halftoning, providing flexibility in creating textured images. It's often used for generating backgrounds, patterns, or visual effects by repeating or manipulating a base texture. The output is a PGM image written to standard output.

CAVEATS

pgmtexture strictly outputs PGM (grayscale) images. To work with color textures, you might need to convert them to PGM first or apply pgmtexture to individual color channels using other Netpbm tools. The output is always sent to standard output, requiring redirection (e.g., > output.pgm) to save it to a file.

OUTPUT FORMAT

The command produces images in the PGM (Portable Graymap) format. This format can be either plain text or binary. To view or further manipulate the generated images, other Netpbm tools or standard image viewers that support PGM are necessary.

USAGE WITH PIPES

True to the Netpbm design philosophy, pgmtexture is highly compatible with shell pipelines. Its PGM output can be directly piped as input to subsequent Netpbm commands for further processing, such as format conversion (e.g., pgmtexture ... | pgmtoppm > color_texture.ppm) or additional image manipulation.

HISTORY

pgmtexture is a component of the comprehensive Netpbm suite of graphics utilities. Netpbm's origins trace back to Pbmplus, created by Jef Poskanzer in 1988. This command was developed to offer a versatile, programmatic method for generating textured images, serving purposes like creating backgrounds and intricate patterns within Unix-like environments. Its design adheres to the Netpbm philosophy of simplicity and seamless integration within shell pipelines.

SEE ALSO

pgm(5), netpbm(1), pamscale(1), pamcomp(1), pgmtoppm(1)

Copied to clipboard