I need to merge the RGB bands of three TIFF images. I'm trying to use a PIL library (Python Imaging Library), but this execution error happens:
Traceback (most recent call last): File "merge.py", line 7, in Imagem = Image.merge("RGB", (red, green, blue)) File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2367, in merge raise ValueError("mode mismatch") ValueError: mode mismatch
The output must to be a new TIFF image with three bands. This is my code:
import Image red = Image.open("red.TIF") blue = Image.open("blue.TIF") green = Image.open("green.TIF") out = Image.merge("RGB", (red, green, blue)) out.save("img-out.TIF")
Can anyone help me?