Find if image has annotation
Anyone know of a way to check if a variant has an annotation on it? The only thing I'm seeing in the AppleScript dictionary is a get/set of "include annotations" as part of the recipe but not seeing anything within the image object when an annotation is present.
I'm looking to take a different action on images that have an annotation versus those that don't (i.e. export as PSD to get the layered annotation layer or export as TIFF if no annotation). Exporting as TIFs with annotation flattens the annotation onto the image which is not helpful in our use-case.
-
Nothing official. You'd have to make an assumption based on a keyword or something, but this is prone to user error.
Only other thing I can think of - and its hacky and probably not very performant - but you could check the settings file to see if it contains the label <annotations version="1"> - then the parent RAW file should have annotations applied.
Edit: third option might be filters or smart album by "annotated".
0 -
Walter Rowe value of what? The "include annotations" is only a boolean for if the recipe should export them or not.
0 -
www.shootmachine.co Thanks. Definitely hacky but good to know that the settings file contains "<annotations version="1">". We use EIPs so I assume we'd need to unpack those first in order to look in the settings file for this.
0 -
Filtering for annotations and processing them with recipe A and then doing the reverse is the way to go.
0 -
Oh Rick Allen and www.shootmachine.co I getcha now about filtering by Annotated. That's pretty easy. Pretty dumb question, but how do you get only the displayed variants. I've worked with "variants of current collection" and "variants of current collection whose color tag is 4", etc. but don't think I've selected based on what is visible.
0 -
I’m in transit atm so can’t test but this should get you close
Tell application “Capture One”
Tell current document
Set filters to “Annotated|YES”
— select variants
— do processing with recipe X
End tell
End tellI’ll be back at my desk in an hour or so
Cheers
0 -
Thanks. That's the process I'm trying and all selections of variants I've been trying returns all variants in the collection and not just the filtered results.
0 -
BopwareTeam Shopbop There is no "is visible?" bool, and variants of current collection will give you everything - filtered or not. Off the top of my head, I think the only way is to hack out a side effect of "selected" as this ignores hidden variants. So; select all, filter, set up a new variable for the variants whose selected is true, clear filter. That should give you a list of variants after filtering.
tell application "Capture One 21.14.4.1.16"
tell current document
select variants (variants in current collection)
set filters to {"Annotated|YES"}
set annotatedVars to variants of current collection whose selected is true
set filters to {}
end tell
end tell*Just seen while I was writing this up I've crossed posts with Rick. Great minds. :P
0 -
Brilliant! Thanks for both of your help. Got it working but needed to remove the filter, add a slight delay, and re-select all before switching to the other filter.
tell application "Capture One 23"
tell current document
set allVariants to variants in current collection
select variants (variants in current collection)
set filters to {"Annotated|YES"}
delay 0.25
set theAnnotatedVariants to variants of current collection whose selected is true
repeat with thisVariant in theAnnotatedVariants
process thisVariant ¬
recipe "SHOPBOP EDITORIAL PSD"
end repeat
set filters to {}
delay 0.25
select variants (variants in current collection)
set filters to {"Annotated|NO"}
set theNonAnnotatedVariants to variants of current collection whose selected is true
repeat with thisVariant in theNonAnnotatedVariants
process thisVariant ¬
recipe "SHOPBOP EDITORIAL TIFF"
end repeat
set filters to {}
end tell
end tell0 -
you may need to test if "Annotated|YES" is available. If you are in a folder with no annotations you may get an error.
tell application "Capture One 23"
tell current document
set allVariants to variants in current collection
select variants (variants in current collection)
if available filters contains "Annotated|YES" then
set filters to {"Annotated|YES"}
delay 0.25
set theAnnotatedVariants to variants of current collection whose selected is true
repeat with thisVariant in theAnnotatedVariants
process thisVariant ¬
recipe "SHOPBOP EDITORIAL PSD"
end repeat
set filters to {}
delay 0.25
select variants (variants in current collection)
end if
set filters to {"Annotated|NO"}
set theNonAnnotatedVariants to variants of current collection whose selected is true
repeat with thisVariant in theNonAnnotatedVariants
process thisVariant ¬
recipe "SHOPBOP EDITORIAL TIFF"
end repeat
set filters to {}
end tell
end tell0 -
Great call! Definitely need that check.
Also realized that I'll need to expand on this because our users won't be processing all images in the collection but only what they have selected. Will add a bit more code to record ids/check for those when filtering by annotated/not.
Thanks again for all the help with this!
0
Please sign in to leave a comment.
Comments
11 comments