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)
posted @ 2022-08-12 12:21  祥瑞哈哈哈  阅读(149)  评论(0)    收藏  举报