-
Notifications
You must be signed in to change notification settings - Fork 45
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
cannot build naive datetime, reason: :invalid_date #163
Comments
Thanks for the issue. I've published a image version 0.54.3 with the following changelog entry: Bug Fixes
|
Let me know if that works for you now? A couple of other comments/questions:
with {:ok, file_binary} <- File.read("image.jpg"),
image <- Image.from_binary!(file_binary) do
case Image.exif(image) do
...
end
end This is quite inefficient in The result is less memory consumption, and a lot less CPU utilisation since I would strongly suggest: with {:ok, image} <- Image.open("image.jpg") do
case Image.exif(image) do
...
end
end |
Of course please feel free to use it in your test suite. Also amazing tip, thank you I wasn't aware I will update and try it now, thank you @kipcole9! |
This is inspecting to My Ecto field where I am saving the date is: So the validation is currently failing. I'll have to check for that "0000" value and if it's present just set to |
That’s “interesting”. I’ll check what exiftool returns when I’m back at my desk. It’s possible windows is using another field when the exif fields are invalid. im out and about for an hour or so but will dig deeper when I’m back. |
The "good news" is that exiftool also returns the same information as % exiftool /Users/kip/Desktop/364959210-4892c3cf-b9b4-4c7c-8f5d-9fcd86b6e42b.jpg
Modify Date : 0000:00:00 00:00:00
.....
Date/Time Original : 0000:00:00 00:00:00
Create Date : 0000:00:00 00:00:00 Therefore my working assumption is that the dates that Windows is showing are the file create/modify date times, not the image shoot times. And indeed if I look at the output from exiftool I see: File Modification Date/Time : 2024:09:06 08:04:34+10:00
File Access Date/Time : 2024:09:06 09:00:59+10:00
File Inode Change Date/Time : 2024:09:06 08:04:35+10:00 Which are the dates/times of the file - on my machine. Of course they will be different on your machine. |
So in my code I need to write if the exif date is "0000" I need to sniff out the create date time, not the image shoot times. Thanks @kipcole9 🙏 |
I think the best approach is to check based upon the type. If the date is valid then the type will be a Whether the file creation date time is relevant depends on your use case. If you're reading images directly from a camera card then the file creation date and the shooting date will likely be the same. In other cases, its quite likely the file creation date is uncorrelated with the shooting date. |
The app crashes when I reach the
Image.exif/1
call:The image causing this bug is, I'm not sure if the exif is preserved through Github:
Let me know if there is a better way to troubleshoot this. Thank you for the awesome library!
The text was updated successfully, but these errors were encountered: