MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / is_image

Function is_image

Simple_Image_resize/main.py:14–21  ·  view source on GitHub ↗
(file_path)

Source from the content-addressed store, hash-verified

12 os.makedirs(compressed_directory)
13
14def is_image(file_path):
15 try:
16 # Try to open the file with Pillow
17 Image.open(file_path)
18 return True
19 except IOError:
20 # If an error occurs, it's likely not an image
21 return False
22
23for filename in os.listdir(directory):
24 f = os.path.join(directory, filename)

Callers 1

main.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected