2

CMYK イメージを形成するために 4 つの tif をマージしようとしています。

これは私がこれまでに持っているコードです:-

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'

どんな考えでもいただければ幸いです

4

1 に答える 1

1

mcyおよびオブジェクトでkある必要があるPIL Imageため、たとえば

m = Image.open("C:\Documents and Settings\dbigwood\Desktop\TEST\magnew.tif")
于 2012-12-12T12:25:27.743 に答える