Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

abhi182

macrumors regular
Original poster
Apr 24, 2016
173
120
I am trying to create a really simple Image Capture Plugin in Automator that lets me :
- select Images in image Capture
- Converts selected Images to HEIC
- Imports them to Photos
- Deletes the files (optional but preferable)

While I have created simple services before, I have not used Automator to create an IC plugin.
When I run this snippet within automator (after adding a "Get specified finder items " block at beginning, it imports the files fine.
However when I select images in Image capture and select this as the Import to Action - it seems to run but does not really do anything - as in I can't see the imports in the photos app.

Nor am I able to find a single example of an Image Capture plugin on the Apple website
What am I missing?

1614022507088.png
 
Last edited:

kryten2

macrumors 65816
Mar 17, 2012
1,115
99
Belgium
There's no option to Change Type of Images to type HEIC on High Sierra. What macOS version are you using? Tested with a connected iPad on High Sierra and choosing Change Type of Images to type PNG the Image Capture plugin runs and imports the images into Photos. There's an option in Image Capture to delete the original files(from the iPad), I'm guessing that's what you want. You can try this :

Replace the Import Files into Photos action with a Run AppleScript action and replace the existing code with the following :

AppleScript:
on run {input, parameters}
    
    set itemsToProcess to {}
    
    repeat with i from 1 to the count of input
        set thisItem to (item i of input) as alias
        set the end of itemsToProcess to thisItem
    end repeat
    
    if itemsToProcess is not {} then
        tell application "Photos"
            import itemsToProcess
        end tell
    end if
    
end run

Note: No error checking whatsoever. I'm assuming if it comes from Image Capture, the items passed as input are images.
 

abhi182

macrumors regular
Original poster
Apr 24, 2016
173
120
There's no option to Change Type of Images to type HEIC on High Sierra. What macOS version are you using? Tested with a connected iPad on High Sierra and choosing Change Type of Images to type PNG the Image Capture plugin runs and imports the images into Photos. There's an option in Image Capture to delete the original files(from the iPad), I'm guessing that's what you want. You can try this :

Replace the Import Files into Photos action with a Run AppleScript action and replace the existing code with the following :

AppleScript:
on run {input, parameters}
   
    set itemsToProcess to {}
   
    repeat with i from 1 to the count of input
        set thisItem to (item i of input) as alias
        set the end of itemsToProcess to thisItem
    end repeat
   
    if itemsToProcess is not {} then
        tell application "Photos"
            import itemsToProcess
        end tell
    end if
   
end run

Note: No error checking whatsoever. I'm assuming if it comes from Image Capture, the items passed as input are images.
this is on big sur.
think they added heic support on catalina.

and yes, there is no error checking or even a check to see if previous step is completed (which is stupid IMO)
i was able to make this work by adding a temporary save location on the disk for the HEICs ->adding a pause between convert and import ->followed by a delete routine.
i guess the import process was starting even before heic conversion was completed
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.