garizpe
asked on
resizing Pictures
I have n-pictures and i need to resizing de pictures and save with this scale, example:
If i have a BMP of 800x600 pixels i need to save at 600x400 without lose definition in the Picture
If i have a BMP of 800x600 pixels i need to save at 600x400 without lose definition in the Picture
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
garizpe:
For your 20 points,it is so easy!
var a:Tbitmap;
begin
a:=TBitmap.Create;
a.LoadFromFile('c:\a.bmp') ; //load a Source bitmap 800x600
with TBitmap.Create do begin //Create a new one
... //set other b's property ,for example :pixformat....
Width:=640;
Height:=480; //reset the width and height
Canvas.StretchDraw(b.Canva s.ClipRect ,a); //Draw!!
SaveToFile('c:\b.bmp'); //Save the result.
free;
end;
a.free;
end;
For your 20 points,it is so easy!
var a:Tbitmap;
begin
a:=TBitmap.Create;
a.LoadFromFile('c:\a.bmp')
with TBitmap.Create do begin //Create a new one
... //set other b's property ,for example :pixformat....
Width:=640;
Height:=480; //reset the width and height
Canvas.StretchDraw(b.Canva
SaveToFile('c:\b.bmp'); //Save the result.
free;
end;
a.free;
end;
garizpe:
For your 20 points,it is so easy!
var a:Tbitmap;
begin
a:=TBitmap.Create;
a.LoadFromFile('c:\a.bmp') ; //load a Source bitmap 800x600
with TBitmap.Create do begin //Create a new one
... //set other b's property ,for example :pixformat....
Width:=640;
Height:=480; //reset the width and height
Canvas.StretchDraw(b.Canva s.ClipRect ,a); //Draw!!
SaveToFile('c:\b.bmp'); //Save the result.
free;
end;
a.free;
end;
menxin
For your 20 points,it is so easy!
var a:Tbitmap;
begin
a:=TBitmap.Create;
a.LoadFromFile('c:\a.bmp')
with TBitmap.Create do begin //Create a new one
... //set other b's property ,for example :pixformat....
Width:=640;
Height:=480; //reset the width and height
Canvas.StretchDraw(b.Canva
SaveToFile('c:\b.bmp'); //Save the result.
free;
end;
a.free;
end;
menxin
Hmmmm....
Menxin, don't underestimate a question as the user asked this to be done without loosing definitions in the picture.
The stretchdraw method does not interpolate the image, why the image will sometimes look very weird.
Regards,
Williams
Menxin, don't underestimate a question as the user asked this to be done without loosing definitions in the picture.
The stretchdraw method does not interpolate the image, why the image will sometimes look very weird.
Regards,
Williams
1)Firstly, try canvas.stretchdraw. This is but a wrapper for the stretchBLT api & generally works o.k.
2)Rewrite stretchBlt to do the kind of dithering you want.
You could also convert te bmp to a jpeg & use the TJpegImage to resize & control quality.
GL
Mike