PNMMONTAGE(1)
π PNMMONTAGE π
okay bestie, welcome to the Pnmmontage User Manual (that's section 1 of the manual, general commands) β¨ this one's a classic Netpbm baddie and she's about to pack your pics like a pro π
πΈ NAME πΈ
pnmmontage β create a montage of PNM images
like, a collage. but make it compute. π¦
β¨ SYNOPSIS β¨
pnmmontage
[-header=headerfile]
[-quality=n]
[-prefix=prefix]
[-0|-1|-2|...|-9]
[-data=filename]
pnmfile...
π DESCRIPTION π
okay so first things first: this program is part of Netpbm(1). she's in the family, she knows people. π
pnmmontage packs images of differing sizes into a minimum-area composite image. that's the whole flex. different sizes, one big image, smallest possible footprint. it's giving tetris but for pixels π§©β¨
and listen β any areas of the output that cannot be occupied by an image are black. no filling, no stretching, no vibes, just black. π€
π OPTIONS π
so on top of the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pnmmontage recognizes these following command line options, bestie:
-data=filenameβ this one makespnmmontagewrite a file describing, in machine-readable form, the positions of the original images inside the packed image. here's an example, look at her:
:0:0:227:298
../image1.ppm:0:0:227:149
../image2.ppm:0:149:227:149
there is a line for each component image and one for the composite. π«
the 5 fields on each line are:
- source image name (or null string indicating the line for the composite image)
- Column number of upper left corner of the image
- Row number of upper left corner of the image
- width of the image (columns)
- height of the image (rows)
this option was new in Netpbm 10.6 (July 2002). a lil retro moment π
-header=filenameβ tellspnmmontageto write a C header file of the locations of the original images within the packed image. each original image generates four#defineswithin the packed file:xxxX,xxxY,xxxSZX, andxxxSZY, wherexxxis the name of the file, converted to all uppercase. the output also includes#definesOVERALLXandOVERALLY, which specifies the total size of the montage image. π
here's an example:
#define OVERALLX 227
#define OVERALLY 298
#define X 0
#define Y 0
#define SZX 227
#define SZY 149
#define X 0
#define Y 149
#define SZX 227
#define SZY 149
-prefixβ tellspnmmontageto use the specified prefix on all of the#definesit generates. tiny addition, big organizational energy π-qualityβ okay this one's the brain of the operation. before attempting to place the subimages,pnmmontagewill calculate a minimum possible area for the montage; this is either the total of the areas of all the subimages, or the width of the widest subimage times the height of the tallest subimage, whichever is greater. thenpnmmontageinitiates a problem-space search to find the best packing; if it finds a solution that is (at least) as good as the minimum area times the quality as a percent, it will break out of the search. so-quality=100will find the best possible solution; however, it may take a very long time to do so π the default is-quality=200.-0,-1, ...-9β these options control the quality at a higher level than-quality;-0is the worst quality (pick the first solution found), while-9is the best quality (perform an exhaustive search of problem space for the absolute best packing). the higher the number, the slower the computation. the default is-5. β
not me reminding you that higher number = slower. she's thorough, not fast. π
π NOTES π
Using -9 is very slow on all but the smallest image sets. like, go make a snack, bestie. π
The minimum area arrangement is often not a convenient shape. for example, it might be a tall, thin column of images, when you'd rather have something more square. to force a minimum width or height, you can include a strut image β a black image that wide and one pixel high. similarly, you can use a vertical strut to force a minimum height. π§ it's giving scaffolding, and honestly? iconic.
π«Ά SEE ALSO π«Ά
pamcat(1), pnmindex(1), pnm(1), pam(1), pbm(1), pgm(1), ppm(1)
(the whole friend group π)
π HISTORY π
pnmmontage was new in Netpbm 9.10 (January 2001). a true elder of the squad β¨
π AUTHOR π
Copyright (C) 2000 by Ben Olmstead.
π DOCUMENT SOURCE π
this manual page was generated by the Netpbm tool makeman from HTML source. the master documentation is at
http://netpbm.sourceforge.net/doc/pnmmontage.html
and that's the whole page, bestie π¦ this was the Pnmmontage User Manual(1), part of the netpbm documentation, dated 22 November 2012. no cap, go pack some pixels π β¨πΈ
π¦ where this page comes from
- debian trixie: netpbm 2:11.10.02-1 Β· MIT
- ubuntu noble: netpbm 2:11.05.02-1.1build1 Β· MIT
- ubuntu resolute: netpbm 2:11.10.02-1build1 Β· MIT
- ubuntu stonking: netpbm 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms