# man > fitstopnm(1)

---
type: CommandReference
command: fitstopnm
mode: man
section: "1"
source: man-pages
---

## Quick Reference

- `fitstopnm path/to/file.fits > path/to/output.pnm` — Convert a FITS file to a PNM image
- `fitstopnm -image z_position path/to/file.fits > path/to/output.pnm` — Convert the image at a given position on the third axis

## Name

Convert a FITS file into a portable anymap.

## Synopsis

**fitstopnm** [**-image** _N_] [**-noraw**] [**-scanmax**] [**-printmax**] [**-min** _f_] [**-max** _f_] [_FITSfile_]

## Options

- `-image N` — For FITS files with three axes (NAXIS=3), select the image at position _N_ on the third axis.
- `-noraw` — Force output of an ASCII portable anymap instead of the default raw format.
- `-scanmax` — Force scanning the data for min/max even when `DATAMIN` / `DATAMAX` keywords exist in the header.
- `-printmax` — Print the min and max values of the image data and exit.
- `-min f` — Override the minimum value used for scaling (default from header or data).
- `-max f` — Override the maximum value used for scaling (default from header or data).

All flags can be abbreviated to their shortest unique prefix.

## Examples

shell
# Convert a FITS file to a PNM image (standard usage)
fitstopnm path/to/file.fits > path/to/output.pnm

# Convert a specific image from a multi‑image FITS file
fitstopnm -image 2 path/to/file.fits > path/to/output.pnm
If the output is upside‑down, pipe through `pnmflip -tb`.

## See Also

- [pnmtofits(1)](https://man.archlinux.org/man/pnmtofits.1)
- [pgm(5)](https://man.archlinux.org/man/pgm.5)
- [pnmflip(1)](https://man.archlinux.org/man/pnmflip.1)