Working With Images Using Image Events

A Good Self Image
One of the more overlooked helpers that Apple includes with Applescript is theImage Events application. While beginning scripters may wonder what Apple was thinking including image-handling commands for a language that can’t display images, graphics professionals who work with TIFF’s, JPEG’s, BMP’s and more on a regular basis know that being able to automate simple image changes without having to manually open a file in Photoshop is a time saver! By the time you finish this article you’ll have a grasp of some simple image manipulations that your graphics department will thank you for!

Become a Convert(er)!
Long ago (back in the Dark Ages when the military and universities ran the Internet and you had to use AOL if you wanted to communicate with other computer users), there were two basic image formats: GIF & JPEG. Knowing which to use was simple, since GIF’s weren’t usually of photographic quality but could do animation - JPEG for photos, GIF’s for most everything else. While TIFF’s existed, most folks hadn’t heard of them because they were mostly used by graphics designers or fax machines.

Then came the Mac, with PICT and MacPaint formats, Windows with BMP’s, and Adobe’s PDF and EPS formats from Acrobat and Illustrator, and PSD from Photoshop. Now many websites use PNG instead of GIF’s and most browsers supported them a few versions back, before they were in common usage.

Suddenly, handling graphics that your clients or customers submit became a lot harder. You would often get a graphic in the wrong format for your needs and have to find a program that could read the format you were given and re-write it in the target format.

Thanks to Image Events, you can simply write a script to convert most of the formats mentioned above. Here’s a script I wrote a while back that will do the job!


property saveTypes : {"BMP", "JPEG", "JPEG2", "PICT", "PNG", "PSD", "TIFF"}
property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", �
	"PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}

--Get the artwork file
set theFiles to choose file with prompt "Choose art file(s)" of type openTypes with multiple selections allowed without invisibles
runConversion(theFiles)

on open someFiles
	runConversion(someFiles)
end open

on runConversion(theItems)
	if (number of items of theItems) is greater than 0 then
		set newType to choose from list saveTypes with prompt "Convert to..." without multiple selections allowed
		if newType contains "JPEG2" then set newType to "JPG"
		if class of newType is not boolean then
			set newType to newType as text
			repeat with anItem in theItems
				tell application "Finder"
					set theType to file type of anItem
					set theExt to name extension of anItem
					set theName to displayed name of anItem
				end tell
				if (openTypes contains theType) or (openTypes contains theExt) then
					convertImage(anItem, newType)
				else
					display dialog "Skipping " & theName
				end if
			end repeat
		else
			display dialog "No type selected to convert to."
		end if
	else
		display dialog "Nothing to convert."
	end if
end runConversion

on convertImage(theArt, theType)
	--convert the image
	tell application "Finder"
		set saveExt to extension hidden of theArt
		set extension hidden of theArt to true
		set theFolder to (container of theArt) as text
		set theNewArt to (theFolder as text) & (displayed name of theArt) & "." & theType
		set extension hidden of theArt to saveExt
	end tell
	tell application "Image Events"
		launch
		set imageFile to (open theArt)
		if theType is "BMP" then
			save imageFile as BMP in theNewArt
		else if theType is "JPEG" then
			save imageFile as JPEG in theNewArt
		else if theType is "JPEG2" then
			save imageFile as JPEG2 in theNewArt
		else if theType is "PICT" then
			save imageFile as PICT in theNewArt
		else if theType is "PNG" then
			save imageFile as PNG in theNewArt
		else if theType is "PSD" then
			save imageFile as PSD in theNewArt
		else if theType is "TIFF" then
			save imageFile as TIFF in theNewArt
		end if
	end tell
	display dialog "Wrote " & theNewArt giving up after 1
end convertImage

Note: Since I have both older Mac files and newer ones (created since OS X), some files have the old Mac 4-character file type (“JPEG”) and some have the newer Uniform File Type (“public.jpeg”). I’ve listed both versions of the open-able file types in the openTypes property.

The on open handler accepts dropped groups of files or the (implied) on run handler allows you to choose files using a standard dialog box. The runConversion handler asks the user to choose an image type to convert the input files to and then loops over the list of files, passing each one to the convertImage handler.

convertImage is the heart of the script. First we use a tell block aimed at the Finder to get information about each file for use later when we convert the image and save the file. The second tell block directs the Image Events application to launch and then uses the open command to set an Applescript variable to the contents of the image file. Once the file is contained in the variable, theArt, then we direct Image Events to save the file as the new type, using a new file name string with the correct extension (theNewArt).

Yep, that’s it! Just read in the art and re-save it. Image Events is fairly straightforward, as you can see.

Scaling New Heights
Here’s another script that uses Image Events, but this time we’ll re-scale some pictures. This script came into being because a friend of mine picks up photos from websites that he likes to use as desktop pictures. But if you’ve looked at Flickr and Picasa you know that often the photos users submit are not of desktop sizes. Using iPhoto to organize those photos you download is handy and you can set your Desktop Preferences to display an iPhoto album easily enough, but who wants to resize each one so that it fits either the height or width of the desktop area? You will find that if you have mixed orientations, often the taller pictures will exceed the display height available. So, rather than fight with each photo in Photoshop or iPhoto, I wrote my friend this script that allows the user to scale batches of images to a maximum height (for tall photos) and width (for wide ones). The script is below:


property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", �
	"PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}

--Get the artwork file
set theFiles to choose file with prompt "Choose art file(s)" of type openTypes with multiple selections allowed without invisibles
runConversion(theFiles)

on open someFiles
	runConversion(someFiles)
end open

on runConversion(theItems)
	set saveFolder to choose folder with prompt "Save resized pictures where?" without multiple selections allowed and invisibles
	tell application "Image Events"
		launch
		set newHeight to 600
		set newWidth to 0
		if (count items of theItems) is greater than 0 then
			repeat with anItem in theItems
				set imageFile to (open anItem)
				set theSize to dimensions of imageFile
				set width to item 1 of theSize
				set height to item 2 of theSize
				set ratio to (width / height)
				set newWidth to (ratio * newHeight) as integer
				if newHeight > newWidth then
					scale imageFile to size newHeight
				else
					scale imageFile to size newWidth
				end if
				save imageFile as JPEG in saveFolder
				close imageFile
			end repeat
		else
			display dialog "Nothing to convert."
		end if
	end tell
end runConversion

As you can see, it’s constructed in much the same fashion as the first script, except that the runConversion handler does all the work this time. In that handler, we tell the Image Events application to repeat through the list of image files after we choose a folder for the re-scaled images. For each file, we get the height and width, then compute the new width based on the maximum desktop height (600 pixels here, you can use your own display height). We then check to see if the image is taller or wider and scale the image to either the new height or the new width. Then we save the images in JPEG format (for convenience sake; You could save in the original format if you want to do the extra work).

Image Events has many other functions – you can crop, rotate, flip, pad (add space to the edges), change profiles (RGB/CMYK/etc.) and get information about images (bit depth, color space, resolution, etc.). The Image Events dictionary includes the Standard Suite of commands/objects as well as a Text Suite and a Disk-Folder-File Suite. But the core of the application is the Image Suite and the Image Events Suite, both of which are listed below:


Image Suite
Terms and Events for controlling Images

close‚v : Close an image
close reference : the object for the command
[saving ask/no/yes/no/yes] : Specifies whether changes should be saved before closing.
[saving in Unicode text] : The file in which to save the image.

crop‚v : Crop an image
crop reference : the object for the command
to dimensions list : the width and height of the new image, respectively, in pixels, as a pair of integers

embed‚v : Embed an image with an ICC profile
embed reference : the object for the command
with source profile : the profile to embed in the image

flip‚v : Flip an image
flip reference : the object for the command
[horizontal boolean] : flip horizontally
[vertical boolean] : flip vertically

match‚v : Match an image
match reference : the object for the command
to destination profile : the destination profile for the match

pad‚v : Pad an image
pad reference : the object for the command
to dimensions list : the width and height of the new image, respectively, in pixels, as a pair of integers

rotate‚v : Rotate an image
rotate reference : the object for the command
to angle real : rotate using an angle

save‚v : Save an image to a file in one of various formats
save reference : the object for the command
[as BMP/JPEG/JPEG2/PICT/PNG/PSD/QuickTime Image/TIFF] : file type in which to save the image ( default is to make no change )
[icon boolean] : Shall an icon be added? ( default is false )
[in disk item] : file path in which to save the image, in HFS or POSIX form
[PackBits boolean] : Are the bytes to be compressed with PackBits? ( default is false, applies only to TIFF )
→ alias

scale‚v : Scale an image
scale reference : the object for the command
[by factor real] : scale using a scalefactor
[to size integer] : scale using a max width/length

unembed‚v : Remove any embedded ICC profiles from an image
unembed reference : the object for the command

display‚n [inh. item] : A monitor connected to the computer
elements
contained by application.
properties
display profile (profile, r/o) : the profile for the display
name (Unicode text, r/o) : the name of the display
number (unsigned integer, r/o) : the number of the display

image‚n [inh. item] : An image contained in a file
elements
contains metadata tags, profiles; contained by application.
properties
bit depth (best/black & white/color/four colors/four grays/grayscale/millions of colors/millions of colors plus/sixteen colors/sixteen grays/thousands of colors/two hundred fifty six colors/two hundred fifty six grays, r/o) : bit depth of the image's color representation
color space (CMYK/Eight channel/Eight color/Five channel/Five color/Gray/Lab/Named/RGB/Seven channel/Seven color/Six channel/Six color/XYZ, r/o) : color space of the image's color representation
dimensions (list, r/o) : the width and height of the image, respectively, in pixels, as a pair of integers
embedded profile (profile, r/o) : the profile, if any, embedded in the image
file type (BMP/GIF/JPEG/JPEG2/MacPaint/PDF/Photoshop/PICT/PNG/PSD/QuickTime Image/SGI/Text/TGA/TIFF, r/o) : file type of the image's file
image file (file, r/o) : the file that contains the image
location (disk item, r/o) : the folder or disk that encloses the file that contains the image
name (Unicode text, r/o) : the name of the image
resolution (list, r/o) : the pixel density of the image, in dots per inch, as a pair of integers

metadata tag‚n [inh. item] : A metadata tag: EXIF, IPDC, etc.
elements
contained by images.
properties
description (Unicode text, r/o) : the description of the tag's function
name (Unicode text, r/o) : the name of the tag
value (item, r/o) : the current setting of the tag

profile‚n [inh. item] : A ColorSync ICC profile.
elements
contained by images, application.
properties
color space (CMYK/Eight channel/Eight color/Five channel/Five color/Gray/Lab/Named/RGB/Seven channel/Seven color/Six channel/Six color/XYZ, r/o) : the color space of the profile
connection space (Lab/XYZ, r/o) : the connection space of the profile
creation date (date, r/o) : the creation date of the profile
creator (Unicode text, r/o) : the creator type of the profile
device class (abstract/colorspace/input/link/monitor/named/output, r/o) : the device class of the profile
device manufacturer (Unicode text, r/o) : the device manufacturer of the profile
device model (integer, r/o) : the device model of the profile
location (alias, r/o) : the file location of the profile
name (Unicode text, r/o) : the description text of the profile
platform (Unicode text, r/o) : the intended platform of the profile
preferred CMM (Unicode text, r/o) : the preferred CMM of the profile
quality (best/draft/normal, r/o) : the quality of the profile
rendering intent (absolute colorimetric intent/perceptual intent/relative colorimetric intent/saturation intent, r/o) : the rendering intent of the profile
size (integer, r/o) : the size of the profile in bytes
version (Unicode text, r/o) : the version number of the profile


Image Events Suite
Terms and Events for controlling the Image Events application

application‚n [inh. application; see also Standard Suite] : The Image Events application
elements
contains aliases, disks, displays, documents, domains, files, folders, images, items, profiles, windows.
properties
applications folder (folder, r/o) : The user's Applications folder
Classic domain (Classic domain object, r/o) : the collection of folders belonging to the Classic System
default CMYK profile (profile) : the default CMYK profile
default CMYK profile location (file) : the default CMYK profile location
default Gray profile (profile) : the default Gray profile
default Gray profile location (file) : the default Gray profile location
default Lab profile (profile) : the default Lab profile
default Lab profile location (file) : the default Lab profile location
default RGB profile (profile) : the default RGB profile
default RGB profile location (file) : the default RGB profile location
default XYZ profile (profile) : the default XYZ profile
default XYZ profile location (file) : the default XYZ profile location
desktop folder (folder, r/o) : The user's Desktop folder
desktop pictures folder (folder, r/o) : The Desktop Pictures folder
documents folder (folder, r/o) : The user's Documents folder
favorites folder (folder, r/o) : The user's Favorites folder
Folder Action scripts folder (folder, r/o) : The user's Folder Action Scripts folder
fonts folder (folder, r/o) : The Fonts folder
home folder (folder, r/o) : The Home folder of the currently logged in user
local domain (local domain object, r/o) : the collection of folders residing on the Local machine
movies folder (folder, r/o) : The user's Movies folder
music folder (folder, r/o) : The user's Music folder
network domain (network domain object, r/o) : the collection of folders residing on the Network
pictures folder (folder, r/o) : The user's Pictures folder
preferences folder (folder, r/o) : The user's Preferences folder
preferred CMM (Unicode text) : specifies preferred Color Management Module to use, or "automatic"
profile folder (alias, r/o) : the ColorSync profile folder
public folder (folder, r/o) : The user's Public folder
quit delay (unsigned integer) : the time in seconds the application will idle before quitting; if set to zero, idle time will not cause the application to quit
scripting additions folder (folder, r/o) : The Scripting Additions folder
scripts folder (folder, r/o) : The user's Scripts folder
sites folder (folder, r/o) : The user's Sites folder
speakable items folder (folder, r/o) : The Speakable Items folder
startup disk (disk, r/o) : the disk from which Mac OS X was loaded
system domain (system domain object, r/o) : the collection of folders belonging to the System
system profile (profile) : the default system profile
system profile location (file) : the default system profile location
temporary items folder (folder, r/o) : The Temporary Items folder
trash (folder, r/o) : The user's Trash folder
user domain (user domain object, r/o) : the collection of folders belonging to the User
utilities folder (folder, r/o) : The Utilities folder

