imgutils.validate.truncate
is_truncated_file
- imgutils.validate.truncate.is_truncated_file(path: str) bool [source]
- Overview:
Check if an image is truncated or not.
- Parameters:
path – Path of file (must be a string which represents the path of image).
- Returns:
Is truncated or not.
- Examples:
Here are some images for example
>>> from imgutils.validate import is_truncated_file >>> >>> is_truncated_file('jpeg_full.jpeg') False >>> is_truncated_file('jpeg_truncated.jpeg') True >>> is_truncated_file('6125785.png') False >>> is_truncated_file('2216614_truncated.jpg') True
Warning
The function
is_truncated_file()
is thread-safe due to the usage of a global lock. During the function is run, the value of ImageFile.LOAD_TRUNCATED_IMAGES is set toTrue
, this may cause some side effect when your projects have dependency on thisImageFile.LOAD_TRUNCATED_IMAGES
.