[gdal-dev] Nodata is None, but still has blanks?

Matt.Wilkie at yukon.ca Matt.Wilkie at yukon.ca
Wed Jan 19 15:22:26 PST 2022


Tiffsplit works smoothly and easily. I appreciate adding it to my long term tool kit. For my current project it’s great as an exploration and learning but as it turns out I found a more efficient route for my current project.

The out.tif that split creates for the mask band is a 3 band RGB even though it looks like only the first band has any info in it. That’s not really a problem except that cleaning it up later adds a step (in addition to re-applying the georeferencing). However I discovered that I actually can use gdal_translate out of the box by using environment settings:

set GDAL_TIFF_INTERNAL_MASK=NO
gdal_translate sample-internal-mask.tif out.tif

…will move the internal mask to an external file,  out.tif.msk, that can then be manipulated (a la Gimp recipe posted earlier) or discarded as needed.

It seems that using an environment setting is required. Attempts to use -co and --config  “GDAL_TIFF_INTERNAL_MASK=NO” resulted in a warning or error respectively:

Warning 6: driver GTiff does not support creation option GDAL_TIFF_INTERNAL_MASK

FAILURE: No target dataset specified.

cheers,

-Matt

From: Even Rouault <even.rouault at spatialys.com>
Sent: January 18, 2022 4:21 AM
To: Frank Warmerdam <warmerdam at pobox.com>; Matt.Wilkie <Matt.Wilkie at yukon.ca>
Cc: gdal dev <gdal-dev at lists.osgeo.org>
Subject: Re: [gdal-dev] Nodata is None, but still has blanks?

>  I find that if I do:
tiffcp sample-no-mask.tif,0 x0.tif

I get an "x0.tif" with just the jpeg image, and not the mask.  That may be helpful for you (without uncompressing the jpeg image).

tiffcp doesn't use the raw interface of libtiff, hence JPEG decompression&recompression will occur.

tiffsplit avoids that as it does use the raw interface:

tiffsplit sample-no-mask.tif out

will generate a outaaa.tif file with the original JPEG content (the geotif tags will be lost however, and will have to be reinjected https://github.com/OSGeo/gdal/blob/master/swig/python/gdal-utils/osgeo_utils/samples/gdalcopyproj.py<https://imsva91-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2fgithub.com%2fOSGeo%2fgdal%2fblob%2fmaster%2fswig%2fpython%2fgdal%2dutils%2fosgeo%5futils%2fsamples%2fgdalcopyproj.py&umid=B38C0EF4-D5D9-7605-8E85-D961C3CFDB4A&auth=c132af8ee7c9d1278d61a701569070a095ce962e-99d2fc4ea472c846533a93775fde3b12fb6fdbbe> for example)

Even

--

http://www.spatialys.com<https://imsva91-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.spatialys.com&umid=B38C0EF4-D5D9-7605-8E85-D961C3CFDB4A&auth=c132af8ee7c9d1278d61a701569070a095ce962e-da8823f42eeaed576a737271c27f693b63c86c21>

My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220119/21cc326a/attachment.html>


More information about the gdal-dev mailing list