Page 1 of 1

OCR image and add text in comment field to file?

PostPosted: Sat Dec 03, 2022 6:25 pm
by 947AB8
Hi, wondering if this is theoretically possible with Hazel…

On a folder, have a rule that passes the image to a bash script that OCRs it. Then take that output and insert it into the comment field in the file, so that it could be searched with Alfred or Spotlight.

Is that possible with Hazel?

Re: OCR image and add text in comment field to file?

PostPosted: Mon Dec 05, 2022 10:44 am
by Mr_Noodle
Should be possible though most of that logic will be in the script. You could either set the comment in your script or export a custom attribute (you will have to use AppleScript for that) which you can then use in the Comment action. Check the manual on AppleScript for more details on how to do that.

I'm not sure, but there may be a max size for comments, though, so keep that in mind.

Also, if you OCR the file, it should be able to be scanned by Spotlight and searchable as is so adding a comment may be superfluous at that point.