Image.filter(ImageFilter.BLUR) メソッドを使用して画像をぼかしているときに問題が発生しました。
私のコード:
#Open the image from the ImageField
fp_big = open(self.image_big.path, 'rb')
im_big = Image.open(StringIO(fp_big.read()))
#Resize the image
im_big.thumbnail(size_big, Image.ANTIALIAS)
#Blur the image
im_big = im_big.convert('RGB')
for i in range(10):
im_big = im_big.filter(ImageFilter.BLUR)
#Save the images
temp_handle_big = StringIO()
im_big.save(temp_handle_big, PIL_TYPE)
temp_handle_big.seek(0)
#Save image to a SimpleUploadedFile which can be saved into ImageField
suf_big = SimpleUploadedFile('%s' % os.path.split(self.image_big.name)[-1], temp_handle_big.read(), content_type=IMG_TYPE)
#Delete old images and close fps
fp_big.close()
os.remove(original_path_big)
このコードは正常に動作しますが、結果は部分的に間違っています。
ご覧のとおり、画像のエッジは適切にぼやけていません。なぜこれが起こるのか誰にも分かりますか?
事前にthx。