Re: cannot correctly change a TIFF's interleave

Sean Gillies


On Thu, Mar 4, 2021 at 7:24 PM <guohoucai@...> wrote:
I'm looking for some help about how to change a TIFF's interleave. My code could change a TIFF's nodata value but cannot succeed on the interleave, could anyone give me some advice? I'll appreciate your kindness.

The nodata value is nothing but an annotation of the data and is simple to change. To change the interleaving of a GeoTIFF, it is required to rewrite the file entirely. is the function to use for this purpose. I'm sorry that the documentation of the shutil module is incomplete, we're working on it.

I recommend this usage:

with as src:
    prof = src.profile
    prof.update(interleave="pixel", nodata=0)
    rasterio.shutil.copy(src, save_path, driver="GTiff", **prof)

Sean Gillies

Join to automatically receive all group messages.