' Tiled Array of Images ' Note: This script requires QFX 8.0 or better. ' This example will create a new image with a tiled array of images ' and works best if all images are the same size and orientation. ' The variables below are set in the Form dialog ' Set the values of these variables to the default values ' you want displayed when the dialog first appears $OrigFolder = '' $Extn = '' $Cols = 8 $Rows = 6 $Twidth = 500 $Theight = 400 $Border = 0 $Bcolor = '255,255,255' ' Clear any message from the Message Bar [ECHO] ' The line below is a 'label', used as the target of a [GOTO] later ' in the script if there is an error found on the form. GetInput: ' Put up the Form dialog and get user input [FORM] Title="Tile Images" Size=160,40 Posn=-1,-1 Help="" [INPUTMSG] Message="Click the [...] button and select the folder with the images you want in the tiled layout." Size=160,22 Posn=-1,-1 [INPUTBROWSE] Name="OrigFolder" Value="$OrigFolder" Prompt="Source Folder" Size=100,10 Type=Folders Extn="All Files (*.*)%*.*%" [INPUTLIST] Name="Extn" List="BMP,GIF,JPG,TGA,TIF" Value="TGA" Prompt="File Type" Size=80,40 Posn=-1,-1 Style=DropDown [INPUTMSG] Message="Select the tile layout:" Size=150,10 Posn=-1,-1 [INPUTSPIN] Name="Cols" Value="$Cols" Prompt="Tiles Across" Size=25,12 Posn=-1,-1 Min="1" Max="255" Decimal=0 Incr="1" [INPUTSPIN] Name="Rows" Value="$Rows" Prompt="Tiles Down" Size=25,12 Posn=-1,-1 Min="1" Max="255" Decimal=0 Incr="1" [INPUTMSG] Message="Select the size of each tile:" Size=150,10 Posn=-1,-1 [INPUTSPIN] Name="Twidth" Value="$Twidth" Prompt="Tile Width" Size=25,12 Posn=-1,-1 Min="1" Max="255" Decimal=0 Incr="1" [INPUTSPIN] Name="Theight" Value="$Theight" Prompt="Tile Height" Size=25,12 Posn=-1,-1 Min="1" Max="255" Decimal=0 Incr="1" [INPUTCOLOR] Name="Bcolor" Value="$Bcolor" Prompt="Background Color" Size=16,16 Posn=-1,-1 Type=Default [INPUTSPIN] Name="Border" Value="$Border" Prompt="Border Size (0=none)" Size=25,12 Posn=-1,-1 Min="1" Max="255" Decimal=0 Incr="1" [FORMEND] ' Make sure we have a folder name [IF] Len( '$OrigFolder' ) = 0 [MSGBOX] Name="" Prompt="You did not enter an image name in the Source Folder box. Please try again." Title="Tile Images" Buttons=Ok Icon=Exclamation [GOTO] GetInput [ENDIF] ' Set Canvas color ColorCanvas RGB=$Bcolor ' Calculate the canvas size, allowing for borders $Cwidth = $Cols * $Twidth + ($Cols + 1) * $Border $Cheight = $Rows * $Theight + ($Rows + 1) * $Border ' Open new canvas at calculated size FileNew Pixels=$Cwidth,$Cheight Dpi=300 Model=RGB ' The following line ensures the images are pllaced in alphabetical order. ' Tip: Change "WildSort=Yes" to "WildSort=No" for an unsorted order. [OPTIONS] WildSort=Yes SortOrder=Up ' The following commands paste the images: ' Start first loop, this indexes the rows in the layout [LOOP] Start=$Border Incr=$Theight+$Border Times=$Rows Name="iRow" ' Start second loop, this indexes the columns in the layout [LOOP] Start=$Border Incr=$Twidth+$Border Times=$Cols Name="iCol" ' Paste the images EditPaste Filename="$OrigFolder*.$Extn" Source=File Size=$Twidth,$Theight Locate=$iCol,$iRow Angle=0 Skew=0 Mask=None Trans=255 Calc=Normal Qual=3,3 Paste=Yes ' End both loops [LOOPEND] [LOOPEND] ' End of script [QUIT]