REBOL [ File: %thumbnail-maker.r Date: 4-sep-2009 Title: "Thumbnail Maker" Author: Nick Antonaccio Purpose: { Create image preview sheets from a list of files. Used to make the introductory image at http://musiclessonz.com/rebol.html } ] view center-face layout [ text "Resize input images to this height:" height: field "200" text "Create output mosaic of this width:" width: field "600" text "Space between thumbnails:" padding-size: field "30" text "Color between thumbnails:" btn "Select color" [background-color: request-color/color white] text "Thumbnails will be displayed in this order:" the-images: area across btn "Select images" [ some-images: request-file/title trim/lines {Hold down the [CTRL] key to select multiple images:} "" if some-images = none [return] foreach single-image some-images [ append the-images/text single-image append the-images/text "^/" ] show the-images ] btn "Create Thumbnail Mosaic" [ y-size: to-integer height/text mosaic-size: to-integer width/text padding: to-integer padding-size/text if error? try [background-color: to-tuple background-color][ background-color: white ] images: copy parse/all the-images/text "^/" if empty? images [alert "No images selected." break] mosaic: compose [ backcolor (background-color) space (padding) across ] foreach picture images [ flash rejoin ["Resizing " picture "..."] original: load to-file picture unview either original/size/2 > y-size [ new-x-factor: y-size / original/size/2 new-x-size: round original/size/1 * new-x-factor new-image: to-image layout/tight [ image original to-pair rejoin [new-x-size "x" y-size] ] append mosaic compose [image (new-image)] ][ append mosaic compose [image (original)] ] current-layout: layout/tight mosaic if current-layout/size/1 > mosaic-size [ insert back back tail mosaic 'return ] ] filename: to-file request-file/file/save "mosaic.png" save/png filename (to-image layout mosaic) view/new layout [image load filename] ] ]