//uses Jpeg;
procedure BmpToJpeg(BmpFilePath,JpegFilePath:String);
var Bmp:TBitMap; Jpeg:TJpegImage;
begin
try
Bmp:=TBitMap.Create; Jpeg:=TJpegImage.Create;
Bmp.LoadFromFile(BmpFilePath);
Jpeg.CompressionQuality:=75;
Jpeg.Assign(Bmp);
Jpeg.SaveToFile(JpegFilePath);
finally
Bmp.free; Jpeg.Free;
end;
end; procedure JpegToBmp(JpegFilePath,BmpFilePath:String);
var Bmp:TBitMap; Jpeg:TJpegImage;
begin
try
Bmp:=TBitMap.Create; Jpeg:=TJpegImage.Create;
Jpeg.LoadFromFile(JpegFilePath);
Bmp.Assign(Jpeg);
Bmp.SaveToFile(BmpFilePath);
finally
Bmp.free; Jpeg.Free;
end;
end;
procedure BmpToJpeg(BmpFilePath,JpegFilePath:String);
var Bmp:TBitMap; Jpeg:TJpegImage;
begin
try
Bmp:=TBitMap.Create; Jpeg:=TJpegImage.Create;
Bmp.LoadFromFile(BmpFilePath);
Jpeg.CompressionQuality:=75;
Jpeg.Assign(Bmp);
Jpeg.SaveToFile(JpegFilePath);
finally
Bmp.free; Jpeg.Free;
end;
end; procedure JpegToBmp(JpegFilePath,BmpFilePath:String);
var Bmp:TBitMap; Jpeg:TJpegImage;
begin
try
Bmp:=TBitMap.Create; Jpeg:=TJpegImage.Create;
Jpeg.LoadFromFile(JpegFilePath);
Bmp.Assign(Jpeg);
Bmp.SaveToFile(BmpFilePath);
finally
Bmp.free; Jpeg.Free;
end;
end;
解决方案 »
- delphi中指向结构体的指针
- 看看这个代码
- DELPHI的Indy IdTCPClient控件如何主动接收数据??(急急急!!!!!!!!!!)
- 请问,怎么在TADOQUERY中动态生成一个计算字段?
- 请教请教,怎么响应dbgrid选中一行的事件??
- PChar类型和String类型--------在线等待!!!!
- 怎样把image1获得的图标显示在listview组件内?80
- 我编写的一个VCL控件,我想将它做成一个OCX控件。
- 我说的再详细一点!!!!!!!还是打包的问题!!!!!!
- 急找:有没有ListView里面可以放置Edit和CombomBox的第三方组件。给分一百啊。
- 在 视频文件存储中 进行压缩,怎么加代码?????
- 初学者如何学习 C + +
var
bmp : TImage;
jpg : TJpegImage;
begin
bmp := TImage.Create(nil);
jpg := TJpegImage.Create;
bmp.picture.bitmap.LoadFromFile ( 'c:\picture.bmp' );
jpg.Assign( bmp.picture.bitmap );
// Here you can set the jpg object's properties as compression, size and more
jpg.SaveToFile ( 'c:\picture.jpg' );
jpg.Free;
bmp.Free;
end; jpg to bmpVar
jpeg: TJPEGImage;
bmp: TBitmap;
Begin
jpeg:= TJPEGImage.Create;
try
jpeg.LoadFromFile( filename );
bmp:= TBitmap.Create;
try
bmp.Assign( jpeg );
bmp.SaveTofile( ChangeFileExt( filename, '.BMP' ));
finally
bmp.free
end;
finally
jpeg.free
end;
end;