kzdown
asked on
Thumbnails?
My program works with own custom documents and sometimes user creates templates from them.
also there is a background picture into documents. I want to make 'new from template' dialog form that shows thumbnails of my document;s background. SO my question is :
-how to create thumbnail from my background pictures (jpegs)?
thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here's procedure called MakeThumb, just pass the two images as source and target and the thumbnail size
//=====
procedure MakeThumb(src,dst:TImage; size:integer);
var tr:TRect;
newwidth,newheight,orgwidt
begin
orgwidth:=src.width;
orgheight:=src.height;
if (orgheight/orgwidth > 1) then begin
newheight:=size;
newwidth:=round(orgwidth*(
end
else begin
newwidth:=size;
newheight:=round(orgheight
end;
dst.autosize:=false;
dst.stretch:=false;
dst.width:=size;
dst.height:=size;
dst.canvas.pen.color:=clwh
dst.canvas.brush.color:=cl
if (newwidth < size)then begin
tr.left:=(size-newwidth)di
tr.right:=tr.left+newwidth
tr.top:=0;tr.bottom:=size;
dst.canvas.rectangle(0,0,t
dst.canvas.rectangle(tr.ri
end;
if newheight > size then begin
tr.left:=0;tr.right:=size;
tr.top:=(size-newheight)di
tr.bottom:=tr.top+newheigh
dst.canvas.rectangle(0,0,s
dst.canvas.rectangle(0,tr.
end;
dst.canvas.stretchdraw(tr,
end;
procedure TForm1.Button1Click(Sender
begin
makethumb(image1,Image2,10
end;
Best regards
Mohammed nasman