set this_file to choose file
set the target_path to (choose file name default name "MyNewImage.tif") as string
try
tell application "Image Events"
launch
-- open the image file
set this_image to open this_file
-- perform action
scale this_image by factor 0.5
-- save in new file
save this_image as TIFF in file target_path with icon
-- purge the open image data
close this_image
end tell
on error error_message
display dialog error_message
end try
No new files are being generated anywhere, nor am I getting any errors.
I created a test folder on my desktop and placed the original image inside it. Ran the script and selected this image. I then selected that same folder as the destination for the new file.
What kind of files are the files you are trying to convert?
Thanks for the reply. These are very large (50+ MB) Photoshop TIFFs. I understand the file type limitations of Image Events.
BTW, I did manage to make this code work on much smaller images. I’ve found some references on the web to the fact that Image Events can’t handle commands that take a long time, such as resizing, without putting some delays in the code somewhere.
My ultimate goal is to have an Original Tif, another at 50% of size, and one more at 75% of size.
I think Photoshop may be more suited to this task, but I’m not so sure.
Personally, I think Photoshop actions would serve your purpose even better than AS. If you’ve never used Photoshop actions, you should check it out…much easier than writing an AS too.
Another quirk I ran into, even when resizing smallish image files, was that Image Events would not resize properly if I ran 2 operations right after each other, such as you’re considering. These were “scale by a factor” operations. It did fine with one.
I used the Extra Suites ($10) scripting addition’s resizing command, which worked fine.
I can’t sell something that works part of the time, and since the large files are already open in Photoshop, I wrote a script that saves out 2 smaller versions of the flatted file.
If your still having a problem try using iMagine Photo. I know it has worked on a tiff file 30,000 by 30,000 - the largest it can deal with and as long as you have the memory it can deal with it. The file size was greater than 1GB so a 50MByte tiff should be no problem.
I think you will find that it will outperform photoshop quite considerable if you have to process large numbers of files and it is free.