LinuxCommandLibrary

ppmtopuzz

Convert PPM image to a puzzle

TLDR

Convert a PPM image to an X11 puzzle file

$ ppmtopuzz [path/to/file.ppm] > [path/to/file.puzz]
copy

SYNOPSIS

ppmtopuzz [-piecewidth=N] [-pieceheight=N] [-puzz-version=N] [ppmfile]

PARAMETERS

-piecewidth=N
    Specifies the desired width, in pixels, for each individual puzzle piece. The input image's width must be evenly divisible by this value.

-pieceheight=N
    Specifies the desired height, in pixels, for each individual puzzle piece. The input image's height must be evenly divisible by this value.

-puzz-version=N
    Determines the version of the .puzz file format to be generated. This is typically 1 or 2, depending on the requirements of the puzzle application.

ppmfile
    The path to the input Portable Pixmap (PPM) image file. If omitted, ppmtopuzz will read image data from standard input.

DESCRIPTION

ppmtopuzz is a utility from the Netpbm image manipulation toolkit. It converts a Portable Pixmap (PPM) image file into a .puzz file, a specialized format used by certain Jigsaw Puzzle programs. The .puzz file typically contains information about the puzzle's dimensions (number of pieces), the pixel data for each piece, and potentially other metadata necessary for a puzzle application to reconstruct and display the image as a puzzle. This command allows users to prepare their custom images for use in such puzzle software by segmenting the image into a grid of pieces based on specified dimensions. It's a niche tool within the broader Netpbm suite, designed to interoperate with specific puzzle applications that consume this .puzz format.

CAVEATS

  • The specified piecewidth and pieceheight values must be exact divisors of the input image's width and height, respectively. If not, the command will issue an error.
  • Output is always written to standard output (stdout). To save the output to a file, redirection (e.g., > filename.puzz) must be used.
  • The .puzz file format is highly specific and primarily intended for use with particular jigsaw puzzle software that recognizes it. It is not a widely adopted image format.

STANDARD INPUT/OUTPUT

Like many Netpbm utilities, ppmtopuzz is designed to work with Unix pipes. It reads the input PPM image from ppmfile (or standard input if ppmfile is not provided) and writes the resulting .puzz file to standard output. This allows for chaining commands, for example, anytopnm image.jpg | ppmtopuzz -piecewidth=50 -pieceheight=50 > puzzle.puzz.

PUZZLE FILE FORMAT

The .puzz file format is a proprietary or niche format. While its exact internal structure can vary slightly by version, it generally embeds the image pixel data along with metadata about the puzzle grid (e.g., number of rows and columns of pieces). It is not directly viewable by standard image viewers but is consumed by specific jigsaw puzzle applications.

HISTORY

ppmtopuzz is part of the Netpbm image manipulation package, a long-standing collection of graphics tools for Unix-like systems. It was specifically developed by Bryan Henderson, the maintainer of Netpbm, to provide an image source for a particular puzzle application that utilized the .puzz file format. Its development is tied to the Netpbm project's continuous evolution in providing versatile image format conversions.

SEE ALSO

ppm(5), pnm(5), anytopnm(1), netpbm(1)

Copied to clipboard