on run {input, parameters}
on run {input, parameters}
set theURLofImage to "https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/se/se-logo.png"
set tempFolderThatIsAutomaticallyDeletedAfterRun to |temporary items path| of parameters
set filename to "StackExchangeLogo.png"
set fullFilepath to tempFolderThatIsAutomaticallyDeletedAfterRun & "/" & filename
-- Saving image from internet to disk.
-- From: http://stackoverflow.com/a/21491446/7138483
do shell script "curl -f " & theURLofImage & " -o " & fullFilepath
-- Figuring out the dimensions of the saved image.
-- From: https://www.macosxautomation.com/applescript/imageevents/01.html
try
tell application "Image Events"
launch
set this_image to open fullFilepath
-- Extract the properties record.
set the props_rec to the properties of this_image
-- Purge the open image data.
close this_image
-- Extract the property value from the record.
copy (dimensions of props_rec) to {x, y}
set the image_info to "Dimensions of " & filename & ": " & "" & x & " x " & y
end tell
display dialog image_info
on error error_message
display dialog error_message
end try
return input
end run