.TH "gdal_translate" 1 "Sun Apr 9 2017" "GDAL" \" -*- nroff -*- .ad l .nh .SH NAME gdal_translategdal_translate \- converts raster data between different formats .SH "SYNOPSIS" .PP .PP .nf gdal_translate [--help-general] [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/ CInt16/CInt32/CFloat32/CFloat64}] [-strict] [-of format] [-b band]* [-mask band] [-expand {gray|rgb|rgba}] [-outsize xsize[%]|0 ysize[%]|0] [-tr xres yres] [-r {nearest,bilinear,cubic,cubicspline,lanczos,average,mode}] [-unscale] [-scale[_bn] [src_min src_max [dst_min dst_max]]]* [-exponent[_bn] exp_val]* [-srcwin xoff yoff xsize ysize] [-epo] [-eco] [-projwin ulx uly lrx lry] [-projwin_srs srs_def] [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value] [-gcp pixel line easting northing [elevation]]* [-mo "META-TAG=VALUE"]* [-q] [-sds] [-co "NAME=VALUE"]* [-stats] [-norat] [-oo NAME=VALUE]* src_dataset dst_dataset .fi .PP .SH "DESCRIPTION" .PP The gdal_translate utility can be used to convert raster data between different formats, potentially performing some operations like subsettings, resampling, and rescaling pixels in the process\&. .PP .IP "\fB\fB-ot\fP: \fItype\fP\fP" 1c For the output bands to be of the indicated data type\&. .IP "\fB\fB-strict\fP:\fP" 1c Don't be forgiving of mismatches and lost data when translating to the output format\&. .IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c Select the output format\&. The default is GeoTIFF (GTiff)\&. Use the short format name\&. .IP "\fB\fB-b\fP \fIband\fP:\fP" 1c Select an input band \fIband\fP for output\&. Bands are numbered from 1\&. Multiple \fB-b\fP switches may be used to select a set of input bands to write to the output file, or to reorder bands\&. Starting with GDAL 1\&.8\&.0, \fIband\fP can also be set to 'mask,1' (or just 'mask') to mean the mask band of the first band of the input dataset\&. .IP "\fB\fB-mask\fP \fIband\fP:\fP" 1c (GDAL >= 1\&.8\&.0) Select an input band \fIband\fP to create output dataset mask band\&. Bands are numbered from 1\&. \fIband\fP can be set to 'none' to avoid copying the global mask of the input dataset if it exists\&. Otherwise it is copied by default ('auto'), unless the mask is an alpha channel, or if it is explicitly used to be a regular band of the output dataset ('-b mask')\&. \fIband\fP can also be set to 'mask,1' (or just 'mask') to mean the mask band of the 1st band of the input dataset\&. .IP "\fB\fB-expand\fP \fIgray|rgb|rgba\fP:\fP" 1c (From GDAL 1\&.6\&.0) To expose a dataset with 1 band with a color table as a dataset with 3 (RGB) or 4 (RGBA) bands\&. Useful for output drivers such as JPEG, JPEG2000, MrSID, ECW that don't support color indexed datasets\&. The 'gray' value (from GDAL 1\&.7\&.0) enables to expand a dataset with a color table that only contains gray levels to a gray indexed dataset\&. .IP "\fB\fB-outsize\fP \fIxsize[%]|0 ysize[%]|0\fP:\fP" 1c Set the size of the output file\&. Outsize is in pixels and lines unless '%' is attached in which case it is as a fraction of the input image size\&. Starting with GDAL 2\&.0, if one of the 2 values is set to 0, its value will be determined from the other one, while maintaining the aspect ratio of the source dataset\&. .IP "\fB\fB-tr\fP xres yres :\fP" 1c (starting with GDAL 2\&.0) set target resolution\&. The values must be expressed in georeferenced units\&. Both must be positive values\&. This is exclusive with -outsize and -a_ullr\&. .IP "\fB\fB-r\fP \fI{nearest (default),bilinear,cubic,cubicspline,lanczos,average,mode}\fP:\fP" 1c (GDAL >= 2\&.0) Select a resampling algorithm\&. .IP "\fB\fB-scale\fP \fI[src_min src_max [dst_min dst_max]]\fP:\fP" 1c Rescale the input pixels values from the range \fIsrc_min\fP to \fIsrc_max\fP to the range \fIdst_min\fP to \fIdst_max\fP\&. If omitted the output range is 0 to 255\&. If omitted the input range is automatically computed from the source data\&. Before GDAL 1\&.11, it can be specified only once, and in that case, it applies to all bands of the output dataset\&. Starting with GDAL 1\&.11, -scale can be repeated several times (if specified only once, it also applies to all bands of the output dataset), so as to specify per band parameters\&. It is also possible to use the '-scale_bn' syntax where bn is a band number (e\&.g\&. '-scale_2' for the 2nd band of the output dataset) to specify the parameters of one or several specific bands\&. .IP "\fB\fB-exponent\fP \fI exp_val\fP:\fP" 1c (From GDAL 1\&.11) To apply non-linear scaling with a power function\&. exp_val is the exponent of the power function (must be positive)\&. This option must be used with the -scale option\&. If specified only once, -exponent applies to all bands of the output image\&. It can be repeated several times so as to specify per band parameters\&. It is also possible to use the '-exponent_bn' syntax where bn is a band number (e\&.g\&. '-exponent_2' for the 2nd band of the output dataset) to specify the parameters of one or several specific bands\&. .IP "\fB\fB-unscale\fP:\fP" 1c Apply the scale/offset metadata for the bands to convert scaled values to unscaled values\&. It is also often necessary to reset the output datatype with the \fB-ot\fP switch\&. .IP "\fB\fB-srcwin\fP \fIxoff yoff xsize ysize\fP:\fP" 1c Selects a subwindow from the source image for copying based on pixel/line location\&. .IP "\fB\fB-projwin\fP \fIulx uly lrx lry\fP:\fP" 1c Selects a subwindow from the source image for copying (like \fB-srcwin\fP) but with the corners given in georeferenced coordinates (by default expressed in the SRS of the dataset\&. Can be changed with -projwin_srs)\&. Note: in GDAL 2\&.1\&.0 and 2\&.1\&.1, using -projwin with coordinates not aligned with pixels will result in a sub-pixel shift\&. This has been corrected in later versions\&. When selecting non-nearest neighbour resampling, starting with GDAL 2\&.1\&.0, sub-pixel accuracy is however used\&. .IP "\fB\fB-projwin_srs\fP \fIsrs_def\fP:\fP" 1c (GDAL >= 2\&.0) Specifies the SRS in which to interpret the coordinates given with -projwin\&. The \fIsrs_def\fP may be any of the usual GDAL/OGR forms, complete WKT, PROJ\&.4, EPSG:n or a file containing the WKT\&. Note that this does not cause reprojection of the dataset to the specified SRS\&. .IP "\fB\fB-epo\fP: (Error when Partially Outside)\fP" 1c (GDAL >= 1\&.10) If this option is set, \fB-srcwin\fP or \fB-projwin\fP values that falls partially outside the source raster extent will be considered as an error\&. The default behaviour starting with GDAL 1\&.10 is to accept such requests, when they were considered as an error before\&. .IP "\fB\fB-eco\fP: (Error when Completely Outside)\fP" 1c (GDAL >= 1\&.10) Same as \fB-epo\fP, except that the criterion for erroring out is when the request falls completely outside the source raster extent\&. .IP "\fB\fB-a_srs\fP \fIsrs_def\fP:\fP" 1c Override the projection for the output file\&. The \fIsrs_def\fP may be any of the usual GDAL/OGR forms, complete WKT, PROJ\&.4, EPSG:n or a file containing the WKT\&. .IP "\fB\fB-a_ullr\fP \fIulx uly lrx lry\fP:\fP" 1c Assign/override the georeferenced bounds of the output file\&. This assigns georeferenced bounds to the output file, ignoring what would have been derived from the source file\&. So this does not cause reprojection to the specified SRS\&. .IP "\fB\fB-a_nodata\fP \fIvalue\fP:\fP" 1c Assign a specified nodata value to output bands\&. Starting with GDAL 1\&.8\&.0, can be set to \fInone\fP to avoid setting a nodata value to the output file if one exists for the source file\&. Note that, if the input dataset has a nodata value, this does not cause pixel values that are equal to that nodata value to be changed to the value specified with this option\&. .IP "\fB\fB-mo\fP \fI'META-TAG=VALUE'\fP:\fP" 1c Passes a metadata key and value to set on the output dataset if possible\&. .IP "\fB\fB-co\fP \fI'NAME=VALUE'\fP:\fP" 1c Passes a creation option to the output format driver\&. Multiple \fB-co\fP options may be listed\&. See format specific documentation for legal creation options for each format\&. .IP "\fB\fB-gcp\fP \fIpixel line easting northing elevation\fP:\fP" 1c Add the indicated ground control point to the output dataset\&. This option may be provided multiple times to provide a set of GCPs\&. .IP "\fB\fB-q\fP:\fP" 1c Suppress progress monitor and other non-error output\&. .IP "\fB\fB-sds\fP:\fP" 1c Copy all subdatasets of this file to individual output files\&. Use with formats like HDF or OGDI that have subdatasets\&. The output file naming scheme has changed in GDAL 1\&.11 (e\&.g\&. ofile_1\&.tif, ofile_2\&.tif)\&. .IP "\fB\fB-stats\fP:\fP" 1c (GDAL >= 1\&.8\&.0) Force (re)computation of statistics\&. .IP "\fB\fB-norat\fP\fP" 1c (GDAL >= 1\&.11) Do not copy source RAT into destination dataset\&. .IP "\fB\fB-oo\fP \fINAME=VALUE\fP:\fP" 1c (starting with GDAL 2\&.0) Dataset open option (format specific) .IP "\fB\fIsrc_dataset\fP:\fP" 1c The source dataset name\&. It can be either file name, URL of data source or subdataset name for multi-dataset files\&. .IP "\fB\fIdst_dataset\fP:\fP" 1c The destination file name\&. .PP .SH "C API" .PP Starting with GDAL 2\&.1, this utility is also callable from C with GDALTranslate()\&. .SH "EXAMPLE" .PP .PP .nf gdal_translate -of GTiff -co "TILED=YES" utm.tif utm_tiled.tif .fi .PP .PP Starting with GDAL 1\&.8\&.0, to create a JPEG-compressed TIFF with internal mask from a RGBA dataset : .PP .nf gdal_translate rgba.tif withmask.tif -b 1 -b 2 -b 3 -mask 4 -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR --config GDAL_TIFF_INTERNAL_MASK YES .fi .PP .PP Starting with GDAL 1\&.8\&.0, to create a RGBA dataset from a RGB dataset with a mask : .PP .nf gdal_translate withmask.tif rgba.tif -b 1 -b 2 -b 3 -b mask .fi .PP .SH "AUTHORS" .PP Frank Warmerdam warmerdam@pobox.com, Silke Reimer silke@intevation.de