Open bgyarfas opened 2 years ago
Continued digging (mainly by seeing how Pillow deals with the files just fine)... It appears the files are actually "Multi-Picture Format" (link) meaning they have an embedded thumbnail that is described by a special metadata block. STB doesn't know how to handle this type of file correctly so it fails.
I have JPEGs for a scan I took with a DJI Mini SE drone.
colormap2nerf.py
deals with them fine but they fail to load in the testbed (errors out with a"image not found: "
).After some digging, the error isn't that the image isn't found but it's failing to load with STB. Diving deeper, it appears the DJI JPEGs have a JPEG Marker 0 that STB does not like (see STB Issue #1182). It doesn't appear that STB intend to ignore file issues like this so it likely won't get fixed upstream. If I get a chance I'll open a PR to add an error message after
stbi_load(...
if the file fails to load due to "file errors" as the "image not found: " message can be misleading.I was able to work around the issue by first using the original files to run through
colormap2nerf.py
(since it appears to leverage the GPS coordinates in the metadata). Then I run the files throughconvert_image.py
and output the same file name. Which technically will re-encode them which isn't ideal but until I figure out how to fix the files in-place it was the quickest solution I could come up with.Thanks for the great work!