我对一些Python代码有问题。 我有一个带照片的文件夹。有了python程序,我想让它们变成这样,它们有更少的像素。 我有这个计划:
import os
from PIL import Image
import numpy as np
i = 0
width = 32
height = 32
pfad = "C:\\Users\\Leopold\\source\\repos\\bilder verkleinern\\bilder verkleinern\\Pinguin"
pictures = os.listdir(pfad)
länge_pfad = len(pictures)
pfad_save = "C:\\Users\\Leopold\\source\\repos\\bilder verkleinern\\bilder verkleinern\\fertig\\Pinguin\\"
while länge_pfad >= i:
pfad_echt = "C:\\Users\\Leopold\\source\\repos\\bilder verkleinern\\bilder verkleinern\\Pinguin\\" + \
pictures[i]
Bild = Image.open(pfad_echt)
Bild = Bild.resize((width, height))
pfad_save = pfad_save + pictures[i]
Bild.save(pfad_save)
i = i + 1
问题是,如果我启动这个,错误
"[Errno 2] No such file or directory: 'C:\\Users\\... (this is the file directory)\\1.300px-Falkland_Islands_Penguins_36.jpg1.300px-Falkland_Islands_Penguins_36.jpg10.2012_falkland_antarktis_0124.jpg1
但当然,没有这样的图片,因为我想,程序把这个写进这个文件夹。 对此我能做些什么
谢谢你的帮助
目前没有回答
相关问题 更多 >
编程相关推荐