Make Cut-and-Glue Globe Strips from a PPM Image with ppmglobe
You will turn a cylindrical projection in a PPM image into strips that can be printed, cut out and glued onto a sphere. The command writes a new PPM image to standard output; it does not alter the source image. Allow about fifteen minutes for the conversion and a little longer if you are preparing a printable layout.
The route
Jump straight to the step you need, or tick off Done means at the end.
This guide uses the ppmglobe installed with Netpbm 11.5.2 on this machine. The local manual page is dated 23 February 2006, so the examples describe the installed command and its documented behaviour rather than assuming that every Netpbm release is identical. You need the netpbm package, a readable cylindrical PPM map and enough columns in that map for the number of strips you request.
1. Check the installed command and the input
Start with read-only checks. No elevated privileges are needed when the image is in a directory you can read and your destination is writable:
$ command -v ppmglobe
/usr/bin/ppmglobe
$ ppmglobe --version
ppmglobe: Using libnetpbm from Netpbm Version: Netpbm 11.5.2
$ pnmfile /path/to/cylindrical-map.ppm
/path/to/cylindrical-map.ppm: PPM raw, 2400 by 1200 maxval 255
Your version banner and pnmfile wording can differ. The useful checks are that the executable resolves, the input is recognised as PPM, and you know its width. ppmglobe expects a cylindrical projection: a normal Mercator map is not automatically corrected into the right projection.
Checkpoint: record the width from pnmfile. The strip count must not be larger than that width. If the width is not evenly divisible by the strip count, the command drops the unused columns at the right edge so that every output strip is whole.
2. Choose a strip count
The first argument is the number of equal-width strips to generate. More strips reduce the stretching, tearing and crumpling caused by fitting flat paper around a sphere, but they also create more cutting and gluing. Start with a count that divides the image width cleanly. For a 2400-column source, 24, 48 or 60 are straightforward choices.
Do not confuse strip count with output resolution or paper size. It controls how many gores are made from the horizontal image, not how large the printed page will be. Test the geometry first, then set print scaling in your image or document application.
3. Generate the globe image into a new file
Pass the strip count and source filename, then redirect standard output to a new destination:
$ ppmglobe 48 /path/to/cylindrical-map.ppm > /path/to/globe-strips.ppm
$ pnmfile /path/to/globe-strips.ppm
/path/to/globe-strips.ppm: PPM raw, 2400 by 1200 maxval 255
The output remains a PPM image with the source dimensions in this check. The strip boundaries and background are encoded in the pixels. The command normally prints no progress report because the image itself is its standard output.
Redirection with > truncates an existing destination before the program has finished. For an output you cannot afford to lose, write a temporary file and replace the old file only after verification:
$ ppmglobe 48 /path/to/cylindrical-map.ppm > /path/to/globe-strips.ppm.new
$ pnmfile /path/to/globe-strips.ppm.new
$ mv /path/to/globe-strips.ppm.new /path/to/globe-strips.ppm
The final mv changes the destination. If conversion fails, leave the original in place and inspect the error; remove the incomplete .new file only when you have confirmed that it is disposable.
4. Use standard input when the map comes from a pipeline
The filename is optional. Without it, ppmglobe reads the PPM image from standard input, which lets you place another Netpbm operation before it:
$ pnmcrop /path/to/cylindrical-map.ppm | ppmglobe 48 > /path/to/cropped-globe-strips.ppm
$ pnmfile /path/to/cropped-globe-strips.ppm
/path/to/cropped-globe-strips.ppm: PPM raw, 2400 by 1200 maxval 255
Only use this form when you know the preceding command produces a complete PPM stream. A broken or truncated pipeline can leave a partial output file even though the destination exists. Check the exit status and the resulting image before printing it.
5. Set the space between strips
The default background colour between strips is black. Choose another named colour with --background when black would blend into the artwork or be difficult to see while cutting:
$ ppmglobe --background=white 48 /path/to/cylindrical-map.ppm > /path/to/globe-strips-white.ppm
The option can also be written with a space, as --background white. The manual accepts unique option abbreviations, but full names are clearer in scripts and instructions. Colour names are parsed by Netpbm, so use a name that your installed colour parser accepts.
Some image formats cannot represent a requested named colour exactly at their selected precision. Without --closeok, ppmglobe fails rather than silently substituting a nearby colour. Add it when the closest representable colour is acceptable:
$ ppmglobe --background=white --closeok 48 /path/to/cylindrical-map.ppm > /path/to/globe-strips-white.ppm
This is a rendering choice, not a repair for a malformed input. If the exact background matters for compositing or a cutting template, omit --closeok and treat a failure as a reason to choose a representable colour or inspect the PPM maxval.
6. Handle the common failures
If the command says there are too few columns for the requested strips, lower the count or use a wider source. For example, asking for four strips from a three-column image fails because a fractional or empty strip is not produced:
$ ppmglobe 4 /path/to/three-column.ppm > /tmp/test.ppm
ppmglobe: You asked for 4 strips, but the image is only 3 pixels wide, so that is impossible.
If the image width does not divide evenly, the rightmost remainder is truncated. That is easy to miss when the map contains an important edge or a longitude seam. Pick a divisor, or inspect the output before printing it.
If the input cannot be read, check the path and permissions without using sudo as a first response:
$ ls -l /path/to/cylindrical-map.ppm
$ test -r /path/to/cylindrical-map.ppm && echo readable
Use elevated privileges only if your system administrator has deliberately placed the input or destination behind an access boundary. The conversion itself does not require root. Keep the original map until the strips have been viewed and the output dimensions have been checked.
Done means
ppmglobeand the Netpbm version were checked on the target machine.- The source is a readable cylindrical PPM projection, and its width is known.
- The strip count is no greater than the source width, preferably a clean divisor.
- The output was redirected to a new file and verified with
pnmfilebefore printing. - The background colour and
--closeokchoice match the accuracy you need. - The original image remains available if the output needs to be regenerated.