python读取csv一行中各列内容,转换图片分辨率
import pandas as pd
import csv
with open('test.csv','r') as csvfile:
r = csv.reader(csvfile)
for row in r:
print(row[0],row[1])
import matplotlib.pyplot as plt
from PIL import Image
def produceImage(file_in, width, height, file_out):
image = Image.open(file_in)
resized_image = image.resize((width, height), Image.ANTIALIAS)
resized_image.save(file_out)
if __name__ == '__main__':
file_in = 'tiger.jpg'
width = 128 #调整的分辨率大小
height = 128
file_out = 'demo9.jpg'
# 分辨率
produceImage(file_in, width, height, file_out)

浙公网安备 33010602011771号