LinuxCommandLibrary

pamoil

Generate thumbnail images from video files

TLDR

Turn a PAM image into an oil painting

$ pamoil [path/to/input_file.pam] > [path/to/output_file.pam]
copy

Consider a neighborhood of n pixels for the "smearing" effect
$ pamoil -n [n] [path/to/input_file.pam] > [path/to/output_file.pam]
copy

SYNOPSIS

pamoil [-radius radius] [-color-count colors] [-random] [-seed seed] [-verbose] [netpbmfile]

PARAMETERS

-radius radius
    Specifies the radius of the circular neighborhood (in pixels) used for the oil painting effect. A larger radius results in broader strokes and more significant smoothing. The default is 2.

-color-count colors
    Reduces the number of distinct colors in the output image to the specified count. Lower values can create a more "posterized" or stylized oil painting look by simplifying color gradients. The default is 100.

-random
    When specified, pamoil uses a random color from the neighborhood (after quantization) instead of the statistically dominant color (median/mode). This can introduce a different texture to the effect.

-seed seed
    Sets the seed for the random number generator when the -random option is used. This allows for reproducible results when randomness is involved.

-verbose
    Causes pamoil to print informational messages about its progress and operations to standard error.

DESCRIPTION

pamoil is a utility from the Netpbm toolkit designed to transform an input image into an approximation of an oil painting. It achieves this effect by analyzing the colors within a defined neighborhood (radius) around each pixel. For each neighborhood, pamoil typically identifies the most prevalent color (or a representative color after quantizing to a limited color-count) and replaces the central pixel's color with it.

This process smooths out detail while retaining some major color blocks, mimicking the broad strokes and texture of an oil painting. The command reads Netpbm format images (PAM, PPM, PGM) from standard input or a specified file and outputs the modified image in PAM format to standard output. It's a non-interactive tool primarily used in scripting or command-line workflows for artistic image manipulation.

CAVEATS

pamoil can be computationally intensive and consume significant memory, especially when processing large images or using a large -radius. Processing time increases dramatically with radius size.

The "oil painting" effect is an algorithmic approximation; it may not perfectly replicate the nuanced textures and brushstrokes of a real oil painting. The visual quality depends heavily on the input image and chosen parameters.

As part of the Netpbm suite, it exclusively handles Netpbm image formats (PAM, PGM, PPM). Conversion utilities like jpegtopam(1) or pngtopam(1) are required for other image types.

INPUT AND OUTPUT FORMATS

pamoil is designed to work with Netpbm image formats. It accepts PGM, PPM, or PAM format images as input, either from a specified file or standard input. The output image is always in the PAM (Portable Arbitrary Map) format, which is the most flexible Netpbm format, written to standard output.

HOW THE EFFECT IS ACHIEVED

The core of the pamoil effect involves iterating through each pixel in the image. For each pixel, it examines a circular neighborhood of pixels defined by the -radius option. It then quantizes the colors within this neighborhood to the number specified by -color-count and determines the most dominant (or a random, if -random is used) color. The center pixel's color is then replaced with this dominant/random color. This process effectively reduces detail and emphasizes larger color blocks, characteristic of an oil painting.

HISTORY

pamoil is a component of the comprehensive Netpbm package, which evolved from Jef Poskanzer's Pbmplus utilities (first released in 1988). The Netpbm project aims to provide a robust, modular set of tools for image manipulation based on simple, open image formats. pamoil was developed as one of the specialized filters within this toolkit, extending its capabilities for artistic image transformation. Its design aligns with the Unix philosophy of small, specialized tools that can be chained together.

SEE ALSO

pam(1), pnm(5), pamblur(1), pamscale(1), convert(1), gimp(1)

Copied to clipboard