ppmtoneo
Convert PPM image format to NeoChrome format
TLDR
Convert a PPM image to a NEO file
SYNOPSIS
ppmtoneo
[options] [ppmfile]
Options include:
-alpha
-forcealpha
-icon
-opaque
-color
-noopaque
-bpp bpp
PARAMETERS
-alpha
Generates a 2-bit icon with an alpha channel, deriving alpha from the input image's alpha or treating black (0,0,0) as transparent if no alpha is present.
-forcealpha
Similar to -alpha, but forces the output to be a 2-bit icon even if the input appears to be a color image.
-icon
Creates a 2-bit icon using old-fashioned transparency (transparent index), where black (0,0,0) pixels are treated as transparent. Less recommended for modern systems.
-opaque
Produces a 2-bit icon with an alpha channel where all pixels are fully opaque, suitable for 2-bit grayscale images without transparency.
-color
Generates an 8-bit color icon. Uses the input's alpha channel if available; otherwise, black (0,0,0) is used as the transparent color. This is the default behavior if no 2-bit option is specified.
-noopaque
When generating an 8-bit icon, this option forces the use of black (0,0,0) as the transparent color, even if the input image contains an alpha channel that would normally be used.
-bpp bpp
Explicitly sets the bits per pixel for the output icon. bpp must be either 2 or 8. This option is mutually exclusive with other color depth and transparency options (-alpha, -forcealpha, etc.).
ppmfile
The path to the input portable pixmap (PPM) file. If not specified, ppmtoneo reads from standard input.
DESCRIPTION
ppmtoneo
is a Netpbm utility designed to transform portable pixmap (PPM) images into the NeXT icon file format. These icons are typically 48x48 pixels and can be either 2-bit (monochrome with alpha channel) or 8-bit (color). The command reads a PPM image from standard input or a specified file and outputs the NeXT icon data to standard output. While the input PPM can be of any dimension, ppmtoneo
automatically scales it to the required 48x48 size for the output icon, though it is often advisable to pre-scale the image using tools like pamscale
or pnmscale
for better quality. The utility offers various options to control the output's color depth and transparency handling, allowing for creation of icons with alpha channels or traditional transparent color indices.
CAVEATS
Input images are automatically scaled to 48x48 pixels for output. For best quality, it is recommended to pre-scale your images using tools like pamscale
or pnmscale
before passing them to ppmtoneo
.
The behavior regarding transparency (alpha channel vs. transparent color) depends heavily on the selected options and the presence of an alpha channel in the input PPM. Carefully choose options like -alpha, -color, and -noopaque to achieve desired transparency effects.
When generating 8-bit color icons, ppmtoneo
quantizes the input image's colors to fit the 256-color palette of the NeXT icon format, which may result in color degradation.
INPUT/OUTPUT
ppmtoneo
typically reads the input PPM image from standard input and writes the resulting NeXT icon file to standard output. This allows for flexible use in pipelines, such as cat image.ppm | ppmtoneo -color > icon.next
.
NEXT ICON FORMAT SPECIFICS
NeXT icon files are fixed at 48x48 pixels. They can be 2-bit (monochrome with 2-bit alpha) or 8-bit (color with a palette). The 2-bit alpha channel provides varying levels of transparency (fully transparent to fully opaque).
HISTORY
The ppmtoneo
command is an integral part of the Netpbm project, a comprehensive suite of graphics file format conversion tools. Netpbm originated from the pbmplus
package, created by Jef Poskanzer in the late 1980s. These tools were designed to handle conversions between various image formats, promoting interoperability and ease of scripting. ppmtoneo
specifically addresses the need to generate icons for the NeXTstep operating system, which was notable for its innovative GUI and development environment. As NeXTstep evolved into macOS, the NeXT icon format became less prevalent in new development, but ppmtoneo
remains useful for legacy conversions or specific niche applications requiring adherence to this format. The command's design reflects the Netpbm philosophy of simple, single-purpose tools that can be piped together to achieve complex tasks.