Take the 2-minute tour ×

I would like to convert more than 300 orthophotos produced at scale 1:8.000 with a pixel size of 0.8m X 0.8m from Ecw format to Tiff format and after resampling pixel values.

My aim is to batch convert the input format (Ecw) to output format (Tiff) and after to resample the pixel size (values) 10mX10m.

How could I right this script using gdal to batch process this raster files.

I'm using FWTools on Windows XP


share|improve this question
possible duplicate of How to resample a batch of rasters using OGR/GDAL? –  iant May 18 '12 at 7:34

3 Answers 3

You might want to consider using gdalwarp instead of gdal_translate as it gives you the ability to control the output pixel size more precisely.


gdalwarp -tr 10 10 src.ecw dst.tif

You can also specify a variety of resampling kernels. For such radical downsizing averaging might be appropriate.

eg. for %i in (*.ecw) do gdalwarp -ps 10 10 -r average %i %~new_resize.tif

share|improve this answer
Thanks you Aragon and Frank for your answers to my question. This would be helpfull for me. I'll give you sowme feet-back about the processing to see if all work fine. Regards Regards –  Gabriel Giroux May 20 '12 at 0:37

you can do with this way:

for %i in (*.ecw) do gdal_translate -of GTIFF -scale -size 10% 10% %i %~new_resize.tif

i hope it helps you....

share|improve this answer
Hi Aragon, Thank you for your answer, I'll give it a try and i'll get back to you –  Gabriel Giroux May 18 '12 at 12:57
I'll note that -scale is for scaling from 16bit pixels to 8bit, not for spatial rescaling. Also 10% won't quite give 10m pixels from 0.8m input pixels. –  Frank Warmerdam May 19 '12 at 21:35

Sorry for not being able to give you my feed-backs regarding my request on how writing a batch script to convert and resample multiple orthophotos from one directory to another.

The reason is because I was working on another project that was very urgent. So yesterday I took the time to look at the code that Frank provided to suit my case, adding some parameters. The only thing I noticed is that under Windows you need to write a double wildcard to run the script.

Here is my final script.

Thank you for your help much appreciated.

cd /d "E:\Imagerie\Ortho_2009\ortho2009_10cm\RGB\"
for %%f in ("*.ecw") do gdalwarp -s_srs EPSG:26918 -t_srs EPSG:32188 -r cubic -tr 10 10 -of GTiff -co "TFW=YES" "%%~nxf" "E:\Imagerie\Ortho_2009\Ortho_test\result_gtiff/%%~nf.tiff"
cd /d %OLDDIR%

Thank you guys...

share|improve this answer

Your Answer


