DT3 Feature Suggestion: OCR to metadata

Especially with images it would be great to just generate metadata from performing OCR instead of creating a PDF with a significantly degraded image. Alternative: output OCR to annotation.

You could use Data > OCR > to rich text and then set the URL of the original image to the item link of the rich text. Or use a simple script:

-- OCR to annotation

tell application id "DNtp"
	repeat with theRecord in (selection as list)
		set theCopy to convert image record theRecord type rtf with waiting for reply
		set URL of theRecord to reference URL of theCopy
	end repeat
end tell
2 Likes

First-time user (just downloaded DT3) and have not used a “bucket”-type app like this in the past.

I am particularly interested in finding a way to do exactly what @brsma has asked about as a batch operation. @cgrunenberg – tagging you if you don’t mind, in the event you might have some thoughts on this. I am dealing with 5,032 screenshots of text, most of which is typographic (i.e. a book page) but of widely varying quality.

Keeping the images as images is necessary in my case, as I rely heavily on the markup mode in Quick Look, within Finder, to underline, position arrows, crop entire image etc. These also get shared regularly with others. Non-PDF format is necessary for other reasons too.

Ideal workflow would allow DT3-generated OCR text to simply be embedded in the metadata “description” field for each image. Is this something that might be doable as a batch run?

Thanks in advance for any thoughts/guidance on this.

DEVONthink can’t perform this on its own. But the result of Data > OCR > to RTF document could be used as an annotation which can be viewed & edited via the Annotations & Reminder inspector. Here’s a simple script demonstrating this:

tell application id "DNtp"
	repeat with theRecord in (selection as list)
		set theCopy to convert image record theRecord type rtf with waiting for reply
		set annotation of theRecord to theCopy
	end repeat
end tell

A similar script could store the text as a Finder comment:

-- OCR to Finder comment

tell application id "DNtp"
	repeat with theRecord in (selection as list)
		set theCopy to convert image record theRecord type rtf with waiting for reply
		set comment of theRecord to plain text of theCopy
		delete record theCopy
	end repeat
end tell

WARNING:
Due to a bug of version 3.0, disable the option Preferences > OCR > Move to Trash. This option should be only used for user actions but is also used by scripts or smart rules. Version 3.0.1 will fix this.

1 Like

@cgrunenberg this is massively helpful – especially to come from you! I’m effectively a “pre-newbie newbie” – tinkering with your platforms in trial mode. I’m now convinced this is the way to go, though. Will be licensing soon and look forward to learning from you on here.