# PNM — Netpbm Portable Any Map (PNM/PPM/PGM)

> PNM (Netpbm Portable Any Map (PNM/PPM/PGM)): Simple uncompressed bitmap family of the Netpbm toolkit covering PBM, PGM and PPM images without georeferencing. Specs, software and free sample files; convert PNM to 50 formats online.

- Page: https://beta.mygeodata.cloud/formats/pnm



## What is a PNM file?

PNM (Portable Any Map) is the collective name for the simple image formats of the Netpbm toolkit, which grew out of Jef Poskanzer's Pbmplus package. It covers PBM for bilevel images, PGM for grayscale and PPM for RGB colour. Each file starts with a magic number from P1 to P6, followed by the image width, height and, for PGM and PPM, a maximum sample value. P1 to P3 store pixel values as ASCII text, while P4 to P6 store them in binary.

The formats are used mainly as an interchange and intermediate format in image processing pipelines because they are trivial to read and write. Data is always uncompressed, so files are large. PGM and PPM support 8-bit samples and, with a maximum value above 255, 16-bit samples. The format has no notion of coordinates or projections, so in GIS workflows georeferencing must be supplied through world files and .prj sidecars.

PNM files usually come from command-line image tools, scientific or academic software, and scripts that need a format with no library dependencies. Check the magic number first: P1–P3 are plain text, P4–P6 are binary, and the extension (pbm, pgm, ppm) tells you whether the data is bilevel, grayscale or colour. Files are uncompressed and can be very large. They carry no coordinates, so keep any world file or .prj sidecar with the image.

### Technical details

| | |
|---|---|
| Full name | Netpbm Portable Any Map (PNM/PPM/PGM) |
| Data type | Raster · Image & imagery |
| File extension | .pnm, .ppm, .pgm, .pbm |
| Files | Single file |
| Media type | image/x-portable-anymap |
| Bands | 1 (PBM/PGM) or 3 (PPM). |
| Pixel types | 1-bit, 8/16-bit unsigned |
| Compression | None |
| Coordinate system | Sidecar file (world file / .aux.xml) |
| Converter support | Read & write |
| Typical software | Netpbm, GDAL/OGR, QGIS, ImageMagick, GIMP, IrfanView |
| Specification | https://netpbm.sourceforge.net/ |

### Specifications & references

- https://netpbm.sourceforge.net/
- https://gdal.org/en/stable/drivers/raster/pnm.html

### Sample PNM files — free download

- [Shaded relief (PPM)](https://beta.mygeodata.cloud/static/landing/samples/v1/pnm/st-helena-relief-pnm.zip) — Colour shaded relief of Saint Helena (hypsometric tint × multidirectional hillshade) from Copernicus DEM, 20 m, 8-bit RGB, UTM zone 30S. Binary PPM; georeferenced by a world file and .aux.xml (crs). (772.7 kB, EPSG:32730)

### Convert PNM to other formats

- [PNM to TIF](https://beta.mygeodata.cloud/converter/pnm-to-tif)
- [PNM to JPG](https://beta.mygeodata.cloud/converter/pnm-to-jpg)
- [PNM to HFA](https://beta.mygeodata.cloud/converter/pnm-to-hfa)
- [PNM to KMZ raster](https://beta.mygeodata.cloud/converter/pnm-to-kmz-raster)
- [PNM to JP2](https://beta.mygeodata.cloud/converter/pnm-to-jp2)
- [PNM to GRD](https://beta.mygeodata.cloud/converter/pnm-to-grd)
- [PNM to MBTiles raster](https://beta.mygeodata.cloud/converter/pnm-to-mbtiles-raster)
- [PNM to BIL](https://beta.mygeodata.cloud/converter/pnm-to-bil)
- [PNM to DEM](https://beta.mygeodata.cloud/converter/pnm-to-dem)
- [PNM to XYZ](https://beta.mygeodata.cloud/converter/pnm-to-xyz)
- [PNM to GeoPDF raster](https://beta.mygeodata.cloud/converter/pnm-to-geopdf-raster)
- [PNM to PNG](https://beta.mygeodata.cloud/converter/pnm-to-png)
- [PNM to netCDF raster](https://beta.mygeodata.cloud/converter/pnm-to-netcdf-raster)
- [PNM to RST](https://beta.mygeodata.cloud/converter/pnm-to-rst)
- [PNM to AAIGrid](https://beta.mygeodata.cloud/converter/pnm-to-aaigrid)
- [PNM to WEBP](https://beta.mygeodata.cloud/converter/pnm-to-webp)
- [PNM to BMP](https://beta.mygeodata.cloud/converter/pnm-to-bmp)
- [PNM to ENVI](https://beta.mygeodata.cloud/converter/pnm-to-envi)

## Frequently asked questions

### What is the difference between PBM, PGM and PPM?

They differ in sample type. PBM stores 1-bit black and white pixels, PGM stores grayscale values and PPM stores RGB colour. PNM is the collective name for all three.

### Why is my PNM file so large compared with a PNG or JPEG?

PNM data is never compressed. Binary variants (P4–P6) store raw samples, and the ASCII variants (P1–P3) are even larger because every value is written as text. Converting to a compressed format such as PNG or GeoTIFF reduces the size considerably.

### Can a PNM file hold georeferencing or an alpha channel?

No. PNM has no fields for coordinates, projections or transparency, and it supports only 1 channel (PBM/PGM) or 3 channels (PPM). Location has to come from a separate world file or .prj sidecar.

### What is a PNM file?

PNM (Portable Any Map) is the collective name for the simple image formats of the Netpbm toolkit, which grew out of Jef Poskanzer's Pbmplus package. It covers PBM for bilevel images, PGM for grayscale and PPM for RGB colour. Each file starts with a magic number from P1 to P6, followed by the image width, height and, for PGM and PPM, a maximum sample value. P1 to P3 store pixel values as ASCII text, while P4 to P6 store them in binary.

The formats are used mainly as an interchange and intermediate format in image processing pipelines because they are trivial to read and write. Data is always uncompressed, so files are large. PGM and PPM support 8-bit samples and, with a maximum value above 255, 16-bit samples. The format has no notion of coordinates or projections, so in GIS workflows georeferencing must be supplied through world files and .prj sidecars.

### How do I open a PNM file?

PNM files can be opened in Netpbm, GDAL/OGR, QGIS, ImageMagick and GIMP. Without any software you can preview and convert them online in MyGeodata Cloud.

### What can I convert PNM to?

Popular conversions are TIF, JPG, HFA, KMZ raster, JP2 and GRD. In total the Converter writes PNM data to 50 formats.

### How do I create a PNM file?

Convert existing data to PNM — for example from HFA, JPG, TIF, BIL and DEM. Upload the file, choose PNM as output and download the result.

