-edit- Sorry, this really should be titled “image dimensions” rather than file size.
Hello All,
I’m a applescript newbie and am under the gun on getting some modifications in place for a monster script. Any insight would be greatly appreciated.
Currently the script compiles a list based on the names of images in a folder that meet the following perimeters:
set these_files to every file of folder this_folder whose name does not start with "." and (name extension is "psd" or name extension is "jpg")
I need to add a perimeter that limits the selection to images 500 x 500 or greater. I’ve tried a few arguments that I found on the web with no luck. Again, any help would be much appreciated!
first of all: welcome to MacScripter
second of all: you’re posting probably in the wrong forum, if you’re using OS X, post into the OS X forum
third of all: as the Finder (and also System Events) doesn’t provide the information you want, you need an extra loop to filter the images with Image Events
tell application "Finder" to set all_files to every file of folder this_folder whose name does not start with "." and (name extension is "psd" or name extension is "jpg")
set these_files to {}
tell application "Image Events"
launch
repeat with oneFile in all_files
try
open oneFile as alias
copy the dimensions of image 1 to {xdim, ydim}
close image 1
if xdim > 499 and ydim > 499 then set end of these_files to contents of oneFile
on error
try
close image 1
end try
end try
end repeat
end tell