winicontoppm
Convert Windows ICO files to PPM images
TLDR
View documentation for the current command
SYNOPSIS
winicontoppm [-alpha | -noalpha] [-bgcolor=<#RRGGBB>] [-icon=
PARAMETERS
ico_file
The path to the input Windows icon (.ico) file. If omitted or '-', winicontoppm reads from standard input.
-alpha
Output an alpha channel image along with the main PPM image. The alpha image is a PGM file indicating transparency. This is the default if the icon includes an alpha channel.
-noalpha
Do not output an alpha channel. The icon's transparent areas will be filled with the background color (or black by default).
-bgcolor=<#RRGGBB>
Specify a background color for transparent pixels. The color is given as a hexadecimal RGB triplet (e.g., #FF0000 for red). Defaults to black if not specified.
-icon=
Select the Nth icon image embedded in the ICO file. Icon images are numbered starting from 0. By default, winicontoppm picks the 'best' image (largest, highest color depth).
-pixels=
Select the icon image that has N pixels for its width/height. If multiple match, the one with the highest depth is chosen. Overrides -icon if both are specified and conflict.
-depth=
Select the icon image that has N bits per pixel color depth. Used in conjunction with -pixels or to refine the 'best' choice.
DESCRIPTION
winicontoppm is a command-line utility from the Netpbm project that converts Windows icon (.ico) files into a PPM (Portable PixMap) image format. This enables Windows icons to be viewed and manipulated on Unix-like systems using other Netpbm tools. ICO files can contain multiple images of different sizes and color depths; winicontoppm can extract a specific icon based on user criteria or select the "best" available one by default. It handles transparency (alpha channel) and allows specifying a background color for non-transparent areas. This tool is essential for developers or users needing to work with Windows iconography outside of a Windows environment.
CAVEATS
ICO files can contain multiple images; winicontoppm tries to pick the 'best' one by default, which may not always be the desired one. Use -icon, -pixels, or -depth to specify your choice.
Transparency handling varies. Some ICO files use a true alpha channel, while others use a simple mask. The tool attempts to handle both. Use -alpha or -noalpha to control alpha output.
The output is always a PPM file (and optionally a PGM for alpha). If other formats are needed, pipe the output to other Netpbm tools (e.g., pnmtopng).
DEFAULT ICON SELECTION
If no specific icon is requested using -icon, -pixels, or -depth, winicontoppm selects the 'best' icon available in the ICO file. The 'best' is typically defined as the largest icon in terms of dimensions, and among those, the one with the highest color depth. This behavior ensures that the most detailed version of the icon is usually chosen by default.
STANDARD INPUT/OUTPUT
Like many Netpbm tools, winicontoppm can read the ICO file from standard input if ico_file is omitted or specified as '-'. The resulting PPM (and optional PGM) output is always written to standard output. This allows for powerful piping operations with other command-line tools.
HISTORY
winicontoppm is part of the Netpbm package, a comprehensive suite of graphics file format converters and editors. Netpbm originated in the early 1990s as a collection of tools for converting between different image formats on Unix systems. winicontoppm was developed to address the need for converting Windows-specific icon files, which became increasingly common with the rise of Microsoft Windows, enabling cross-platform usage and manipulation of these icons. Its development reflects Netpbm's ongoing commitment to supporting a wide array of image formats.