I am new to Python and I am trying to import multiple tif images so that I can do image processing with skimage. I want to do image processing on a Landsat image to define linear features for a project that has to be in before the end of the year.
I am using a Landsat 8 image that consists of 11 bands (individual tif files), a bqa file and a metadata.txt
file.
I can import a band one by one, but I don't know how to stack the bands into one tiff file that also contains the metadata.txt file.
This is what I have done so far:
import os filename = os.path.join('path', 'band1.TIF')
import skimage from skimage
import io bandone = io.imread(filename)
So my image has been successfully imported as converted to a nparray.
I have to repeat this to import all the bands.
What is the best way to save these bands together?
skimage.external.tifffile.imsave('file, data, **kwargs) ?
skimage.io.imsave(fname, arr, plugin=None, **plugin_args) ?
TiffWriter ?
Or should I do something else completely?
Please elaborate on the details (such as how to define **kwargs
for instance).
Best Answer
It is easy with gdal_array.SaveArray: