LinuxCommandLibrary

pnmtoddif

Convert PNM image to a DDIF image

TLDR

Convert a PNM image to a DDIF image file

$ pnmtoddif [path/to/image.pnm] > [path/to/image.ddif]
copy

Explicitly specify the horizontal and vertical resolution of the output image
$ pnmtoddif [[-r|-resolution]] [horizontal_dpi] [vertical_dpi] [path/to/image.pnm] > [path/to/image.ddif]
copy

SYNOPSIS

pnmtoddif [options] [pnmfile]
Example: pnmtoppm myimage.pbm | pnmtoddif -color -comment "Converted image" > myimage.ddif

PARAMETERS

--help
    Displays help information and exits.

--version
    Displays version information and exits.

-color
    Forces output to be a color DDIF image. Only applicable if the input PNM is PPM.

-mono
    Forces output to be a monochrome (black and white) DDIF image.

-grayscale
    Forces output to be a grayscale DDIF image.

-ddiftype <type>
    Specifies the internal DDIF image representation type (e.g., RGB_DDIF, CIELab_DDIF).

-comment <string>
    Adds the specified string as a comment in the DDIF header.

-compress <type>
    Sets the compression method for the DDIF image. Accepted types are none or runlength.

-map
    If applicable, uses a colormap for the output DDIF image.

-nomap
    Prevents the use of a colormap in the output DDIF image, even if one could be used.

-alpha
    Creates an alpha channel (transparency) in the output DDIF image.

-noalpha
    Ensures no alpha channel is included in the output DDIF image.

-pelsperinch <value>
    Sets the horizontal and vertical resolution of the image in pixels per inch.

-title <string>
    Sets the document title metadata in the DDIF header.

-author <string>
    Sets the author metadata in the DDIF header.

-subject <string>
    Sets the subject metadata in the DDIF header.

-keywords <string>
    Sets keywords metadata in the DDIF header, typically comma-separated.

-creator <string>
    Sets the creator application metadata in the DDIF header.

-date <string>
    Sets the creation date metadata in the DDIF header.

DESCRIPTION

pnmtoddif is a utility from the Netpbm toolkit, designed to convert images from the flexible Netpbm formats (PBM, PGM, PPM) into the Digital Document Interchange Format (DDIF). DDIF is a structured document and image interchange format primarily associated with Digital Equipment Corporation (DEC) systems and applications. This command is crucial for environments needing to interoperate with legacy DEC systems that rely on DDIF for image data.

The tool supports various image types, including monochrome, grayscale, and color, and allows for control over output characteristics such as compression (none, runlength) and resolution. It can also embed metadata like comments, titles, authors, and keywords directly into the DDIF header, ensuring robust document information preservation. By default, pnmtoddif reads a PNM image from standard input and writes the resulting DDIF image to standard output, making it suitable for piping in shell scripts.

CAVEATS

DDIF is a proprietary and less commonly used format today, primarily relevant for interoperability with older Digital Equipment Corporation (DEC) systems. Conversion may result in loss of specific image properties if the DDIF format or chosen options do not support the full fidelity of the input PNM. Compression options are limited to basic none and runlength.

DDIF FORMAT CONTEXT

The Digital Document Interchange Format (DDIF) is a proprietary format developed by Digital Equipment Corporation (DEC) for structured documents and images. It was often used in DEC's imaging and document management systems. While not widely used in modern contexts, pnmtoddif provides a bridge for working with legacy DDIF files.

STANDARD INPUT/OUTPUT

Like many Netpbm utilities, pnmtoddif is designed to work as part of a pipeline. It reads the PNM image from standard input (stdin) if no pnmfile is specified and writes the resulting DDIF image to standard output (stdout). This allows easy chaining with other commands.

HISTORY

pnmtoddif is a component of the comprehensive Netpbm suite, which originated from Jef Poskanzer's PBMPlus package developed in the late 1980s. The inclusion of pnmtoddif reflects a historical need for interoperability, particularly with Digital Equipment Corporation (DEC) systems that extensively utilized the DDIF format for image and document exchange. Its development ensured that images processed by the widely adopted Netpbm tools could be integrated into DEC's proprietary document workflows, maintaining its utility for specific legacy environments.

SEE ALSO

pnm(5), anytopnm(1), ddiftopnm(1), ppm(5), pgm(5), pbm(5)

Copied to clipboard