img-ppm(3tk)
π img-ppm π
okay bestie, so this is the manual for img-ppm, part of the Img crew β it's the handler for the Portable pixmap format aka ppm. version 2.1, manual section 3tk. let's get into it π¦
β¨ NAME β¨
img-ppm β Portable pixmap format (ppm). that's the whole vibe. π
β¨ SYNOPSIS β¨
package require img::ppm ?2.1?
yes the ?2.1? is optional, she's flexible like that π
β¨ DESCRIPTION β¨
so, first thing, no cap:
package require img::ppm
like literally every package in Img, this one does not hand you brand-new commands. it's not giving "new command" energy, it's giving "glow-up the command you already have" energy β¨ β specifically it extends the existing Tk image command so that it can handle files with raster images in the Portable pixmap format (ppm). more precisely, img::ppm extends Tk's photo image type (https://www.tcl.tk/man/tcl9.0/TkCmd/photo.html).
the new format handler's name is ppm. this handler serves up some extra configuration options. go look at the Options section for the full tea, iykyk.
all of the above means that when you make a call like
image create photo ?name? ?options?
then:
- image data in
ppmformat (the options-dataand-file) gets detected automatically β no manual effort, she just knows π₯ - the format name
ppmis recognized by the option-format.
plus, the value of the option -format is treated as a list, and that list may contain any of the special options listed in the Options section. so you can stack them in there, periodt.
and one more thing: the package img::ppm is a sub-package of Img. you can load it as part of the complete Img support via package require Img, or on its own via package require img::ppm. your choice, both slay π
π SUPPORTED TYPES π
this handler supports the PPM (Truecolor) and PGM (Grayscale) image formats. and 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. π
and here's the whole read/write situation, straight up:
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 |
so like, reading? she eats everything. writing? only the 8-bit PPM girls get to go out π note that the ASCII/BINARY 16-bit PPM and all the PGM writing columns are a hard No.
π OPTIONS π
the handler provides the following options:
-verbosebool β supported for reading and writing. available since version1.4.0. if you set it to true, extra info about the read or written image gets printed tostdout. default isfalse.-scanorderstring β supported for reading only. available since version1.4.0. specify the scanline order of the input image. possible values:TopDownorBottomUp. default isTopDown.-mindouble β supported for reading only. available since version1.4.0. specify the minimum pixel value used for mapping 16-bit input data to 8-bit image values. if it's not specified, or if it's negative, you get the minimum value found in the image data.-maxfloat β supported for reading only. available since version1.4.0. specify the maximum pixel value used for mapping 16-bit input data to 8-bit image values. if it's not specified, or if it's negative, you get the maximum value found in the image data.-gammadouble β supported for reading only. available since version1.4.0. specify a gamma correction to be applied when mapping 16-bit input data to 8-bit image values. default is1.0.-asciibool β supported for writing only. available since version1.4.0. if you set it to true, the file is written in PPM 8-bit ASCII format (P3). default isfalse, i.e. write in PPM 8-bit binary format (P6).
lowkey important:-scanorder,-min,-maxand-gammaare read-side only, and-asciiis write-side only. don't come for her when they don't do anything on the other side, she told you upfront π«Ά
πΈ 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
the whole friendship circle, we love a supportive squad π
π COPYRIGHT π
Copyright (c) 1995-2025 Jan Nijtmans <nijtmans@users.sourceforge.net>
Copyright (c) 2002-2025 Andreas Kupries <andreas_kupries@users.sourceforge.net>
Copyright (c) 2003-2025 Paul Obermeier <obermeier@users.sourceforge.net>
and that's the whole page bestie π this was img-ppm version 2.1, from the img-ppm(3tk) manual, dated 2.1. stan the maintainers, they've been holding it down since 1995 π«Άβ¨ bye!! πππ
π¦ where this page comes from
- ubuntu resolute: libtk-img-doc 1:2.1.0+dfsg1-1 Β· Tcl
- ubuntu stonking: libtk-img-doc 1:2.1.1+dfsg1-2 Β· Tcl
- Copyright (c) 1995-2025 Jan Nijtmans <nijtmans@users\&.sourceforge\&.net>
- Copyright (c) 2002-2025 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- Copyright (c) 2003-2025 Paul Obermeier <obermeier@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms