Add a nodata mask to a read-only image?

I finally came up with a solution to the problem of how to deal with missing or inappropriate nodata in imagery that we can’t change at source. This could be either because source is read-only or because the cost of changing is too high.

satellite image jagged nodata edge

Yellow is current nodata (actually 0,0,0). Black jagged perimeter is what we want to turn into nodata.

See full solution at https://gis.stackexchange.com/questions/387877/add-a-nodata-mask-or-alpha-band-to-read-only-image. Summary:

  1. Ensure the source image will remain golden by marking read-only
  2. Use nearblack to create a working copy de-collared image with a mask file
  3. Rename the mask file to match original
  4. Remove working copy

This is actually a single scenario in a general class of problem:

Much of the imagery we receive is jpeg compressed. Any time we extract an area of interest or do any other process that results in an additional file being created a decision must be made:

  • Ensure pixel values are unchanged by using lossless compression à min x3 increase in storage requirements
  • Keep storage requirements almost the same but “Save as jpeg” and compress again all the pixels that have already been compressed.

Typically the user is unaware this decision is being made automatically on their behalf. One which is compound repeated at each derivative stage.

With the virtual raster table combined with mask technique we have the potential to minimize the harm by being able to at least not degrade more than what we receive. Unfortunately VRT are for advanced users only. However maybe there’s something in Pro’s big imagery toolkit that’s more approachable; there’s a lot in there I’m not familiar with yet.

Leave a Reply

Your email address will not be published. Required fields are marked *