1
我I;16B
類型的3個圖像,我正確地閱讀它們進入Python
通過PIL
:轉換三個I; 16B圖像轉換成一個圖像
#!/usr/bin/en python
import sys
from PIL import Image
mode2bpp = {'1':1, 'L':8, 'P':8, 'RGB':24, 'RGBA':32, 'CMYK':32, 'YCbCr':24, 'I':32, 'F':32}
if __name__=="__main__":
print "Working!"
basedir = sys.argv[1]
imname = sys.argv[2]
Rc = sys.argv[3]
Gc = sys.argv[4]
Bc = sys.argv[5]
Zstack = sys.argv[6]
Rtif = basedir+"/"+imname+"-"+Rc+"/Data-"+Rc+"-Z"+Zstack+".tif"
Gtif = basedir+"/"+imname+"-"+Gc+"/Data-"+Gc+"-Z"+Zstack+".tif"
Btif = basedir+"/"+imname+"-"+Bc+"/Data-"+Bc+"-Z"+Zstack+".tif"
Rim = Image.open(Rtif)
Gim = Image.open(Gtif)
Bim = Image.open(Btif)
print Rim
print Rim.mode
這說明我的數據是I;16B
但我不得不將它們讀爲3個不同的圖像(每個通道一個)。我應該如何將這3個通道合併爲一個圖像並寫入一個.tif
文件作爲輸出?