I am trying to create a script that given a tiff file with islands of data (which can be disjoint) and black pixels of nodata, can generate polygons (or new tiffs) that only wrap around the islands of data. The issue I am facing is that my nodata value is automatically 0 (0 0 0 I think actually, or black), and some of my islands also contain the value 0 inside of them, what is the best way to accomplish this in gdal?
For example, if I run a command like:
gdalwarp -srcnodata 0 -dstnodata 0 orig-ignore-black.tif black-nodata.tif
my resulting tiff has pockets inside the data regions that have been stripped because they had a 0 value.