accessing LiveText in photos

Anyone figured out a way to access the text found in a photo in Montery via script?

I tried some basic stuff in Preview and go nowhere


I haven’t looked again to see how to do this in scripts, but I was able to do this with a shortcut. Create a new shortcut, have it get a selection of images from finder, filter the list for images only, and then add the step “Extract text from images.”

I had a one-off need for this – processing some 800 images – it was dang fast. and the results were way better than my OCR had done.

I’d like to see this in scripting also – maybe that shortcut device can be deconstructed (where are those things even stored?) to determine if this needs ASObjC or if it’s a scriptable facility somewhere…

You can script it using the Vision framework and the ObjC bridge. I wrote something in JavaScript, but that might bit be on topic here.