If you work with graphic images regularly, take a look at Image Events. Using it could really help you improve your image…with your boss!

This post is absurdly old, but has been very useful to me. Is there a statute of limitations on dragging up old threads? :slight_smile:

I am running a very old QuadG5 to use an ancient imaging app under Classic. I have found that modern image editors are not respecting Mac requirements for image formats, so for example, when I’m exporting Tiff files from a modern image editor, to use in my old app, I am having to convert them in Photoshop into a PPC format and also one that correctly uses alpha channels for older Macs.

Wonder of wonders, your script converts beautifully into the older format AND alpha channels work as they should. Fab.

There is however, a problem with naming, in that the files already have an extension, but are being renamed as, for example; ‘UPDATED - filename.tif.TIFF’

I don’t understand your script well enough to alter it. I could workaround by integrating it into an Automator action, but that seems a little silly. Would you be good enough to tell me how I need to change it so that the files simply retain the original name of the file they are replacing?

(Also … it would be even better if the dialog didn’t appear after each conversion :slight_smile: )

Here is a script that fixes the double extension problem with the ImageConvert Applescript.

property saveTypes : {"BMP", "JPEG", "JPEG2", "PICT", "PNG", "PSD", "TIFF"}
property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", "PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}

--Get the artwork file
set theFiles to choose file with prompt "Choose art file(s)" of type openTypes with multiple selections allowed without invisibles
runConversion(theFiles)

on open someFiles
	runConversion(someFiles)
end open

on runConversion(theItems)
	if (number of items of theItems) is greater than 0 then
		set newType to choose from list saveTypes with prompt "Convert to..." without multiple selections allowed
		if newType contains "JPEG2" then set newType to "JPG"
		if class of newType is not boolean then
			set newType to newType as text
			repeat with anItem in theItems
				tell application "Finder"
					set theType to file type of anItem
					set theExt to name extension of anItem
					set theName to displayed name of anItem
				end tell
				if (openTypes contains theType) or (openTypes contains theExt) then
					convertImage(anItem, newType)
				else
					display dialog "Skipping " & theName
				end if
			end repeat
		else
			display dialog "No type selected to convert to."
		end if
	else
		display dialog "Nothing to convert."
	end if
end runConversion

on convertImage(theArt, theType)
	--convert the image
	set NoExtName to remove_extension(theArt as text)
	tell application "Finder"
		set theNewArt to (NoExtName as text) & "." & theType
	end tell
	tell application "Image Events"
		launch
		set imageFile to (open theArt)
		if theType is "BMP" then
			save imageFile as BMP in theNewArt
		else if theType is "JPEG" then
			save imageFile as JPEG in theNewArt
		else if theType is "JPEG2" then
			save imageFile as JPEG2 in theNewArt
		else if theType is "PICT" then
			save imageFile as PICT in theNewArt
		else if theType is "PNG" then
			save imageFile as PNG in theNewArt
		else if theType is "PSD" then
			save imageFile as PSD in theNewArt
		else if theType is "TIFF" then
			save imageFile as TIFF in theNewArt
		end if
	end tell
	display dialog "Wrote " & theNewArt giving up after 5
end convertImage

on remove_extension(this_name)
	if this_name contains "." then
		set this_name to (the reverse of every character of this_name) as string
		set x to the offset of "." in this_name
		set this_name to (text (x + 1) thru -1 of this_name)
		set this_name to (the reverse of every character of this_name) as string
	end if
	return this_name
end remove_extension

