-
Notifications
You must be signed in to change notification settings - Fork 21
Add support for reading exif tags from IO objects #53
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
base: master
Are you sure you want to change the base?
Conversation
- Updated `README.md` to include instructions for reading metadata from IO objects. - Modified `lib/exiftool.rb` to handle IO objects as input, allowing ExifTool to infer file type from content. - Utilized `Open3.popen3` for executing shell commands, ensuring proper process management and error handling. - Added a test case in `test/exiftool_test.rb`.
|
@morozgrafix any chance to merge and release this? |
|
Thanks for the PR. I'm traveling at the moment. Will take a look at it when
I get back.
…On Tue, Dec 9, 2025 at 10:48 AM Bogdan Gusiev ***@***.***> wrote:
*bogdan* left a comment (exiftool-rb/exiftool.rb#53)
<#53 (comment)>
@morozgrafix <https://github.com/morozgrafix> any chance to merge and
release this?
—
Reply to this email directly, view it on GitHub
<#53 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHV76EPE3E4Z5MKX6YIESD4A4KOTAVCNFSM6AAAAACLTC734GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMZTG42TMNBWGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
morozgrafix
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for submitting this PR. I'm unsure if 64KB restriction only applies to JPEG files. Have you had a chance to test it with other image/video files?
| begin | ||
| Open3.popen3(*args) do |stdin, stdout, _stderr, wait_thr| | ||
| if io_input | ||
| # Reading first 64KB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 64KB restriction only applies to JPEG format? Any idea on similar restriction in regards to other image and video formats?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a little bit more digging and found some interesting info related to that 64KB limit here. https://exiftool.org/commentary.html#JPEG
I'm wondering if limiting io input to first 64KB would be advisable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there is some misconception in the comment. I sends the whole file in 64KB chunks.
LLM suggests a better way of doing it using:
IO.copy_stream(io_input, stdin)
Quote:
✅ What IO.copy_stream does
-
Streams efficiently from one IO to another
-
Uses optimal chunk size internally
-
Stops automatically when either:
io_inputreaches EOF, orstdin(exiftool) closes early
When exiftool closes stdin early (because it has enough data),
IO.copy_stream simply stops and returns — no broken pipe errors.
What do you think?
README.mdto include instructions for reading metadata from IO objects.lib/exiftool.rbto handle IO objects as input, allowing ExifTool to infer file type from content.Open3.popen3for executing shell commands, ensuring proper process management and error handling.test/exiftool_test.rb.Fixes #52