Script to check image resolution + other options

Hi I’m not sure if this is possible, but I would like a script where you could drop images onto it and it would check to see if they are hi res or not, and either notify by dialog or sort the images into folders - High Res and Low Res. You would need to set the criteria for what is considered high res, i.e. the resolution is 300dpi and physical size is over, say 10 cm.

Also it would be good if it could separate out any vector files into a different folder.

Is this possible?

Something like this might get you started:

set tFile to quoted form of POSIX path of (choose file)
set PicSpex to {"kMDItemResolutionHeightDPI", "kMDItemResolutionWidthDPI", "kMDItemResolutionHeightDPI", "kMDItemPixelWidth"}
set ImgSpx to {}
repeat with oneSpec in PicSpex
	set end of ImgSpx to (do shell script "mdls -name " & quoted form of oneSpec & space & tFile)
end repeat

Be aware that not every picture has the necessary metadata.

This will get you started (OS X 10.5, MacIntel):

set theFile to choose file with prompt “Choose file:” – an alias

tell application "Image Events" -- there is no interface for image events
	set imageFile to (open theFile)
	set d to dimensions of imageFile -- returns list {w, h}
	set w to item 1 of d
	set h to item 2 of d
	set r to resolution of imageFile -- returns list {X, Y}
	set rX to item 1 of r
	set rY to item 2 of r
	set b to bit depth of imageFile
	close imageFile
end tell

display dialog ("Width: " & w & ", " & "Height: " & h & ", " & "Res X: " & rX & ", " & "Res Y: " & rY & ", " & "Bit Depth: " & b)

So you can get these properties of an image and compare them to some variables you set up. Make a droplet with an open handler, etc.