All options can be abbreviated to their shortest unique prefix. You may use two hyphens instead of one to designate an option. You may use either white space or equals signs between an option name and its value.
This program is part of Netpbm.
pamtowinicon reads an RGB_ALPHA Netpbm PAM file and converts it to a Microsoft Windows icon file.
The output goes to Standard Output.
The input is a multi-image PAM file; each image becomes an icon in the output file. If you have input images in multiple files, you can simply combine them with cat and pass the result to pamtowinicon.
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamtowinicon recognizes the following command line options:
When the program uses PNG encoding for a 5-channel PAM with separate AND mask (see below), it discards the AND mask. Because PNG has always had the ability to specify transparency, the Windows icon format does not provide for a separate and mask when the icon is encoded in PNG.
The default value for threshold is 128.
pamtowinicon reads a (multi-image) Netpbm PAM file as input and outputs an single Windows icon file containing those images.
The images in the icon file are in the same order as in the PAM input.
pamtowinicon interprets the PAM images as follows, based on the number of channels.
| channels | image |
|---|---|
| 1 | fully opaque grayscale image |
| 2 | grayscale image with transparency channel |
| 3 | fully opaque color image |
| 4 | color image with transparency channel |
| 5 | color image with transparency channel and additional AND mask |
The tuple types of the PAMs are irrelevant.
If there is no explicit AND mask, but transparency data in the input image, pamtowinicon sets the AND mask to opaque where the pixel is fully opaque and to transparent elsewhere.
If no transparency data is present in the input image, pamtowinicon assumes the whole image to be fully opaque.
When BMP encoding an image with 256 or fewer colors and does not contain transparency information, pamtowinicon uses BI_RGB format with a color palette. It generates 1, 4, or 8 bits per pixel, based on how many colors there are.
If the image has more than 256 colors or contains transparency information, the program uses BI_RGB format with no palette, 32 bits per pixel.
pamtowinicon never generates 16-bit BI_RGB or BI_BITFIELDS BMP encoded images.
As of August 2026, Safari has been observed to display some BMP-encoded Windows icons incorrectly. It displays a no-palette BMP-encoded icon that has zero for the opacity value of every pixel as blank; it apparently assumes the icon is fully transparent -- invisible. But there is a special part of the Windows icon format definition that says that while a zero opacity value normally means transparent, if every pixel has a zero opacity value, that means every pixel is opaque. Safari apparently is not aware of that special rule. To work around this and still have more than 256 colors, you can use pamtowinicon's -pngthreshold=1 option to force the icon to use PNG encoding instead of BMP.
For information on the PNG format, see http://schaik.com/png.
pamtowinicon was new in Netpbm 10.63 (June 2013). It obsoleted ppmtowinicon by providing more function and conforming better to Netpbm conventions.
Copyright (C) 2013 by Ludolf Holzheid.
Translated to Netpbm coding style by Bryan Henderson.