Le vendredi 01 novembre 2013 15:56:39, Rahkonen Jukka a écrit : > Hi, > > Yes, it is understandable because there are so many parameters which may be > wrong. I still don't write any other scripts than Windows batch files and > testing the return codes is not my business. I will continue by sorting > the source files as well as I can and running the batch a second time > without YCBCR for the images which were not converted with the first run. > Not a big problem for me really.
Should be something like the following (untested) gdal_translate src.tif out.tif -co PHOTOMETRIC=YCBCR if %ERRORLEVEL% == 0 ( echo Conversion successfull ) else ( echo Retrying without YCBCR gdal_translate src.tif out.tif ) > > -Jukka- > > Even Rouault wrote: > > Jukka, > > > > It is difficult to guess if the option specified by the user is something > > that he wants absolutely to be honoured (and in case it is not possible, > > an error is expected), or if it is just a hint that can be ignored if > > necessary. So the current behaviour seems OK to me. > > > > Your script could just test the return code of gdal_translate and, in > > case of error, try again without -co PHOTOMETRYC=YCBCR. Or check before > > if the input dataset is 3 bands or not. > > > > Even > > > > > Hi, > > > > > > Gdal_translate throws > > > ERROR 6: PHOTOMETRIC=YCBCR requires a source raster with only 3 bands > > > (RGB) if user tries to apply YCBCR to non-RGB image. It means that > > > when I have a mixture of RGB and B/W images I must separate them > > > before making batch jobs. > > > > > > I think that nothing bad would happen if gdal_translate in such case > > > just throws a warning and continues by compressing black and white > > > image with the default photometric settings. > > > > > > -Jukka Rahkonen- > > > > > > _______________________________________________ > > > gdal-dev mailing list > > > gdal-dev@lists.osgeo.org > > > http://lists.osgeo.org/mailman/listinfo/gdal-dev > > > > -- > > Geospatial professional services > > http://even.rouault.free.fr/services.html > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Geospatial professional services http://even.rouault.free.fr/services.html _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev