pbmtojpeg
Convert PBM image to JPEG image
SYNOPSIS
pbmtojpeg [options] [pbmfile]
PARAMETERS
-quality=N
Set the JPEG quality level. N ranges from 0 (worst) to 100 (best). Default is 75.
-optimize
Perform Huffman table optimization to further compress the JPEG output. Slightly slower to encode, but results in smaller files.
-grayscale
Force grayscale encoding, even if the PBM image is color.
Useful if you want to encode colour PBM images to be grayscale.
-progressive
Create a progressive JPEG file. The image is displayed in multiple passes of increasing detail when viewed over a slow connection.
-dct=method
Specify the DCT (Discrete Cosine Transform) method. method can be 'int', 'fast', 'float', or 'islow'. Default is 'float' for quality > 90, 'int' otherwise. Selecting 'int' or 'fast' may cause minor accuracy problems but are faster. islow is the slowest and most accurate but is seldom useful.
-rgb
Force RGB encoding. Useful if the input PBM is not of type PBM.
pbmfile
The name of the input PBM file. If not specified, reads from standard input.
DESCRIPTION
pbmtojpeg converts a portable bitmap (PBM) image to a JPEG image. It reads a PBM image from standard input and writes the corresponding JPEG image to standard output. The command utilizes the Independent JPEG Group's (IJG) JPEG library to perform the conversion. Quality settings can be adjusted to control the trade-off between file size and image quality. The output JPEG image will usually be much smaller than the input PBM, particularly for images with large areas of uniform color. PBM is an uncompressed format while JPEG is a lossy compression format, suitable for photographs and images with gradients. By default, pbmtojpeg produces a baseline JPEG, compatible with virtually all JPEG decoders.
CAVEATS
The command relies on the IJG JPEG library, so its behavior is dependent on the specific version of the library installed on the system.
It processes only PBM images, therefore you might need to convert from other image formats first (using other tools like convert).
The jpeg standard doesn't define a bit depth. The pbmtojpeg converts PBM to the closest available format.
EXAMPLES
Convert 'input.pbm' to 'output.jpg' with quality 85:
pbmtojpeg -quality=85 input.pbm > output.jpg
Convert from standard input: cat input.pbm | pbmtojpeg > output.jpg
HISTORY
pbmtojpeg is part of the Netpbm suite of image manipulation tools. The Netpbm project began in 1988, with the initial goal of providing a set of tools to convert between various image formats. pbmtojpeg was created in order to facilitate the conversion from the simple PBM format to the more widely used and compressed JPEG format. It leverages the IJG JPEG library, a widely used and respected implementation of the JPEG standard.