ppmtowinicon
Convert PPM images to Windows icon format
TLDR
View documentation for the current command
SYNOPSIS
ppmtowinicon [-transparent] [-hotspot x y] [-colors n] [-andmask] [-notandmask] [-orxor] [-file file] [ppmfile ...]
PARAMETERS
-transparent
Uses the color of the bottom-left pixel of the first image as the transparent color for all images in the icon.
-hotspot x y
Specifies the hotspot coordinates (x, y) for a cursor. While available, this option is primarily for ppmtowincursor and generally not applicable for icon files.
-colors n
Quantizes the input images to use at most n colors. The default is 256 colors if not specified.
-andmask
Enables the AND-mask mechanism for transparency, where the transparent bits are defined by a separate mask.
-notandmask
Enables the OR-XOR mechanism for transparency, which is the default if -andmask is not specified. This is equivalent to -orxor.
-orxor
Equivalent to -notandmask, enabling the OR-XOR transparency mechanism.
-file file
Writes the resulting Windows icon data to the specified file instead of standard output.
ppmfile ...
One or more input PPM image files to be converted. If no files are specified, ppmtowinicon reads PPM data from standard input.
DESCRIPTION
ppmtowinicon is a command-line utility from the Netpbm suite that converts one or more Netpbm PPM (Portable Pixmap) images into a single Windows icon (ICO) file. It reads PPM data from standard input or specified files and writes the ICO output to standard output or a designated file.
This tool is essential for creating icons used in Windows applications, supporting multi-image ICO files where each input PPM can represent a different size or color depth of the same icon. It provides options for managing transparency and color quantization, making it versatile for generating icons that adhere to specific Windows display requirements. Users often preprocess images with tools like pnmscale or pnmquant before piping them to ppmtowinicon to achieve desired dimensions and color palettes.
CAVEATS
Input images must be in PPM (Portable Pixmap) format. Other Netpbm formats (PGM, PBM) are not directly supported by this command, although they can be converted to PPM using other Netpbm tools like anytoppm.
The -hotspot option is intended for Windows cursor files (CUR) and is generally ineffective or irrelevant for standard icon files (ICO), despite being present for compatibility with ppmtowincursor.
ppmtowinicon does not perform image resizing or advanced color depth conversions. Users should pre-process their PPM images using tools like pnmscale to achieve desired icon dimensions (e.g., 16x16, 32x32) and pnmquant for specific color depths before piping them into ppmtowinicon.
MULTI-IMAGE ICONS
ppmtowinicon can create multi-image ICO files by accepting multiple PPM files as input. Each input PPM file contributes a separate image entry to the final icon, allowing for different resolutions or color depths within a single icon file, which is crucial for modern Windows icon display.
STANDARD INPUT/OUTPUT USAGE
When no input ppmfile is specified, ppmtowinicon reads image data from standard input, making it highly suitable for piping operations from other Netpbm commands (e.g., `pnmscale image.ppm | ppmtowinicon > icon.ico`). Similarly, output is directed to standard output by default, facilitating further processing or redirection.
HISTORY
ppmtowinicon is part of the Netpbm project, a well-established open-source package of graphics manipulation programs for Unix-like systems. Its development reflects the need to generate platform-specific image formats, such as Windows ICO files, from more generic and manipulable Netpbm formats, facilitating cross-platform image asset management and development workflows.