图像分辨率指图像中存储的信息量,是每英寸图像内有多少个像素点,分辨率的单位为PPI(Pixels Per Inch),通常叫做像素每英寸。图像分辨率一般被用于ps中,用来改变图像的清晰度。

图像分辨率的大小会影响到我们实验的进行,修改合适的分辨率可以让实验完美的进行下去。

 

通过python程序可以很好的调整图像的分辨率。

# -*- codeing = utf-8 -*-
# @Time : 2022/5/1 13:23
# @Author : ning
# @File : 5.1demo.py
# @software : PyCharm

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 = '9.jpg'
    width = 256 #调整的分辨率大小
    height = 256
    file_out = 'demo9.png'
    # 分辨率
    produceImage(file_in, width, height, file_out)

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