svgtopam
Convert SVG files to PAM image format
TLDR
Convert an SVG file to Netpbm format
Emit textual output describing the input image
SYNOPSIS
svgtopam [-width=pixels] [-height=pixels] [-scale=float] [-background=color] [-opacity=float] [-antialias=boolean] [-invert] [-verbose] [file]
PARAMETERS
-width=pixels
Specifies the desired width of the output image in pixels. If only width or height is given, the aspect ratio is maintained.
-height=pixels
Specifies the desired height of the output image in pixels. If only width or height is given, the aspect ratio is maintained.
-scale=float
Scales the output image by the specified factor. A value of 1.0 means no scaling. This option is applied after -width or -height if specified.
-background=color
Sets the background color for the output image. This can be a color name (e.g., "red"), a hexadecimal RGB value (e.g., "#FF0000"), or a Netpbm color specification.
-opacity=float
Sets the global opacity for the entire image, a value between 0.0 (fully transparent) and 1.0 (fully opaque). This applies to the entire rendered SVG.
-antialias=boolean
Controls antialiasing during rendering. Use TRUE (default) to enable smooth edges or FALSE to disable it for sharper, potentially aliased, edges.
-invert
Inverts the colors of the resulting PAM image.
-verbose
Prints verbose information about the conversion process to standard error, which can be useful for debugging.
file
The path to the SVG input file. If omitted, svgtopam reads the SVG data from standard input.
DESCRIPTION
svgtopam is a utility within the Netpbm image manipulation toolkit that converts Scalable Vector Graphics (SVG) files into the Portable Arbitrary Map (PAM) format. PAM is a general-purpose Netpbm raster image format capable of representing various pixel depths and channel configurations, including transparency. The command reads an SVG image from standard input or a specified file and outputs the resulting PAM image to standard output. This allows for seamless integration of SVG content into workflows involving other Netpbm tools, which can then further process, transform, or convert the rasterized SVG image. svgtopam offers options to control the output image's dimensions, scaling, background color, opacity, and antialiasing, providing flexibility in how the vector graphic is rasterized.
CAVEATS
svgtopam relies on an external SVG rendering library (commonly librsvg) for its core functionality. Therefore, the rendering quality, supported SVG features, and performance can be dependent on the capabilities and version of this underlying library. Complex or non-standard SVG features might not be fully supported.
INPUT AND OUTPUT
By default, svgtopam reads SVG data from standard input, making it highly suitable for piping operations. The resulting PAM image is always written to standard output, enabling it to be easily piped to other Netpbm commands for further processing, such as format conversion (e.g., to PNG via pamtopng) or manipulation.
DEPENDENCIES
This command is effectively a wrapper that utilizes an external SVG rendering library to perform the conversion. The most common dependency is the librsvg library, which must be installed on the system for svgtopam to function correctly. The behavior and capabilities of svgtopam are directly tied to the features supported by the installed SVG rendering library.
HISTORY
svgtopam is an integral part of the Netpbm project, a venerable suite of graphics utilities for Unix-like systems. Its introduction reflects the Netpbm project's ongoing effort to support a wider array of image formats. It was developed to bridge the gap between the increasingly popular vector-based SVG format and Netpbm's raster-based image processing capabilities, leveraging existing open-source SVG rendering engines like librsvg to perform the actual rasterization.