Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix slow compute metadata on PNGs due to getexif on png #5564

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions fiftyone/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ def get_image_info(f):
img = Image.open(f)

# Flip the dimensions if image metadata requires us to. PIL.Image doesn't
# handle by default.
if _image_has_flipped_dimensions(img):
# handle by default. Image flipping only efficiently supported on JPEG.
if img.format == "JPEG" and _image_has_flipped_dimensions(img):
width, height = img.height, img.width
else:
width, height = img.width, img.height
Expand Down Expand Up @@ -555,13 +555,12 @@ def _do_compute_metadata(args):
def _compute_sample_metadata(
filepath, media_type, skip_failures=False, cache=None
):
if not skip_failures:
return _get_metadata(filepath, media_type, cache=cache)

try:
return _get_metadata(filepath, media_type, cache=cache)
except:
return None
if skip_failures:
return None
raise


def _get_metadata(filepath, media_type, cache=None):
Expand Down
Loading