Looking For Batch Rotate Script

Hi there,

I’m completely new to Apple Scripts. I’m looking for a script which will batch rotate a whole bunch of images. Folder by folder will suffice, but it would be really fabulous if someone could point me to a script which will take a folder full of subfolders, and rotate the images contained within each subfolder.

I would love whoever can help me with this forever and ever.

look into folder actions you can set up to do a drop in a folder and it will go through each file you drop in there and can rotate

Could you explain a little more detail. Rotate the pics between folders?

Well let’s see what we can do, sarahbee…

Image Events (introduced in Mac OS 10.3) supports the manipulation of images and image-related data. Like System Events, Image Events is a faceless application (located in /System/Library/CoreServices) - so the manipulation operations should be silent.

To use Image Events to rotate images contained in a main folder’s subfolders, try something like this (but don’t forget to test it initially on duplicate files/folders):

property currRotation : 90

to setRotation()
			set currRotation to text returned of (display dialog ¬
				"Please enter the degrees of image rotation required:" default answer currRotation) as integer
			exit repeat
		on error number errNum
			if errNum is -128 then error number errNum
		end try
	end repeat
end setRotation

to rotateImage from currFile
		tell application "Image Events" to tell (open currFile)
			rotate to angle currRotation
			save with icon
		end tell
	on error errMsg
		display dialog errMsg buttons {"Cancel", "Continue..."} default button 2
	end try
end rotateImage

to rotateImages from mainFolder
	tell application "Image Events" to launch
	tell application "Finder" to repeat with currFolder in (get mainFolder's folders)
		repeat with currFile in (get currFolder's files)
			my (rotateImage from currFile as alias)
		end repeat
	end repeat
end rotateImages

rotateImages from choose folder with prompt "Please choose a folder with subfolders containing the image files to rotate:"
display dialog "Image rotation is complete." buttons {"OK"} default button 1 giving up after 10

That’s nice. :wink: