Catalina has broken Image Evens

Can anyone else concur? This script, and pretty much all the things I used to do with Image Events to automate image work, has died.

set this_file to choose file
try
tell application “Image Events”
– start the Image Events application
launch
– open the image file
set this_image to open this_file
– extract the property value
copy the resolution of this_image to {H_res, V_res}
– purge the open image data
close this_image
end tell
display dialog "Resolution: " & (H_res as string)
on error error_message
display dialog error_message
end try

I also get an error with Catalina 10.15.0
L.

I’m on Mojave now and confirmed that ppayne’s script works as expected. I previously upgraded to Catalina and found that many of my script’s–including several utilizing Image Events and sips–would not work. I didn’t spend much time troubleshooting this, as I quickly realized that Catalina was not a worthwhile upgrade for me. I’m sure in time I will give Catalina another try, though, and look forward to any fixes suggested by forum members.

There seem to be two issues with Image Events and Catalina.

First, it doesn’t seem to be able to deal with aliases. In the sample code above, the open command returns missing value, so the rest of the script goes nowhere. However, if you pass a file reference – «class furl» – the open command works.

The second issue is that, depending where the image is, you may need permission to read the file, and in such cases no prompt appears. Presumably that’s because Image Events is a background-only app. You can get around this by going to System Preferences → Security & Privacy → Privacy and adding Image Events to Full Disk Access.

So this now works here:

set this_file to (choose file) as «class furl»
tell application "Image Events"
	launch
	set this_image to open this_file
	copy the resolution of this_image to {H_res, V_res}
	close this_image
end tell
display dialog "Resolution: " & (H_res as string)

Practical question….

When you go to Privacy and click “Full Disk Access” and then the “+”, you are presented with a file dialog. Entering “Image” as search term, Image Events can’t be found in the list I am presented when searching “This Computer”.

If I run the script I get a dialog that Script Debugger needs to access Image Events, but that isn’t “Full Disk Access”.

So how does one find this invisible background app?

I found Image Events in /System/Library/CoreServices.

Initially, the script Shane posted worked with an image file on my boot drive but not with an image file on an external drive. After adding Image Events to Security & Privacy, as Shane described in his post, the script worked with the image file on the external drive.

peavine has given you the answer, but you can also let Script Debugger find it for you. Click somewhere in your Image Events code and press command-D, which will open its dictionary. Control-click on Image Events in the dictionary sidebar and you will see Reveal “Image Events” in Finder.

I retried PPayne’s original script under Catalina and, as Shane predicted, it returned:

The script does work after coercing the choose-file command to «class furl» or to text. Image Events supports aliases, so I guess this is just a bug.

EDIT December 10, 2019. I just installed Catalina 10.15.2 and reran the OP’s script. I still get the missing-value error message.

Can someone please explain why the code from the OP on the Catalina is not working and my code below is working? The only difference is this: I use list of aliases instead of simple alias:


set this_file to choose file of type "public.image" with multiple selections allowed

try
	tell application "Image Events"
		-- start the Image Events application
		launch
		-- open the image file
		set this_image to open item 1 of this_file
		-- extract the property value
		copy the resolution of this_image to {H_res, V_res}
		-- purge the open image data
		close this_image
	end tell
	display dialog "Resolution: " & (H_res as string)
on error error_message
	display dialog error_message
end try