Skip to main content

⚠️ Please note that this topic or post has been archived. The information contained here may no longer be accurate or up-to-date. ⚠️

Counting images by focal length

Comments

4 comments

  • Rick Allen
    This might get you started


    set focalLength to get EXIF focal length of image of current document
    set starRating to get rating of variant of current document


    Exif focal length reports the mm focal length (70 mm).
    0
  • Eric Valk
    This works, note that the brackets are essential.

    tell application "Capture One 12" to get count of (images whose EXIF focal length is "75 mm")

    However, to get a count of images within a range of focal lengths you likely need to do some thing like this

    use AppleScript version "2.4" -- Yosemite (10.10) or later
    use scripting additions

    tell application "Capture One 12" to set focalLenghtStringL to EXIF focal length of every image

    set focalLenghtNumL to {}
    set ctrFocalLengthLow to 0
    set UpperThresholdFocalLengthLow to 100
    repeat with thisFocalLengthString in focalLenghtStringL
    repeat with spacePtr from 1 to length of thisFocalLengthString
    if " " = text spacePtr of thisFocalLengthString then exit repeat
    end repeat
    set thisFocalLenghtNum to (text 1 thru (spacePtr - 1) of thisFocalLengthString) as real
    set end of focalLenghtNumL to thisFocalLenghtNum
    ## Put some counters here
    if UpperThresholdFocalLengthLow > thisFocalLenghtNum then set ctrFocalLengthLow to ctrFocalLengthLow + 1
    end repeat
    0
  • Jan-Peter Onstwedder
    Thanks, I'll give that a try!
    0
  • Rick Allen
    Here is another approach

    use AppleScript version "2.4" -- Yosemite (10.10) or later
    use framework "Foundation"
    use scripting additions

    tell application "Capture One 12"

    set focalLength to get EXIF focal length of image of current document
    set starRating to get rating of variant of current document

    end tell
    set L0_24 to 0
    set L25_49 to 0
    set L50_74 to 0
    set L75_100 to 0
    set theList to {}
    repeat with i from 1 to (count of focalLength)
    if item i of starRating is not 0 then
    set theList's end to item 1 of my theSplit(item i of focalLength, space)

    end if
    end repeat

    repeat with a from 1 to (count of theList)
    set itemA to item a of theList as integer
    if itemA is less than or equal to 24 then
    set L0_24 to L0_24 + 1
    end if
    if itemA < 49 and itemA > 25 then
    set L25_49 to L25_49 + 1
    end if
    if itemA < 74 and itemA > 50 then
    set L50_74 to L50_74 + 1
    end if
    if itemA < 100 and itemA > 75 then
    set L75_100 to L75_100 + 1
    end if
    end repeat

    display dialog "Favorite focal lengths" & return & return & "less than 24mm = " & L0_24 & return & "24mm - 49mm = " & L25_49 & return & "50mm - 74mm = " & L50_74 & return & "75mm - 100mm = " & L75_100

    on theSplit(theString, theDelimiter)
    -- save delimiters to restore old settings
    set oldDelimiters to AppleScript's text item delimiters
    -- set delimiters to delimiter to be used
    set AppleScript's text item delimiters to theDelimiter
    -- create the array
    set theArray to every text item of theString
    -- restore the old setting
    set AppleScript's text item delimiters to oldDelimiters
    -- return the result
    return theArray
    end theSplit


    change the L0-24 ranges to suit
    0

Post is closed for comments.