2014-03-24 843 views
1

如果我调整使用Python的PIL毛刺“Image.ANTIALIAS”

img=img.resize((w,h), Image.ANTIALIAS) 

它只是给我的图像的左半部分在python的图像。它工作正常,没有抗锯齿,但是很丑。有没有人看过这个? (?)这是一个很小的工作的例子,工程/失败我已经试过任何TIF:

import Image 
import numpy as np 
import matplotlib.pyplot as plt 

img=Image.open("test.tif") 
img=img.resize((300,300), Image.ANTIALIAS) 
imgm=np.asarray(img.getdata()).reshape(img.size[1],img.size[0]) 
imgm=np.log10(imgm) 

imgview=plt.imshow(imgm) 

编辑:重复,该图像的右侧每次都是不同的,但它往往含有glitched原始图像左侧的部分。

回答

1

这似乎用MARBLES.TIF工作确定为我Pillow

from PIL import Image 

img=Image.open("MARBLES.TIF") 
img=img.resize((300,300), Image.ANTIALIAS) 

img.show() 

添加:

img.save("test.png") 

我得到:

test.png