' ------------------------------------------------------------------------------------ ' CreateStereoPair.vbs ' This script will create a stereo pair picture using the two selected pictures. ' The pair can be generated for parallel or crossed eyes viewing. ' Note: the two pictures must have the same size. ' ------------------------------------------------------------------------------------ Option Explicit dim alb, pic, pic1, pic2, picR, picNew, i, nb, xSize, ySize, k app.ClearTrace set alb = app.GetCurrentAlbum if not alb is nothing and alb.nbSelectedPicture = 2 then ' Retrives the 2 selected pictures in the album nb = alb.nbPicture k = 1 set pic = alb.GetPicture( 0 ) for i = 0 to nb-1 if pic.bSelected then if k = 1 then set pic1 = pic k = 2 else set pic2 = pic end if end if set pic = pic.next next if pic1.w <> pic2.w or pic1.h <> pic2.h then msgbox "The two pictures must have the same size!", "Error" else app.trace "Using pictures " & pic1.sShortFileName & " and " & pic2.sShortFileName set picR = pic2 if vbNo = MsgBox( "Do you want Parallel or Crossed view ?" & vbcrlf & vbcrlf & "Yes = Parallel view" & vbcrlf & "No = Crossed view", vbQuestion or vbYesNo) then dim pT set pT = pic1 set pic1 = pic2 set pic2 = pT set pT = Nothing end if xSize = pic1.w ySize = pic1.h ' Create an empty new picture and make it the current one set picNew = alb.NewPicture( 2*xSize, ySize, 32, 0 ) alb.nCurrentPicture = picNew.num 'set rc = pic1.rcCrop pic1.copy 0 picNew.paste 0, 0 pic2.copy 0 picNew.paste xSize, 0 picNew.copy 0 alb.DeletePicture picNew set picNew = Nothing ' Now create a "real" picture with it's name derived from the original picture name dim filename filename = alb.ExpandMacro( pic1, "%RP" ) k = instrrev( filename, "." ) ' The new picture will have "_P" appended to its name and will be a JPEG picture filename = left( filename, k-1 ) & "_P.jpg" ' Paste the picture on the clipboard to a new picture and save it app.Trace "Saving picture " & filename alb.paste filename ' The new picture is at the end of the album, move it next to the original picture alb.MovePicture alb.GetPicture( alb.nbPicture-1 ), picR.num, True alb.redraw 'alb.DisplayPicture DP_CURRENT end if else MsgBox "Two pictures must be selected!" end if