Image Events don't work in Mac Monterey

I’ve been trying to do some simple image manipulation, but I can’t get it to work in Mac Monterey.

In my own script I get the error that Image Events doesn’t have ‘View permissions’. I gave the folder the file is in read & write access, I gave Image Events full folder access in the Security System Preferences…but no luck.

So I picked a simple script from https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/ManipulateImages.html and even that fails.


set theImageFile to choose file of type "public.image" with prompt ""

-- Launch Image Events and open the image
tell application "Image Events"
	launch
	open theImageFile
end tell

It returns ‘missing value’ as the result – according to Apples documentation: “The result of the open command is an image object, the newly opened image” – which makes me wonder if it’s again having permission issues.

Any idea what I’m doing wrong?

Thanks in advance.

Model: Macbook Pro M1
AppleScript: 2.8
Browser: Safari 537.36
Operating System: macOS 12

madla. In recent versions of macOS, Image Events doesn’t always work with aliases, and the choose file command returns an alias. The following script works on my computer–I modified it to return something (the image dimensions) just for test purposes. So, as a first step, I would suggest that you run this script in a script editor. You can then deal with permissions.

set theImageFile to choose file of type "public.image" with prompt ""
set theImageFile to theImageFile as text

tell application "Image Events"
	launch
	set theImage to (open file theImageFile)
	set {xResolution, yResolution} to dimensions of theImage
	close theImage
	return {xResolution, yResolution}
end tell

Make sure you go into System Preferences and give Image Events Full Disk Access.

Thank you all, converting the alias into a path or POSIX path solves this issue.
Regarding full disk access. Given Image Events full disk access makes live easier, but doesn’t appear to be necessary as the droplet will request access when run initially.

Following hack works with aliases:


set imageAlias to choose file of type "public.image"

tell application "Image Events"
	launch
	set theImage to open (a reference to imageAlias)
	set {xResolution, yResolution} to dimensions of theImage
	close theImage
	return {xResolution, yResolution}
end tell

or:


set imageAlias to choose file of type "public.image"

tell application "Image Events"
	launch
	set theImage to open item 1 of {imageAlias}
	set {xResolution, yResolution} to dimensions of theImage
	close theImage
	return {xResolution, yResolution}
end tell