Script to preview two .png s side by side

applescriptpreview

I want to display A.png and B.png together, A left / B right or A top / B bottom.
I can of course

preview A.png
preview B.png

separately, then resize and move the two windows next to each other,
but that's a pain if you do it a lot. Can it be scripted ?
If not, is there an opensource preview-like that can display side-by-side ?

(I have 10.8.3 .
if-preview-app-in-os-x-is-not-applescriptable-why-does-this-work
on SO has a comment
"Preview does have an AppleScript dictionary by default in 10.9 but not in earlier versions of OS X."
)

Best Answer

Open the two files with Preview, then run the following to position the windows:

tell application "Preview"
    activate
    set the bounds of the first window to {0, 0, 700, 1000}
    set the bounds of the second window to {700, 0, 1400, 1000}
end tell

Customise the coordinates as you wish depending on monitor resolution.
Syntax: {x1, y2, x1, y2}

Enable AppleScript in Preview in OS X ≤10.8 by quitting Preview and running:

defaults write com.apple.Preview NSAppleScriptEnabled -bool true