ตำแหน่งของ ไฟล์ต่างๆ 1. ขั้นแรกเราจะเริ่มจากการ import module os กับ pillow
โค้ด: เลือกทั้งหมด
from PIL import Image
import os
โค้ด: เลือกทั้งหมด
parth = "images/"
โค้ด: เลือกทั้งหมด
for i in os.listdir ( parth ):
if i.endswith ( '.jpeg' ):
โค้ด: เลือกทั้งหมด
f = Image.open(parth + i)
p, p1 = os.path.splitext ( i )
โค้ด: เลือกทั้งหมด
f.save("Testimg/{}.png".format(p))
โค้ด: เลือกทั้งหมด
from PIL import Image
import os
parth = "images/"
for i in os.listdir ( parth ):
if i.endswith ( '.jpeg' ):
f = Image.open(parth + i)
p, p1 = os.path.splitext ( i )
f.save("Testimg/{}.png".format(p))
https://pillow.readthedocs.io/en/stable/reference/index.html
https://note.nkmk.me/en/python-pillow-basic/
https://www.pythonforbeginners.com/gui/how-to-use-pillow