Skip to content

Instantly share code, notes, and snippets.

@ayalan
Last active November 18, 2015 07:38
Show Gist options
  • Save ayalan/f7c7c1199ea2a627ed27 to your computer and use it in GitHub Desktop.
Save ayalan/f7c7c1199ea2a627ed27 to your computer and use it in GitHub Desktop.
Automator Applescript to show an image's dimensions in dialog. Useful when Spotlight/Finder refuses to show a PNG's dimensions on a networked volume.
on run {input, parameters}
tell application "Finder"
set theItems to selection
set myList to {}
repeat with itemRef in theItems
set datei to itemRef as string
set the_path to (POSIX path of (container of file datei as string))
set the_name to (name of file datei as string)
set the_file to (the_path & "'" & the_name & "'") as string
set shellcommand to ("sips " & the_file & " --getProperty pixelHeight") as string
set yres to last word of (do shell script shellcommand)
set shellcommand to ("sips " & the_file & " --getProperty pixelWidth") as string
set xres to last word of (do shell script shellcommand)
display dialog the_name & " " & xres & " x " & yres
end repeat
end tell
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment