Actions
Actions copied to clipboard
Action proposal: for image/document, detect and extract any Barcode type data supported in Vision Framework
Description
For automated document processing, it would be great to have actions that
- detect if/which kinds of barcodes a pdf or image file contains
- extracts data for selected types of barcodes
Apple's Vision framework already supports various types of barcodes like:
- aztec
- code128
- code39
- code39Mod43
- code93
- dataMatrix
- ean13
- ean8
- interleaved2of5
- itf14
- pdf417
- qr
- upce
but there seems to be no easy way to process them with Automator/Shortcut actions, AppleScript or other scripting languages.
What would you like the result to look like?
I'm thinking a list of:
- value: something
- type: qr
The Vision framework uses the term "symbology" instead of "type", but I think "type" is more understandable for users.
Proposed action name: Get Barcodes in Image
Note to self: https://developer.apple.com/documentation/vision/vndetectbarcodesrequest
What would you like the result to look like?
I'm thinking a list of:
* **value:** something * **type:** qr
As I understand the implementation of Shortcuts' data structures, the result would be a dictionary of "key:barcode value", "value:barcode type" pairs.
I have seen that Shortcuts' dictionaries allow multiple keys with the same name (which is not allowed in other programming language implementations of this data type), but maybe this can be checked and prevented in the Action's source code. Then, even if the same barcode value appears multiple times in the document, in the dictionary it would still appear only once in the result list. I think, typically a user would be interested primarly in the keys (but they could also get the barcode type if they wanted).
My use case for a Shortcut that detects document data:
- for each value in the "detected barcode result dict", test against a specific data type ("is ISBN"? "is EAN"? "is encoded payment information?"
- for each matched identifier/group of identifiers, attach a "IDENTIFIER:VALUE" tag to the original file (e.g. "ISBN:9781592535217" or "AMOUNT:123.45" and "DUE:2022-11-02"
The Vision framework uses the term "symbology" instead of "type", but I think "type" is more understandable for users.
I agree.
As I understand the implementation of Shortcuts' data structures, the result would be a dictionary of "key:barcode value", "value:barcode type" pairs.
No, the result would be a list (multiple) of this:
{
"type": "qr",
"value": "…"
}
Thanks for the clarification.