pytorch / pytorch/vision

Extracting custom EXIF data from PNG files

Open
#8,348 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the torchvision.io.read_image entry point and review how PNG and TIFF images are currently decoded and how metadata is exposed. Compare the requested PNG custom EXIF behavior with the shown PIL examples; done means read_image can return the image together with the requested PNG metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.