Python 使用image.merge合并tif图像

Python 使用image.merge合并tif图像,python,python-imaging-library,Python,Python Imaging Library,我试图将4个TIF合并在一起以形成CMYK图像 这是我目前掌握的代码:- import Image m = "C:\Documents and Settings\dbigwood\Desktop\TEST\magnew.tif" c = "C:\Documents and Settings\dbigwood\Desktop\TEST\cyannew.tif" y = "C:\Documents and Settings\dbigwood\Desktop\TEST\yellownew.tif"

我试图将4个TIF合并在一起以形成CMYK图像

这是我目前掌握的代码:-

import Image

m = "C:\Documents and Settings\dbigwood\Desktop\TEST\magnew.tif"
c = "C:\Documents and Settings\dbigwood\Desktop\TEST\cyannew.tif"
y = "C:\Documents and Settings\dbigwood\Desktop\TEST\yellownew.tif"
k = "C:\Documents and Settings\dbigwood\Desktop\TEST\knew.tif"

im = Image.merge("CMYK",(c,m,y,k))

im.save("C:\Documents and Settings\dbigwood\Desktop\TEST\AAA.tif")
这在运行时给了我一个错误

Traceback (most recent call last):
  File "C:\Documents and Settings\dbigwood\Desktop\TEST\try5.py", line 18, in <module>
    im = Image.merge("CMYK",(c,m,y,k))
  File "C:\Python26\ArcGIS10.0\lib\site-packages\PIL\Image.py", line 1996, in merge
    if im.mode != getmodetype(mode):
AttributeError: 'str' object has no attribute 'mode'
回溯(最近一次呼叫最后一次):
文件“C:\Documents and Settings\dbigwood\Desktop\TEST\try5.py”,第18行,在
im=Image.merge(“CMYK”,(c,m,y,k))
文件“C:\Python26\ArcGIS10.0\lib\site packages\PIL\Image.py”,第1996行,合并
如果即时通讯模式!=getmodetype(模式):
AttributeError:“str”对象没有属性“mode”

任何想法都会被欣赏

m
c
y
k
需要是
PIL
图像对象,例如

m = Image.open("C:\Documents and Settings\dbigwood\Desktop\TEST\magnew.tif")