Open
Description
🚀 The feature
Being able to use torchvision.io.read_image(...) to read PNG files alongside the custom metadata stored in the exchangeable image file format (EXIF).
Motivation, pitch
I am training different deep learning models and some of them rely on custom metadata stored in EXIF inside PNG files.
Currently I have to do
from PIL import Image
with Image.open(file_path) as image:
image.load()
if image.format == "TIFF":
metadata = image.getexif()[37510] # 0x9286
else: # png
metadata = image.text
but would much rather just ditch PIL.Image and do
from torchvision.io import read_image
image, metadata = read_image(file_path, read_metadata=True)
Alternatives
No response
Additional context
No response
Edit
added case distinction between TIFF and PNG files
Metadata
Metadata
Assignees
Labels
No labels