import zipfile import io from PIL import Image def extract_files_from_zip(zip_path): file_objects = {} with zipfile.ZipFile(zip_path, 'r') as zip_ref: for file_name in zip_ref.namelist(): with zip_ref.open(file_name) as file: file_objects[file_name] = Image.open(io.BytesIO(file.read())) return file_objects