If you experience any problems, please let me know.

RobK

[applescript] and [/applescript] tags added by NG.

Hi RobK.

I’ve wrapped your script code in MacScripter’s [applescript] and [/applescript] tags, so that it’s shown in a box with a clickable link as above. Would you mind using these tags yourself when posting AppleScript and or ASObjC code here? There’s an “Applescript” button for them just above the text field when you enter posts.

Cheers.

Thanks Nigel.

I have cleaned up the updated code. Now the naming conventions for the subroutines and variables are consistent. It should be a little easier to read now.

Below is my code wrapped with the Applescript tags.


property saveTypes : {"BMP", "JPEG", "JPEG2", "PICT", "PNG", "PSD", "TIFF"}
property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", "PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}

--Get the artwork file
set theFiles to choose file with prompt "Choose art file(s)" of type openTypes with multiple selections allowed without invisibles
runConversion(theFiles)

on open someFiles
	runConversion(someFiles)
end open

on runConversion(theItems)
	if (number of items of theItems) is greater than 0 then
		set newType to choose from list saveTypes with prompt "Convert to..." without multiple selections allowed
		if newType contains "JPEG2" then set newType to "JPG"
		if class of newType is not boolean then
			set newType to newType as text
			repeat with anItem in theItems
				tell application "Finder"
					set theType to file type of anItem
					set theExt to name extension of anItem
					set theName to displayed name of anItem
				end tell
				if (openTypes contains theType) or (openTypes contains theExt) then
					convertImage(anItem, newType)
				else
					display dialog "Skipping " & theName
				end if
			end repeat
		else
			display dialog "No type selected to convert to."
		end if
	else
		display dialog "Nothing to convert."
	end if
end runConversion

on convertImage(theArt, theType)
	--convert the image
	set noExtName to removeExtension(theArt as text)
	tell application "Finder"
		set theNewArt to (noExtName as text) & "." & theType
	end tell
	tell application "Image Events"
		launch
		set imageFile to (open theArt)
		if theType is "BMP" then
			save imageFile as BMP in theNewArt
		else if theType is "JPEG" then
			save imageFile as JPEG in theNewArt
		else if theType is "JPEG2" then
			save imageFile as JPEG2 in theNewArt
		else if theType is "PICT" then
			save imageFile as PICT in theNewArt
		else if theType is "PNG" then
			save imageFile as PNG in theNewArt
		else if theType is "PSD" then
			save imageFile as PSD in theNewArt
		else if theType is "TIFF" then
			save imageFile as TIFF in theNewArt
		end if
	end tell
	display dialog "Wrote " & theNewArt giving up after 3
end convertImage

on removeExtension(thisName)
	if thisName contains "." then
		set thisName to (the reverse of every character of thisName) as string
		set x to the offset of "." in thisName
		set thisName to (text (x + 1) thru -1 of thisName)
		set thisName to (the reverse of every character of thisName) as string
	end if
	return thisName
end removeExtension

By the way, the original code written by Kevin Bradley will work as expected BUT ONLY if you do NOT have the “Show all filename extensions” option enabled in the preferences for Finder.

The updated code posted above will work no matter how you set that option in Finder.

Yvan Koenig pointed a problem with my updated code in another forum of this website. It may not work properly if your path to the image filename to be converted contains periods and the filename has no extension. (e.g. ~/Desktop/12.24.99/Image). Yvan provided a more elegant solution.

Below is the updated code using Yvan Koenig’s approach:



property saveTypes : {"BMP", "JPEG", "JPEG2", "PICT", "PNG", "PSD", "TIFF"}
property openTypes : {"PDF", "com.adobe.pdf", "BMP", "com.microsoft.bmp", "JPEG", "JPEG2", "jpg", "public.jpeg", "PICT", "com.apple.pict", "PNG", "public.png", "PSD", "com.adobe.photoshop-image", "TIFF", "public.tiff"}

--Get the artwork file
set theFiles to choose file with prompt "Choose art file(s)" of type openTypes with multiple selections allowed without invisibles
runConversion(theFiles)

on open someFiles
	runConversion(someFiles)
end open

on runConversion(theItems)
	if (number of items of theItems) is greater than 0 then
		set newType to choose from list saveTypes with prompt "Convert to..." without multiple selections allowed
		if newType contains "JPEG2" then set newType to "JPG"
		if class of newType is not boolean then
			set newType to newType as text
			repeat with anItem in theItems
				tell application "Finder"
					set theType to file type of anItem
					set theExt to name extension of anItem
					set theName to displayed name of anItem
				end tell
				if (openTypes contains theType) or (openTypes contains theExt) then
					convertImage(anItem, newType)
				else
					display dialog "Skipping " & theName
				end if
			end repeat
		else
			display dialog "No type selected to convert to."
		end if
	else
		display dialog "Nothing to convert."
	end if
end runConversion

on convertImage(theArt, theType)
	--convert the image
	
	set theNewArt to replaceExtension(theArt, theType)
	
	tell application "Image Events"
		launch
		set imageFile to (open theArt)
		if theType is "BMP" then
			save imageFile as BMP in theNewArt
		else if theType is "JPEG" then
			save imageFile as JPEG in theNewArt
		else if theType is "JPEG2" then
			save imageFile as JPEG2 in theNewArt
		else if theType is "PICT" then
			save imageFile as PICT in theNewArt
		else if theType is "PNG" then
			save imageFile as PNG in theNewArt
		else if theType is "PSD" then
			save imageFile as PSD in theNewArt
		else if theType is "TIFF" then
			save imageFile as TIFF in theNewArt
		end if
	end tell
	display dialog "Wrote " & theNewArt giving up after 3
end convertImage

on replaceExtension(thisName, newExt)
	tell application "Finder"
		set theExt to (name extension of thisName)
	end tell
	set thisName to thisName as string
	if theExt is "" then
		set noExtPath to thisName as string
	else
		set noExtPath to (text items 1 thru -(2 + (count theExt)) of thisName) as string
	end if
	return (noExtPath & "." & newExt) as text
end replaceExtension

Yvan Koenig also suggested that one could use a simpler property statement for openTypes as well:

property openTypes : {“com.adobe.pdf”, “com.microsoft.bmp”, “public.jpeg”, “com.apple.pict”, “public.png”, “com.adobe.photoshop-image”, “public.tiff”}

But I find the original property statement for openTypes a little more readable.

Hi everybody.
First, sorry for my English, because I’m French :slight_smile:

Thanks for this script, it works well until Mac OS 10.5.8 for me.
But, in 10.15, there is a problem.

No error in script but no convert.

Is there anybody help me ?
Best

I am sorry you are having problems with my modified Image Convert script on Catalina.

The script runs well for me on High Sierra.
But I did not test all possible image conversions.

What type of image are you trying to convert? (e.g BMP)
And what type are you trying to convert the image to? (e.g. JPG)


Je suis désolé que vous rencontriez des problèmes avec mon script de conversion d’image modifié sur Catalina.

Le script fonctionne bien pour moi sur High Sierra.
Mais je n’ai pas testé toutes les conversions d’image possibles.

Quel type d’image essayez-vous de convertir? (par exemple BMP)
Et dans quel type essayez-vous de convertir l’image? (par exemple JPG)

Hi, thanks for response !
I try to convert tif, psd to jpeg.
But if the others possibilities can match, it will be cool !
Thanks

I created two simple image files using an image editor (e.g. Pixelmator) – a TIFF image file and a PSD image file.

I was able to successfully convert the TIFF and PSD files into a JPG using my Image Convert Applescript above on High Sierra.

I verified that the conversion actually took place by using the “file” command in the Terminal:

So the script does work for me when converting TIFF or PSD to JPEG on High Sierra.

I know you are using Catalina. Since Catalina no longer supports 32-bit apps, make sure you run the Image Convert script in Script Editor on Catalina. Catalina’s Script Editor will compile the script and run it. If you want you can then save it as an application.

If you saved the Image Convert Script as an Application using Script Editor on an old MAC OS X release (like Leopard), it will likely not work on Catalina.

I would also check to make sure you have write permissions for the directory in which you are trying to save the converted image. (If you try to save the converted image to your Documents or Downloads folder, you should be okay).

You can try to batch convert your images using Preview.
See
https://www.macrumors.com/how-to/batch-convert-images-to-different-formats-using-macos-preview/

If the images still do not convert, perhaps there is a problem with your TIFF and PSD image files.

P.S. There are also lots of great commercial image conversion programs for the Mac. Graphic Converter is very popular with professional photographers. You can try most of them before you buy. I would also try one of these programs and see if it is able to convert your images. If a commercial program, like Graphic Converter, cannot convert your images then the problem is likely with your images.
See
https://www.lemkesoft.de/en/products/graphicconverter/
https://www.batchphoto.com/blog/top-10-batch-image-converter-software-for-mac/

AppleScript: 2.7
Operating System: macOS 10.13