LinuxCommandLibrary

gdal_translate

converts and transforms raster data

TLDR

Convert raster format

$ gdal_translate [input.tif] [output.png]
copy
Convert with specific format
$ gdal_translate -of GTiff [input.png] [output.tif]
copy
Subset by bounds
$ gdal_translate -projwin [ulx] [uly] [lrx] [lry] [input.tif] [output.tif]
copy
Rescale to 8-bit
$ gdal_translate -ot Byte -scale [input.tif] [output.tif]
copy
Set compression
$ gdal_translate -co COMPRESS=LZW [input.tif] [output.tif]
copy
Extract bands
$ gdal_translate -b 1 -b 2 -b 3 [input.tif] [rgb.tif]
copy

SYNOPSIS

gdal_translate [options] src dst

DESCRIPTION

gdal_translate converts raster data between formats, extracts subsets, and applies transformations. It's part of GDAL (Geospatial Data Abstraction Library), the standard for raster geospatial operations.
Common uses include format conversion, creating image pyramids, applying compression, and extracting regions from large datasets.

PARAMETERS

-of format

Output format (GTiff, PNG, JPEG, etc.).
-ot type
Output data type (Byte, Int16, Float32, etc.).
-b band
Select band(s).
-projwin ulx uly lrx lry
Subset by coordinates.
-srcwin xoff yoff xsize ysize
Subset by pixels.
-scale [srcmin srcmax [dstmin dstmax]]
Scale values.
-co NAME=VALUE
Creation option.
-outsize xsize ysize
Output size (pixels or %).
-a_srs srs
Assign spatial reference.
-a_nodata value
Assign nodata value.

CAVEATS

Large files may require significant memory. Some formats don't support all features. Lossy compression loses data. Check gdalinfo for source properties first.

HISTORY

GDAL was started by Frank Warmerdam in 1998 and is now an OSGeo project. gdal_translate is one of the core GDAL utilities, supporting over 150 raster formats.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community