cat for GeoTIFFs. Renders raster files directly in your terminal using half-block ANSI characters via rich-pixels. Works over SSH, in headless environments, and loads fast even for large COGs.
Supports any rasterio-compatible format — GeoTIFF, COG, JPEG2000, NetCDF, and more.
Inspired by Simon Willison
Preview a remote Cloud-Optimised GeoTIFF (TERN soil CEC data):
cogcat https://esoil.io/TERNLandscapes/Public/Products/TERN/SLGA/CEC/CEC_000_005_95_N_P_AU_TRN_N_20220826.tifRun directly without installing:
uvx git+https://github.com/harryeslick/cogcat.gitOr install from GitHub:
uv pip install git+https://github.com/hfsi/cogcat.gitWith matplotlib colourmaps:
uv pip install "cogcat[colourmaps] @ git+https://github.com/hfsi/cogcat.git"cogcat <source> [OPTIONS]
| Argument | Description |
|---|---|
source |
Path or URL to a raster file (required) |
| Option | Short | Default | Description |
|---|---|---|---|
--bands |
-b |
auto | Comma-separated band numbers (e.g. 4,3,2). Negative indexes count from last band (-1 = last). |
--colourmap |
-c |
viridis |
colourmap for single-band display. Built-in: viridis, terrain, grayscale. All matplotlib colourmaps available with [colourmaps] extra. |
--histogram |
-H |
off | Show a pixel value histogram below the image. |
--full |
off | Load the entire raster instead of a terminal-sized subset. May be slow for large files. | |
--window |
-w |
none | Custom read window as xoff,yoff,width,height in pixel coordinates. Negative offsets count from right/bottom edge. |
--no-meta |
off | Hide the metadata panel. | |
--no-inset |
off | Hide the crop extent inset overlay. | |
--timeout |
10 |
URL fetch timeout in seconds. | |
--margin-rows |
2 |
Terminal rows to reserve for the shell prompt. | |
--overview |
none | Render a specific overview level (e.g. 2, 4, 8, 16). |
|
--help |
Show help and exit. |
Preview a local GeoTIFF:
cogcat image.tifSingle-band DEM with terrain colourmap and histogram:
cogcat dem.tif -c terrain --histogramFalse-colour composite (NIR, Red, Green):
cogcat sentinel.tif -b 4,3,2
# accepts python style negative indexes eg `-b -1` to show the last band. Use a specific overview level for a quick look at a large COG:
cogcat large_cog.tif --overview 128Image only, no metadata panel:
cogcat image.tif --no-metaRead a specific region:
cogcat large.tif -w 1000,2000,500,500Run without installing via uvx:
uvx git+https://github.com/harryeslick/cogcat.git https://esoil.io/TERNLandscapes/Public/Products/TERN/SLGA/CEC/CEC_000_005_95_N_P_AU_TRN_N_20220826.tif -c terrainExample with read-window and colourmap
Use within github actions to quickly verify any tiffs in your workflow look as expected.
GitHub Actions runners have no TTY resulting in: no ANSI colour | terminal width not detected.
Solution: Environment variables in the workflow
env:
FORCE_colour: "1"
COLUMNS: "120"See package actions for example
- Opens the raster and reads metadata (CRS, bounds, resolution, bands) without loading pixels.
- Calculates the terminal's available pixel area (columns × rows × 2, using half-block characters).
- Selects the best overview level or reads a center crop to avoid loading unnecessary data.
- Downsamples to terminal size using rasterio's
out_shape. - For multi-band: applies 2–98% percentile stretch per band for good contrast.
- For single-band: applies the selected colourmap.
- Renders using
rich-pixelshalf-block characters.

