I am getting this error message:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
从这段代码开始:
from PIL import Image
import os
image_name = "mypic"
count = 0
for filename in os.listdir('pictures'):
if filename.endswith('.jpg'):
image_file = open('pictures/' +filename)
image = Image.open(image_file)
# next 3 lines strip exif
data = list(image.getdata())
image_without_exif = Image.new(image.mode, image.size)
image_without_exif.putdata(data)
image_without_exif.save('new-pictures/' + image_name + str(count) + '.jpg')
count = count + 1;
不太清楚为什么,因为昨天这还能用...
BytesIO
),该对象“必须实现read()、seek()和tell()方法,并以二进制模式打开”文档。 - ti7