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

Check for existence of EXIF data? #31

Open
jaypinho opened this issue Aug 29, 2022 · 1 comment
Open

Check for existence of EXIF data? #31

jaypinho opened this issue Aug 29, 2022 · 1 comment

Comments

@jaypinho
Copy link

Hi there,

Great gem - thanks for all the hard work.

Was wondering: unless I missed it, I didn't see a way to check a file or string for the presence of EXIF data before then accessing the EXIF data itself.

So if I have an image file where I don't know if EXIF data exists or not, it seems like the best way to verify is to check if the Exif::NotReadable error is returned. Is that correct / expected?

@tonytonyjan
Copy link
Owner

tonytonyjan commented Sep 5, 2022

Hi @jaypinho, thanks for reaching :)

So if I have an image file where I don't know if EXIF data exists or not, it seems like the best way to verify is to check if the Exif::NotReadable error is returned. Is that correct / expected?

Yes, it is expected.

This gem is ported from libexif library and looks like EXIF_LOG_CODE_CORRUPT_DATA cannot distinguish between EXIF absence and corruption, see https://github.com/libexif/libexif/blob/f4a882b15d41da893a7759cfa014acf6c9f87821/libexif/exif-data.c. Thus there is no straightforward way to check if the existence of EXIF data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants