如何将BMP位图转换为指定象素? |
尚未結案
|
plmm25
一般會員 ![]() ![]() 發表:15 回覆:6 積分:4 註冊:2004-04-20 發送簡訊給我 |
|
Chance36
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:31 回覆:1033 積分:792 註冊:2002-12-31 發送簡訊給我 |
請參考下列文章,有很精闢的說明
http://delphi.ktop.com.tw/topic.php?topic_id=49370
http://delphi.ktop.com.tw/topic.php?topic_id=34732 ★
http://delphi.ktop.com.tw/topic.php?topic_id=43205
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=38057
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=38124 ★ 發表人 - chance36 於 2004/05/17 19:03:11
|
yachanga
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:24 回覆:335 積分:296 註冊:2003-09-27 發送簡訊給我 |
這個問題好像很面熟
|
killghost
一般會員 ![]() ![]() 發表:14 回覆:21 積分:7 註冊:2004-04-21 發送簡訊給我 |
下面是我的方法将图片压缩成了160*120:
Function CompressIMG(o_bitmap:Tbitmap):Tbitmap;
var
MaxPixW: real;
MaxPixH: real;
imagex: real;
imagey: real;
proportion:real;
tempRect :TRect;
n_bitmap:Tbitmap;
begin
n_bitmap:=TBitmap.create;
MaxPixW:=o_bitmap.Width;
MaxPixH:=o_bitmap.Height;
imagex:=160.0;
imagey:=120.0;
/////////// 确定n_bitmap的宽高/////////////////
proportion:=MaxPixW/MaxPixH;
if proportion>=imagex/imagey then
begin
n_bitmap.Width:=160;
n_bitmap.Height:=round(n_bitmap.Width/proportion);
end
else
begin
n_bitmap.Height:=120;
n_bitmap.Width:=round(n_bitmap.Height*proportion);
end;
tempRect.Left:=0;
tempRect.Right:=n_bitmap.Width;
tempRect.Top:=0;
tempRect.Bottom:=n_bitmap.Height; n_bitmap.Canvas.StretchDraw(tempRect,o_bitmap);
Result:=n_bitmap;
end;
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |