check a image if it is RGBA

 

from PIL import Image
import os
#import requests

#path = '12.jpg'
#response = requests.get("https://s6.mkklcdnv6.com/mangakakalot/s2/spirit_sword_sovereign/chapter_82_remain_strong/12.jpg")


#with open(path, 'wb') as f:
#    f.write(response.content)

image_dir = "./car"

for i in os.listdir(image_dir):
    path = os.path.join(image_dir,i)
    #print(path)
    img = Image.open(path)
    if img.mode == "RGBA":
       print('[MODE] is {}, {}'.format(img.mode, i))

  

posted on 2021-01-20 13:23  cdekelon  阅读(71)  评论(0)    收藏  举报

导航