Now I import this image into DT and again check its spotlight attributes with mdls <path to image in DT.
Now the kMDItemKeywords are missing from the output (in fact, the output is about 20% of the original one), but the keywords are available in DT’s metadata. Which is A Good Thing. But why does the import remove nearly all the spotlight metadata from the image?
If it didn’t, it would be easy to script a comprehensive “convert image metadata into DT metadata” script. As it stands, it’s a tedious task, and there’s no way to get at all the metadata that would be available to spotlight.
Edit: When I make a duplicate of the original file in Finder, all the Spotlight attributes are retained. So, it seems to me that DT is removing these attributes on import – if so, why?
Probably both Spotlight & DEVONthink retrieve the keywords from the file.
Most likely because the file isn’t part of the Spotlight index anymore after importing as it’s located inside a package. These are not extended attributes and the Spotlight index isn’t used at all by DEVONthink.
Spotlight does not index inside package files (and never has).
Also, the internal directory has the .noindex extension that would also cause Spotlight to not index the contents of that location. You can actually use this for any folder in the Finder and Spotlight will ignore it.