---
name: "img-ppm"
section: "3tk"
platform: "linux"
package: "libtk-img-doc"
version: "1:2.0.1+dfsg1-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/img-ppm"
---

# img-ppm(3tk)

Portable pixmap format (ppm)

```

```

## NAME

img-ppm - Portable pixmap format (ppm)

## SYNOPSIS

package require **img::ppm ?2.0?**

```

```

## DESCRIPTION

**package require img::ppm**

Like all packages of **Img** it does *not* provide new commands, but extends the existing **Tk** command **image**, so that it supports files containing raster images in the Portable pixmap format (ppm). More specifically **img::ppm** extends **Tk**'s *photo* \[https://www.tcl.tk/man/tcl9.0/TkCmd/photo.html\] image type.

The name of the new format handler is **ppm**. This handler provides additional configuration options. See section **Options** for more detailed explanations.

All of the above means that in a call like **image** **create photo** ?*name*? ?*options*?

- \[1\]

  Image data in ppm format (options **-data** and **-file**) is detected automatically.

- \[2\]

  The format name **ppm** is recognized by the option **-format**.

In addition the value of option **-format** is treated as a list and may contain any of the special options listed in section **Options**.

The package **img::ppm** is a sub-package of **Img**. It can be loaded as a part of the complete Img support, via **package require Img**, or on its own, via **package require img::ppm**.

## SUPPORTED TYPES

This handler supports the PPM (Truecolor) and PGM (Grayscale) image formats. There are two types of PPM/PGM files: Binary and ASCII. The values stored in PPM/PGM files can be unsigned 8-bit or unsigned 16-bit values.

- •

  Grayscale (PGM): 8-bit and 16-bit, 1 channel per pixel.

- •

  Truecolor (PPM): 8-bit and 16-bit, 3 channels per pixel.

```
 Image             |     Read      |     Write     |
 type              | -file | -data | -file | -data |
 ---------------------------------------------------
 PGM  8-bit ASCII  | Yes   | Yes   | No    | No    |
 PGM  8-bit BINARY | Yes   | Yes   | No    | No    |
 PGM 16-bit ASCII  | Yes   | Yes   | No    | No    |
 PGM 16-bit BINARY | Yes   | Yes   | No    | No    |
 PPM  8-bit ASCII  | Yes   | Yes   | Yes   | Yes   |
 PPM  8-bit BINARY | Yes   | Yes   | Yes   | Yes   |
 PPM 16-bit ASCII  | Yes   | Yes   | No    | No    |
 PPM 16-bit BINARY | Yes   | Yes   | No    | No    |
```

## OPTIONS

The handler provides the following options:

- **-verbose** *bool*

  This option is supported for reading and writing. Available since version 1.4.0.

  If set to **true**, additional information about the read or written image is printed to stdout. Default is **false**.

- **-scanorder** *string*

  This option is supported for reading only. Available since version 1.4.0.

  Specify the scanline order of the input image. Possible values: **TopDown** or **BottomUp**. Default is **TopDown**.

- **-min** *double*

  This option is supported for reading only. Available since version 1.4.0.

  Specify the minimum pixel value to be used for mapping 16-bit input data to 8-bit image values. If not specified or negative, the minimum value found in the image data.

- **-max** *float*

  This option is supported for reading only. Available since version 1.4.0.

  Specify the maximum pixel value to be used for mapping 16-bit input data to 8-bit image values. If not specified or negative, the maximum value found in the image data.

- **-gamma** *double*

  This option is supported for reading only. Available since version 1.4.0.

  Specify a gamma correction to be applied when mapping 16-bit input data to 8-bit image values. Default is **1.0**.

- **-ascii** *bool*

  This option is supported for writing only. Available since version 1.4.0.

  If set to **true**, the file is written in PPM 8-bit ASCII format (P3). Default is **false**, i.e. write in PPM 8-bit binary format (P6).

## SEE ALSO

img, img-bmp, img-dted, img-flir, img-gif, img-ico, img-jpeg, img-pcx, img-pixmap, img-png, img-ppm, img-ps, img-raw, img-sgi, img-sun, img-tga, img-tiff, img-window, img-xbm, img-xpm

## COPYRIGHT

```
Copyright (c) 1995-2024 Jan Nijtmans <nijtmans@users.sourceforge.net>
Copyright (c) 2002-2024 Andreas Kupries <andreas_kupries@users.sourceforge.net>
Copyright (c) 2003-2024 Paul Obermeier <obermeier@users.sourceforge.net>
```
