0

I created some GOES-16 images where the dark/night side of the visible image is transparent (alpha channel). I used satpy's DayNight Compositor to make the night side of the image transparent, while keeping the day time in gray scale. Unfortunately, using this method has converted the original L (gray) image into an RGBA image.

I tried using PIL to convert the image from RGBA mode to LA mode but it removes the georeferenced data in the GeoTiff.

img = Image.open(filename_of_RGBA).convert('LA')
img.save(new_filename)

How can I keep the georeferenced data while converting from RGBA to LA?

3
  • Here is some Python code to transfer metadata between geotiffs. gis.stackexchange.com/questions/264644/…
    – GBG
    Commented Feb 10, 2021 at 22:17
  • You can select bands with gdal_translate -b option, the real question is how to undo the pan sharpening, perhaps a GDAL_Calc on the bands to estimate the lightness that was used. Either option will retain your georeference. Commented Feb 11, 2021 at 0:21
  • @GRG for some reason when I tried the approach mentioned in the link, it didn't work for me. I ended up finding a solution link Commented Feb 14, 2021 at 20:17

1 Answer 1

0

I was able to copy the georeferenced data from the RGBA image to the LA image by using a command line tool I found here from David Strip-2.

Given a GeoTIFF file named original.tif, and a modified file (modified.tif) without the GeoTIFF tags, but still the same size and region:

listgeo -no_norm original.tif > original.geo
geotifcp -g original.geo modified.tif modified_geotiff.tif 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.