LinuxCommandLibrary

pgmtost4

Convert PGM image to Atari ST format

TLDR

Convert a PGM image file to the SBIG ST-4 format

$ pgmtost4 [path/to/input_file.pgm] > [path/to/output.st4]
copy

SYNOPSIS

pgmtost4 [-st4version={1,2}] [-st4compression] [-maxst4compressedsize=maxsize] [-header | -noheader] [-width=width] [-height=height] [pgmfile]

PARAMETERS

-st4version={1,2}
    Specifies the ST4 version to use for output. The default is 1. Version 2 supports wider images and potentially other enhancements.

-st4compression
    Enables LZ (Lempel-Ziv) compression for the output ST4 data. This can significantly reduce the file size.

-maxst4compressedsize=maxsize
    Sets the maximum allowed size for the compressed ST4 output in bytes. If compression would result in a larger size, it outputs uncompressed data.

-header
    Outputs an ST4 file header before the image data. By default, no header is included, which is useful when the image data is embedded directly into an application.

-noheader
    Explicitly suppresses the output of the ST4 file header. This is the default behavior.

-width=width
    Forces the output image width to the specified value. Useful when PGM data is piped without a PGM header, allowing pgmtost4 to correctly interpret the stream.

-height=height
    Forces the output image height to the specified value. Similar to -width, it's used for raw PGM data streams.

DESCRIPTION

pgmtost4 is a utility from the Netpbm project that transforms a Portable Graymap (PGM) image into the STMicroelectronics ST4 graphics file format. The ST4 format is specifically designed for use with STMicroelectronics' graphics chips and is a compact, uncompressed or LZ-compressed raster image format. This command is typically used when preparing images for embedded systems that utilize STMicroelectronics display controllers. It reads the PGM image data from standard input and writes the ST4 formatted data to standard output, making it suitable for piping with other Netpbm tools. It supports different ST4 versions and can apply LZ compression for smaller file sizes, which is crucial for resource-constrained environments. Users can also specify whether to include an ST4 header, providing flexibility for integration into various application workflows.

CAVEATS

pgmtost4 is part of the Netpbm suite, which often implies it processes single-image streams.
The ST4 format itself might have limitations depending on the specific STMicroelectronics chip or driver being used.
Without -width and -height options, it expects a proper PGM header for dimension information when reading from stdin.
Compression (-st4compression) might not always yield smaller files, especially for highly noisy or already compressed images, and -maxst4compressedsize handles this.

STANDARD INPUT/OUTPUT

pgmtost4 reads the PGM image from standard input and writes the ST4 formatted image to standard output. This makes it highly suitable for use in shell pipelines, allowing it to be chained with other Netpbm utilities or command-line tools. For example, an image can be converted from JPEG to PGM, then to ST4 in a single pipeline.

ST4 FORMAT DETAILS

The ST4 format is a proprietary or semi-proprietary format primarily used by STMicroelectronics graphics processors. It's designed to be compact and efficient for display on their chips, often featuring optimized storage for grayscale or indexed color data. pgmtost4 specifically handles grayscale images, converting them into the ST4 representation.

HISTORY

pgmtost4 is a relatively specialized tool within the extensive Netpbm package. Netpbm itself has a long history, originating from the pbmplus package by Jef Poskanzer in 1988, designed for converting various image formats. The pgmtost4 utility was developed later as part of the Netpbm suite to specifically support the STMicroelectronics ST4 graphics format, catering to embedded systems development where image data needs to be tailored for specific hardware. Its development reflects Netpbm's ongoing commitment to supporting a wide array of image formats, including those specific to hardware applications.

SEE ALSO

pgm(5), ppm(5), pam(1), st4topgm(1), netpbm(1)

Copied to clipboard