-- -- centralised text -- -- lua5.1 squares_border.lua -- -- use dir /b *.jpg -- copy output into the picsStr below -- require "gd" -- -- Sec 1.0 Functions -- picsStr = [==[ C:\Documents and Settings\doug\Desktop\lua\lua-gd-2.0.33r2>dir /b *.jpg DSCF6177.jpg DSCF6613.JPG DSCF6901.JPG DSCF6921.JPG DSCF6968.JPG DSCF6969.JPG DSCF7550.JPG DSCF7551.JPG DSCF7572.JPG DSCF7576.JPG DSCF7673.JPG DSCF8153.JPG DSCF8154.JPG ]==] picsStr = [==[ C:\Documents and Settings\doug\Desktop\lua\lua-gd-2.0.33r2>dir /b sailSunSet020529\*.jpg DSCF0228.JPG DSCF0229.JPG DSCF0230.JPG DSCF0231.JPG DSCF0232.JPG DSCF0233.JPG DSCF0234.JPG DSCF0235.JPG DSCF0236.JPG DSCF0237.JPG DSCF0238.JPG DSCF0239.JPG DSCF0240.JPG DSCF0241.JPG DSCF0242.JPG DSCF0243.JPG DSCF0244.JPG DSCF0245.JPG DSCF0246.JPG DSCF0247.JPG DSCF0248.JPG DSCF0249.JPG DSCF0250.JPG DSCF0251.JPG DSCF0252.JPG ]==] function applyBorder( offset ) -- print( color, text, size, ang, bcolor, filename,offset ) -- im = gd.createFromJpeg("./clouds.JPG") im_org = gd.createFromJpeg( "./"..picsA[ 1 + offset ]) -- gd.copyMergeGray(im,im1,1,1,1,1,50,25,50) -- dstImage:copyResampled(srcImage, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH) pdiWidth = 1400 pdiHeight = 1050 pdiPicWidth = 1300 pdiPicHeight = 975 border = 2 imgX,imgY = im_org:sizeXY() im = gd.createTrueColor( pdiWidth, pdiHeight ) color = im:colorAllocateAlpha( 20, 20, 20,10) bcolor = im:colorAllocateAlpha(255, 255, 127,32) white = im:colorAllocateAlpha(255, 255, 255,0) x1 = ( pdiWidth - pdiPicWidth ) /2 y1 = ( pdiHeight - pdiPicHeight ) /2 x2 = pdiWidth - x1 y2 = pdiHeight - y1 border = 2 im:filledRectangle( x1 , y1 , x2 , y2 , bcolor ) -- dstImage:copyResampled(srcImage, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH) im:copyResampled(im_org, x1+border, y1+border, 0, 0, pdiPicWidth-border*2+1, pdiPicHeight-border*2+1, imgX, imgY ) im:sharpen(120.0 ) font = "./Vera.ttf" -- im:stringFT( color, font, size, math.rad(ang), x , y , text) im:stringFT( white, font, 14 , 0, x1 , y1 - 5 , picsA[ 1 + offset ] .. " - Doug Rice, Copyright 2011 ") im:jpeg( "CT-jan 11-" .. ( 1000 + offset) .. ".jpg",100 ) -- im:png( "CT-jan 11-" .. ( 1000 + offset) .. ".png" ) end picsA = {} cnt = 0 for w in string.gmatch(picsStr, "%C+") do print("=="..w.."==") if string.len(w) > 0 then picsA[cnt] = "sailSunSet020529\\"..w cnt = cnt + 1 end end steps = 3 while( steps < cnt ) do applyBorder( steps ) steps = 1 + steps end