[gdal-dev] Is there "--config GDAL_TIFF_INTERNAL_MASK YES" C# equivalent???

Dmitriy T. demonbusov1 at yandex.ru
Wed Aug 8 00:17:09 PDT 2018


Thanks .

I did as you said, but could you explain why I get a different result:

Before:

...
string translateOptions = options + translatedFileName + "--config
GDAL_TIFF_INTERNAL_MASK YES";
var gdalTranslateProc = new ProcessStartInfo
{
	Arguments = translateOptions,
	FileName = GdalDir + "\\gdal_translate.exe",
	WindowStyle = ProcessWindowStyle.Hidden,
	CreateNoWindow = true,
	UseShellExecute = true
};

using (Process proc = Process.Start(gdalTranslateProc))
	proc?.WaitForExit();

	
After:

...
string[] translateOptions = options.Split(' ');
var options = new GDALTranslateOptions(translateOptions);

Gdal.SetConfigOption("GDAL_TIFF_INTERNAL_MASK", "YES");
Gdal.wrapper_GDALTranslate(translatedFileName, image, options, null, null);


Next is the call:

var str = " -dstnodata 255 -r bilinear -co PHOTOMETRIC=YCBCR" +
		  " -co COMPRESS=JPEG -co JPEG_QUALITY=100 -co BIGTIFF=YES -co TILED=YES"
+
		  " -tps" + 
		  " -s_srs " + "\"" + proj4SourceStr + "\"" +
		  " -t_srs " + "\"" + proj4TargetStr + "\"" +
		  " \"" + translatedFileName + "\" \"" + warpedFile + "\"";

var gdalWarpProc = new ProcessStartInfo
{
	Arguments = str,
	FileName = GdalDir + "\\gdalwarp.exe",
	WindowStyle = ProcessWindowStyle.Hidden,
	CreateNoWindow = true,
	UseShellExecute = true
};

The "Before" code causes the TRANSPARENT PART of the source .png image to
become white.

But for some reason:
The "After" code causes the ENTIRE of the source .png image to become white.

How to make the "after" code to work as the "before" code?


The common goal is to get rid of an explicit call gdal_translate.exe and
work with c# wrapper (because it does not support the .ecw plugin).

Or an alternative question: why the code "After" supports the .ecw format
automatically, 
but the code "Before" does not support?
How to force the code "Before" to see and to use the .ecw plugin?



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list