ppmtoyuvsplit
Convert PPM image to separate Y, U, V files
TLDR
Read a PPM image from the input file, convert it to three subsampled Abekas YUV image and store these images to output files starting with the specified basename
SYNOPSIS
ppmtoyuvsplit [input_file.ppm]
PARAMETERS
input_file.ppm
The path to the Portable Pixmap (PPM) image file to be processed. If this argument is omitted, ppmtoyuvsplit will read the PPM image data from standard input (stdin).
DESCRIPTION
ppmtoyuvsplit is a Netpbm utility designed to separate the color components of a Portable Pixmap (PPM) image into their respective YUV representation.
YUV is a color encoding system widely used in video systems, where 'Y' represents the luminance (brightness) component, and 'U' and 'V' represent the chrominance (color) components. The command reads a single PPM image from either a specified file or standard input. It then converts the RGB data of the PPM image into the YUV color space using a standard conversion matrix.
The output consists of three separate Portable Graymap (PGM) files: one for the Y component, one for the U component, and one for the V component. These PGM files represent the grayscale values of each respective YUV channel. This separation is particularly useful for tasks such as video compression, analysis, or processing where luminance and chrominance information needs to be handled independently.
CAVEATS
The command outputs three separate PGM files for Y, U, and V, not a single interleaved YUV stream or a downsampled YUV format typically used in video (like YCbCr 4:2:0). The U and V components are output at the same resolution as the Y component, without any chrominance subsampling.
The conversion uses a fixed color space matrix, which might not be ideal for all YUV variants (e.g., BT.601 vs. BT.709).
OUTPUT FILE NAMING
When an input filename is provided (e.g., image.ppm), the output files will be named image_Y.pgm, image_U.pgm, and image_V.pgm. If the input is read from standard input, the output files will be named _Y.pgm, _U.pgm, and _V.pgm by default.
COLOR SPACE CONVERSION
The command performs a standard RGB to YUV (specifically, YCbCr) conversion. This is typically based on ITU-R BT.601 recommendations for standard definition television, which is a common choice for such utilities unless specified otherwise.
HISTORY
ppmtoyuvsplit is part of the Netpbm project, a comprehensive suite of graphics file format converters and image processing tools. Netpbm originated from the Pbmplus package, developed by Jef Poskanzer in the late 1980s. It has been a staple in Unix-like environments for manipulating image files, particularly the "portable" formats (PBM, PGM, PPM), which are simple ASCII or raw binary formats designed for easy parsing and processing by command-line tools. ppmtoyuvsplit serves as a fundamental building block for advanced image and video processing workflows, leveraging the modularity characteristic of the Netpbm philosophy.