Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python check if image is corrupted

from os import listdir
from PIL import Image
    
for filename in listdir('./'):
  if filename.endswith('.png'):
    try:
      img = Image.open('./'+filename) # open the image file
      img.verify() # verify that it is, in fact an image
    except (IOError, SyntaxError) as e:
      print('Bad file:', filename) # print out the names of corrupt files
Comment

PREVIOUS NEXT
Code Example
Python :: extend stack python 
Python :: coco.py 
Python :: python pandas cumulative sum of column 
Python :: sqrt python 
Python :: python color text console 
Python :: string to hex python 
Python :: pandas change frequency of datetimeindex 
Python :: pandas casting into integer 
Python :: python check list contains another list 
Python :: how to auto update chromedriver selenium python 
Python :: pandas select data conditional 
Python :: how to read a pkl file in python 
Python :: convert categorical column to int in pandas 
Python :: python live radio 
Python :: nested dict to df 
Python :: plot horizontal line in python 
Python :: how to duplicate columns pandas 
Python :: normalize rows in matrix numpy 
Python :: scatter plot plotly 
Python :: python order 2d array by secode element 
Python :: discord embed colors python 
Python :: python selenium partial class name 
Python :: timer pythongame 
Python :: pip show all installed packages 
Python :: python find location of module 
Python :: make first row column names pandas 
Python :: python dedent 
Python :: jsonresponse status code django 
Python :: python move directory 
Python :: python zfill 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =