sindresorhus / Actions

⚙️ Supercharge your shortcuts
https://sindresorhus.com/actions
MIT License
2.56k stars 108 forks source link

Action proposal: for image/document, detect and extract any Barcode type data supported in Vision Framework #72

Open workflowsguy opened 1 year ago

workflowsguy commented 1 year ago

Description

For automated document processing, it would be great to have actions that

1) detect if/which kinds of barcodes a pdf or image file contains 2) extracts data for selected types of barcodes

Apple's Vision framework already supports various types of barcodes like:

but there seems to be no easy way to process them with Automator/Shortcut actions, AppleScript or other scripting languages.

sindresorhus commented 1 year ago

What would you like the result to look like?

I'm thinking a list of:

The Vision framework uses the term "symbology" instead of "type", but I think "type" is more understandable for users.

sindresorhus commented 1 year ago

Proposed action name: Get Barcodes in Image

sindresorhus commented 1 year ago

Note to self: https://developer.apple.com/documentation/vision/vndetectbarcodesrequest

workflowsguy commented 1 year ago

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:

I agree.

sindresorhus commented 1 year ago

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": "…"
}
workflowsguy commented 1 year ago

Thanks for the clarification.