-
Notifications
You must be signed in to change notification settings - Fork 210
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
Clean up MetadataLoader.ts #277
Comments
cbhushan@ in #212 (comment) suggested https://mutiny.cz/exifr/ but that is missing Face region support: MikeKovarik/exifr#59 |
Hi! If I can do anything to help ease a transition, please let me know. /Maintainer of ExifReader |
Thank you, @mattiasw for your library. I think that is the best candidate for pigallry2 to have "one exif reader to rule them all". So far I'm not planning to put effort in it on my side. |
I "hacked up" a quick benchmark between 3 exif readers. Disclaimer: I did not double check if all three can proved all the needed metadata. But I thinks so, or at least their developers are quite responsive. Libs to test:
Test was done on Wind 10, with SSHD (it is possoble that the HDD cached the photos after a while), number of photos: 698, dir size: 3,28GB. Each test was run 10 times and an average was calculated. Result:
Reproduce the test:MetadaLoader.ts:
NOTE: for exifreader, not the whole file is read, but only part of it. The exif data is only at the beginning of the file, no need to read the actual photo. Test sandbox:
|
It looks like exiftool is out of the running. I also think that benchmark might not be fair for exifr vs exifreader: it appears exifr is very fast by default because it only imports IFD0, EXIF, GPS tags, so no IPTC or XMP(?) I tried a benchmark with loading all tags |
I made an I made multiple experiments: pigallery2/src/backend/model/threading/MetadataLoader.ts Lines 93 to 111 in 36d5ccb
And run my benchmark. Result: PiGallery2 v1.8.7 (experimental), 13.05.2021Version: v1.8.7, built at: Thu May 13 2021 10:31:47 GMT+0000 (Coordinated Universal Time), git commit:36d5ccbbd4c077d25c99f47c215740a46122cad4 Gallery: directories: 31, photos: 2036, videos: 35, diskUsage : 22.08GB, persons : 1241, unique persons (faces): 14
*Measurements run 20 times and an average was calculated. run for : 2316553.0ms I do not see much difference between the ˛ Based on this I find |
exifr now support sidecars: MikeKovarik/exifr#62 |
A comment from a veteran user of exiftool on the exiftool forums, indicate that metadata independent determination of image size is a good idea, even if you find data in the exif: So perhaps it would be fine to keep |
keeping image-size sounds good to me. |
Howdy! I'm the author of exiftool-vendored. Windows has especially poor child process spawn performance: I've seen Windows take upwards of 10 seconds on a lightly loaded server to just allow the process to spin. I had to increase timeouts to 30 seconds on GHA! For reference, a slow Linux server can spin up a subprocess in 3-100ms. As I'd update your benchmark to try reading from multiple files concurrently, rather than waiting for every read -- One possibly surprising thing with my library: in an effort to avoid bug reports saying that Edit: and just to clarify, I'm not asking you to switch EXIF libraries--I'm just wanting to highlight the issues with using |
Hi @mceachen, By "reading from multiple files concurrently, rather than waiting for every read" you mean using a Of course this can be improved with web workers but the other libraries will have a really big improvement in performance with web workers too. Maybe I'm missing something or maybe is the OS (I'm in windows). But I use a lot exiftool to process images in bulk and is way faster than this :( |
Thank you for the pointers @mceachen. Really appreciate them. Generally I would be happy to switch to exiftools given its the "standard" tool that everyone just accepts. If it's performance can kinda match with what we today have, it would be a nice switch. On the other hand, we just had a major MetadataLoader refactor recently. I don't think I would want to invest into an other one. But If someone wants to give it a try, I happy to support. |
Pigallery2 is using multiple exif, iptc parers (as I could not find one that can do all at once) to get all the metadata for a photo:
fs.statSync for silesize, creation date (if i do not find any better from exif)
pigallery2/src/backend/model/threading/MetadataLoader.ts
Line 107 in 36ecbcb
ts-exif-parser
for most of the exif data:pigallery2/src/backend/model/threading/MetadataLoader.ts
Line 114 in 36ecbcb
image-size
to get the photo dimension if 2)ts-exif-parser
fails:pigallery2/src/backend/model/threading/MetadataLoader.ts
Line 169 in 36ecbcb
(The image dimension is a must for this app to work properly )
ts-node-iptc
for GPS/location, keywords, caption related info:pigallery2/src/backend/model/threading/MetadataLoader.ts
Line 177 in 36ecbcb
exifreader
for faces and now for orientation as this lib parses that properlypigallery2/src/backend/model/threading/MetadataLoader.ts
Line 206 in 36ecbcb
This class needs a major refactor. Probably.
exifreader
would be able to handle all cases now. Reducing to only one lib, photo indexing would be probably way faster (instead of 4-5 file open, 1 would do the trick)The text was updated successfully, but these errors were encountered: