Stereo photo flipping script
From ShawnReevesWiki
Jump to navigationJump to searchThis is an AppleScript program that will attempt to open any file(s) dragged onto it in Photoshop CS6 and switch the left and right halves. This is a useful utility for changing the orientation of stereoscopic photos from using viewers to using crossed eyes and back. Please note that the script will overwrite the existing files, so work on copies if you want to keep the original orientation.
on open of finderObjects -- called when finder items dropped on this application's icon -- set destFolder to choose folder with prompt "Destination folder?" repeat with i in (finderObjects) if folder of (info for i) is false then SwitchSides(i) end if end repeat end open on SwitchSides(FileRef) tell application "Adobe Photoshop CS6" -- Change the name of this application to match your version of PS open FileRef -- This may need error-handling in case an incompatible file is dropped activate set dw to width of current document -- These measurements are in units, not pixels. set dh to height of current document set dr to resolution of current document -- This will allow us to convert to pixels for selection resize canvas current document width (dw * 1.5) height (dh) anchor position middle left -- measured in units. Add an empty space on the right select current document region {{0, 0}, {dw * dr / 2, 0}, {dw * dr / 2, dh * dr}, {0, dh * dr}} -- measured in pixels translate selection of current document delta x dw delta y 0 -- measured in units resize canvas current document width (dw) height (dh) anchor position middle right -- remove the left side close current document saving yes -- NOTE THIS WILL OVERWRITE THE ORIGINAL FILE. end tell end SwitchSides