1gdal_translate(1)           General Commands Manual          gdal_translate(1)
2
3
4

NAME

6       gdal_translateConverts raster data between different formats.
7

SYNOPSIS

9       gdal_translate [--help-general]
10              [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
11                    CInt16/CInt32/CFloat32/CFloat64}] [-strict]
12              [-of format] [-b band]* [-mask band] [-expand {gray|rgb|rgba}]
13              [-outsize xsize[%]|0 ysize[%]|0] [-tr xres yres]
14              [-r {nearest,bilinear,cubic,cubicspline,lanczos,average,mode}]
15              [-unscale] [-scale[_bn] [src_min src_max [dst_min dst_max]]]* [-exponent[_bn] exp_val]*
16              [-srcwin xoff yoff xsize ysize] [-epo] [-eco]
17              [-projwin ulx uly lrx lry] [-projwin_srs srs_def]
18              [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value]
19              [-a_scale value] [-a_offset value]
20              [-nogcp] [-gcp pixel line easting northing [elevation]]*
21              |-colorinterp{_bn} {red|green|blue|alpha|gray|undefined}]
22              |-colorinterp {red|green|blue|alpha|gray|undefined},...]
23              [-mo "META-TAG=VALUE"]* [-q] [-sds]
24              [-co "NAME=VALUE"]* [-stats] [-norat]
25              [-oo NAME=VALUE]*
26              src_dataset dst_dataset
27

DESCRIPTION

29       The gdal_translate utility can be used to convert raster data between
30       different formats, potentially performing some operations like
31       subsettings, resampling, and rescaling pixels in the process.
32
33       -ot: type
34           For the output bands to be of the indicated data type.
35
36       -strict:
37           Don't be forgiving of mismatches and lost data when translating to
38           the output format.
39
40       -of format:
41           Select the output format. Starting with GDAL 2.3, if not specified,
42           the format is guessed from the extension (previously was GTiff).
43           Use the short format name.
44
45       -b band:
46           Select an input band band for output. Bands are numbered from 1.
47           Multiple -b switches may be used to select a set of input bands to
48           write to the output file, or to reorder bands. Starting with GDAL
49           1.8.0, band can also be set to 'mask,1' (or just 'mask') to mean
50           the mask band of the first band of the input dataset.
51
52       -mask band:
53           (GDAL >= 1.8.0) Select an input band band to create output dataset
54           mask band. Bands are numbered from 1. band can be set to 'none' to
55           avoid copying the global mask of the input dataset if it exists.
56           Otherwise it is copied by default ('auto'), unless the mask is an
57           alpha channel, or if it is explicitly used to be a regular band of
58           the output dataset ('-b mask'). band can also be set to 'mask,1'
59           (or just 'mask') to mean the mask band of the 1st band of the input
60           dataset.
61
62       -expand gray|rgb|rgba:
63           (From GDAL 1.6.0) To expose a dataset with 1 band with a color
64           table as a dataset with 3 (RGB) or 4 (RGBA) bands. Useful for
65           output drivers such as JPEG, JPEG2000, MrSID, ECW that don't
66           support color indexed datasets. The 'gray' value (from GDAL 1.7.0)
67           enables to expand a dataset with a color table that only contains
68           gray levels to a gray indexed dataset.
69
70       -outsize xsize[%]|0 ysize[%]|0:
71           Set the size of the output file. Outsize is in pixels and lines
72           unless '%' is attached in which case it is as a fraction of the
73           input image size. Starting with GDAL 2.0, if one of the 2 values is
74           set to 0, its value will be determined from the other one, while
75           maintaining the aspect ratio of the source dataset.
76
77       -tr xres yres :
78           (starting with GDAL 2.0) set target resolution. The values must be
79           expressed in georeferenced units. Both must be positive values.
80           This is mutually exclusive with -outsize and -a_ullr.
81
82       -r {nearest (default),bilinear,cubic,cubicspline,lanczos,average,mode}:
83           (GDAL >= 2.0) Select a resampling algorithm.
84
85       -scale [src_min src_max [dst_min dst_max]]:
86           Rescale the input pixels values from the range src_min to src_max
87           to the range dst_min to dst_max. If omitted the output range is 0
88           to 255. If omitted the input range is automatically computed from
89           the source data. Before GDAL 1.11, it can be specified only once,
90           and in that case, it applies to all bands of the output dataset.
91           Starting with GDAL 1.11, -scale can be repeated several times (if
92           specified only once, it also applies to all bands of the output
93           dataset), so as to specify per band parameters. It is also possible
94           to use the '-scale_bn' syntax where bn is a band number (e.g.
95           '-scale_2' for the 2nd band of the output dataset) to specify the
96           parameters of one or several specific bands.
97
98       -exponent  exp_val:
99           (From GDAL 1.11) To apply non-linear scaling with a power function.
100           exp_val is the exponent of the power function (must be positive).
101           This option must be used with the -scale option. If specified only
102           once, -exponent applies to all bands of the output image. It can be
103           repeated several times so as to specify per band parameters. It is
104           also possible to use the '-exponent_bn' syntax where bn is a band
105           number (e.g. '-exponent_2' for the 2nd band of the output dataset)
106           to specify the parameters of one or several specific bands.
107
108       -unscale:
109           Apply the scale/offset metadata for the bands to convert scaled
110           values to unscaled values. It is also often necessary to reset the
111           output datatype with the -ot switch.
112
113       -srcwin xoff yoff xsize ysize:
114           Selects a subwindow from the source image for copying based on
115           pixel/line location.
116
117       -projwin ulx uly lrx lry:
118           Selects a subwindow from the source image for copying (like
119           -srcwin) but with the corners given in georeferenced coordinates
120           (by default expressed in the SRS of the dataset. Can be changed
121           with -projwin_srs). Note: in GDAL 2.1.0 and 2.1.1, using -projwin
122           with coordinates not aligned with pixels will result in a sub-pixel
123           shift. This has been corrected in later versions. When selecting
124           non-nearest neighbour resampling, starting with GDAL 2.1.0, sub-
125           pixel accuracy is however used to get better results.
126
127       -projwin_srs srs_def:
128           (GDAL >= 2.0) Specifies the SRS in which to interpret the
129           coordinates given with -projwin. The srs_def may be any of the
130           usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file
131           containing the WKT. Note that this does not cause reprojection of
132           the dataset to the specified SRS.
133
134       -epo: (Error when Partially Outside)
135           (GDAL >= 1.10) If this option is set, -srcwin or -projwin values
136           that falls partially outside the source raster extent will be
137           considered as an error. The default behaviour starting with GDAL
138           1.10 is to accept such requests, when they were considered as an
139           error before.
140
141       -eco: (Error when Completely Outside)
142           (GDAL >= 1.10) Same as -epo, except that the criterion for erroring
143           out is when the request falls completely outside the source raster
144           extent.
145
146       -a_srs srs_def:
147           Override the projection for the output file. The srs_def may be any
148           of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file
149           containing the WKT. No reprojection is done.
150
151       -a_scale value:
152           (GDAL >=2.3 )Set band scaling value(no modification of pixel values
153           is done)
154
155       -a_offset value:
156           (GDAL >=2.3 )Set band offset value (no modification of pixel values
157           is done)
158
159       -a_ullr ulx uly lrx lry:
160           Assign/override the georeferenced bounds of the output file. This
161           assigns georeferenced bounds to the output file, ignoring what
162           would have been derived from the source file. So this does not
163           cause reprojection to the specified SRS.
164
165       -a_nodata value:
166           Assign a specified nodata value to output bands. Starting with GDAL
167           1.8.0, can be set to none to avoid setting a nodata value to the
168           output file if one exists for the source file. Note that, if the
169           input dataset has a nodata value, this does not cause pixel values
170           that are equal to that nodata value to be changed to the value
171           specified with this option.
172
173       -colorinterp_X red|green|blue|alpha|gray|undefined:
174           (GDAL >= 2.3) Override the color interpretation of band X (where X
175           is a valid band number, starting at 1)
176
177       -colorinterp
178       red|green|blue|alpha|gray|undefined[,red|green|blue|alpha|gray|undefined]*:
179           (GDAL >= 2.3) Override the color interpretation of all specified
180           bands. For example -colorinterp red,green,blue,alpha for a 4 band
181           output dataset.
182
183       -mo 'META-TAG=VALUE':
184           Passes a metadata key and value to set on the output dataset if
185           possible.
186
187       -co 'NAME=VALUE':
188           Passes a creation option to the output format driver. Multiple -co
189           options may be listed. See format specific documentation for legal
190           creation options for each format.
191
192       -nogcp
193           Do not copy the GCPs in the source dataset to the output dataset.
194
195       -gcp pixel line easting northing elevation:
196           Add the indicated ground control point to the output dataset. This
197           option may be provided multiple times to provide a set of GCPs.
198
199       -q:
200           Suppress progress monitor and other non-error output.
201
202       -sds:
203           Copy all subdatasets of this file to individual output files. Use
204           with formats like HDF or OGDI that have subdatasets. The output
205           file naming scheme has changed in GDAL 1.11 (e.g. ofile_1.tif,
206           ofile_2.tif).
207
208       -stats:
209           (GDAL >= 1.8.0) Force (re)computation of statistics.
210
211       -norat
212           (GDAL >= 1.11) Do not copy source RAT into destination dataset.
213
214       -oo NAME=VALUE:
215           (starting with GDAL 2.0) Dataset open option (format specific)
216
217       src_dataset:
218           The source dataset name. It can be either file name, URL of data
219           source or subdataset name for multi-dataset files.
220
221       dst_dataset:
222           The destination file name.
223

C API

225       Starting with GDAL 2.1, this utility is also callable from C with
226       GDALTranslate().
227

EXAMPLE

229       gdal_translate -of GTiff -co "TILED=YES" utm.tif utm_tiled.tif
230
231       Starting with GDAL 1.8.0, to create a JPEG-compressed TIFF with
232       internal mask from a RGBA dataset :
233
234       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
235
236
237       Starting with GDAL 1.8.0, to create a RGBA dataset from a RGB dataset
238       with a mask :
239
240       gdal_translate withmask.tif rgba.tif -b 1 -b 2 -b 3 -b mask
241
242

AUTHORS

244       Frank Warmerdam warmerdam@pobox.com, Silke Reimer silke@intevation.de
245
246
247
248GDAL                            Tue Mar 3 2020               gdal_translate(1)
Impressum