the question is in the title:
is there a way for an automatic / programmatic creation of file from image and content of its (custom) metadata field?
prefered would be an MD-file linking back to the original image (by simply embedding it).
background:
DTs fantastological AI for finding ‘related content’ (‘see also’) suffers from the conceptual privileging of text documents vis-a-vis image documents.
for images, ‘content’ is often (partially) constituted by textual info ‘hidden away’ (from the perspective of DT) in metadata fields, which are not used for automatized semantic relation searches.
it would be great to habe a way to ‘expose’ (some) metadata fields, line the custom metadata fields of DT, to its on-board AI.
the easiest (only?) way I can see this is creating a document comprised of both image and ‘metadata’-turned-‘text content’.
I was somewhat aware of the non-standard way of using the terms. the reason was some conceptual thinking involved, that admittedly is a little bit idiosyncratic to the use case / scenario –… and is basically leveraging the ‘dual nature’ of MD files as existing in two states (visual render vs. source text).
the thinking goes: in an MD file the visual embedding in the rendered view is based upon a MD-syntax that simultaneously uses the ‘link’ (DT reference-ID) to the image in question.
in this setup, I can simultaneously see the (‘embedded’) image in rendered view, and also use the ‘image-link’ (the DEVONthink reference ID contained in the MD-‘source text’) to have a DT-internal reference (‘link’) to the ‘original’ (in the database).
the direct answer is a very simple one:
I would use a custom DT data-field that could be named ‘image data’ – and then simply fill it with any number of text paragraphs (either formatted or plain).
these contents I would collate myself from different XMP/IPTC-metadata fields (in another process outside of DT) – and then re-‘attach’ this to the image, simply by copy-and-paste into the DT custom data field.
this is a personal way of saying: hands up as to any more elaborate way of channeling the IPTC and XMP (custom image metadata) fields into one consolidated field programmatically.
for one, I think this is stretching DT in its current architecture a little too far. (as, while there is some capability of DT to read (some) IPTC and EXIF metadata (… right?), it wouldn´t be easily able to read and display such special things like custom XMP-metadata fields anyways.
plus, I am not code savy enough to programmatically bring everything I need into one ‘official’ IPTC field outside of DT (to potentially make DT use such an official IPTC field), and even less I feel able to do that programmatically for one, consolidated DT-data field.
so, leaves me the option of copy-paste – and the population of DT data fields.
but, I am looking for ways from there to such an ‘automated composite’ in the form of a MD-file.
And a basic working code snippet you could work with…
tell application id "DNtp"
if (selected records) is {} then return
repeat with theRecord in (selected records)
set {recName, recLink} to {name without extension, reference URL} of theRecord
if (type of theRecord) is picture then
set theLink to "" as string -- Image Link
else
set theLink to "{{" & recName & "}}" as string -- Transclusion
end if
set theCategory to get custom meta data for "Category" from theRecord
set theCompany to get custom meta data for "Company" from theRecord
set theLoc to get custom meta data for "Last Locations" from theRecord
set theText to "# " & recName & linefeed & linefeed & theLink & linefeed & linefeed & "## " & theCompany & linefeed & linefeed & theCategory & ". " & theLoc
set newDoc to create record with {name:recName, type:markdown, content:theText} in current group
end repeat
end tell
… whether, finally, I will join the coders order and leave the ‘tinkerer tribe’, adding an additional hat to the collection, I am not sure. but never say never
thanks anyways. for the practical help, as much as for the learning material. appreciated!
of course, I also hope all this might give some helpful conceptual ideas & practical material to others in the community, who are trying to leverage the powers of DT for systematical work w/ image documents …
… regardless, always good / impressive to see how powerful DT can be even more powerful w/ right ideas and right snippets of code!
yes. I always use it before I post or when I have a question.
brings a lot or context to ones own questions. very enriching to link all this, and fight siloing in threads, or thinking.
… and I thought the post I was linking to here, was a nice community contribution.
actually, now you mention it – and in light of the fact that this discussion might better be framed as a discussion of ‘active interlinking’ and ‘enriching’ instead of ‘search’:
I sometimes wish active interlinking (in read and write) would be strengthened in any forums culture, also this one.
there is a reason this platform is called Discourse, and in the Discourse forums this is treated as good practice.
(but ‘search’ – and ‘search again’ – btw also plain fun often; I just searched for WYSIWYG and found very interesting old contributions, I wouldn´t have expected from recent discussions … )
This thread – and @BLUEFROG solution – actually also answers a former request and debate that didn´t progress to the point of giving a full solution in terms of creating a MD document, being a hybrid of a photo and (some) of its metadata.
– Anyone interested in more backgrounds can look it up, though: