function JpegToBmp(mJPEGImage: TJPEGImage; mBitmap: TBitmap): Boolean;
begin
Result := True;
try
mBitmap.Assign(mJPEGImage);
except
Result := False;
end;
end; { JpegToBmp }function BmpToJpeg(mBitmap: TBitmap; mJPEGImage: TJPEGImage;
mCompressionQuality: Integer = 75): Boolean;
//~~~~~~~~~~~~~~~~~~~it's
begin
Result := True;
try
mJPEGImage.Assign(mBitmap);
mJPEGImage.CompressionQuality := mCompressionQuality;
mJPEGImage.Compress;
except
Result := False;
end;
end; { BmpToJpeg }var
vJPEGImage: TJPEGImage;
begin
vJPEGImage := TJPEGImage.Create;
try
TJPEGImage(Image3.Picture).Assign(nil);
BmpToJpeg(Image1.Picture.Bitmap, vJPEGImage, SpinEdit1.Value);
TJPEGImage(Image3.Picture).Assign(vJPEGImage);
finally
vJPEGImage.Free;
end;
end;
begin
Result := True;
try
mBitmap.Assign(mJPEGImage);
except
Result := False;
end;
end; { JpegToBmp }function BmpToJpeg(mBitmap: TBitmap; mJPEGImage: TJPEGImage;
mCompressionQuality: Integer = 75): Boolean;
//~~~~~~~~~~~~~~~~~~~it's
begin
Result := True;
try
mJPEGImage.Assign(mBitmap);
mJPEGImage.CompressionQuality := mCompressionQuality;
mJPEGImage.Compress;
except
Result := False;
end;
end; { BmpToJpeg }var
vJPEGImage: TJPEGImage;
begin
vJPEGImage := TJPEGImage.Create;
try
TJPEGImage(Image3.Picture).Assign(nil);
BmpToJpeg(Image1.Picture.Bitmap, vJPEGImage, SpinEdit1.Value);
TJPEGImage(Image3.Picture).Assign(vJPEGImage);
finally
vJPEGImage.Free;
end;
end;
解决方案 »
- AddIPAddress函数
- RegisterComponents与RegisterNoIcon
- 请问如何让BitBtn读入TImage(或者TPicture)中的图片?
- 用SQL存储大数量数据
- 一个简单的问题
- windowsNT的密码!!??装系统的时候为登录不用密码!!装上以后设置为要密码登录??可是不知道密码!!??
- 请menggirl(看天上浮云,胜似闲庭信步) 兄、 wfangqian(违反器) 兄、alexzhang00(三角猫(sjcatsoft)) 兄
- 我安裝了xpmenu,但只在設計期看到效果,運行時郤沒變...???
- 菜鸟问题:如何把自己添加在Samples上的Component删掉,谢谢!(不是Hide)
- 真的很着急,DATASET向XML转换的问题。
- 主细结构,,,,table_table,query_table 可以配合,怎样把query-query配合呀。
- 在VCL源码中,许多定义使用{}包括进来,这些代码起什么作用?
myjep:tjpegimage;
fullscreen:tbitmap;
fullscreencanvas:tcanvas;
dc:hdc;begin
fullscreen:=tbitmap.Create;
fullscreen.Width:=screen.Width;
fullscreen.Height:=screen.Height;
dc:=getdc(0);
fullscreencanvas:=tcanvas.Create;
fullscreencanvas.Handle:=dc;
fullscreen.Canvas.CopyRect(rect(0,0,screen.width,screen.height),fullscreencanvas,rect(0,0,screen.width,screen.height));
fullscreencanvas.Free;
releasedc(0,dc);
image1.Picture.Bitmap:=fullscreen;
fullscreen.Free;
//save
myjep:=Tjpegimage.create;
myjep.assign(image1.Picture.Bitmap);
myjep.CompressionQuality:=10; //改变数值的地方
myjep.SaveToFile('c:\you.jpg');
myjep.Destroy;
end;这样也可以