//==============================================================================
//转换JPG到BMP格式**************************************************************
//==============================================================================
procedure JPG2BMP(const Source, Target:string);
var JPG: TJpegImage;
BMP: TBitmap;
begin
BMP := TBitmap.Create;
JPG := TJpegImage.Create;
try
JPG.LoadFromFile(Source);
BMP.Assign(JPG);
BMP.SaveToFile(Target);
finally
BMP.free;
JPG.Free;
end;
end;//==============================================================================
//转换BMP到JPG格式**************************************************************
//==============================================================================
procedure BMP2JPG(const Source, Target:string; const Scale: Byte);
var Image: TImage;
JPG: TJpegImage;
begin
Image := TImage.Create(Application);
JPG := TJpegImage.Create;
try
Image.Picture.Bitmap.LoadFromFile(Source);
JPG.Assign(Image.Picture.Bitmap);
JPG.CompressionQuality := Scale;
JPG.Compress;
JPG.SaveToFile(Target);
finally
Image.free;
JPG.Free;
end;
end;
//转换JPG到BMP格式**************************************************************
//==============================================================================
procedure JPG2BMP(const Source, Target:string);
var JPG: TJpegImage;
BMP: TBitmap;
begin
BMP := TBitmap.Create;
JPG := TJpegImage.Create;
try
JPG.LoadFromFile(Source);
BMP.Assign(JPG);
BMP.SaveToFile(Target);
finally
BMP.free;
JPG.Free;
end;
end;//==============================================================================
//转换BMP到JPG格式**************************************************************
//==============================================================================
procedure BMP2JPG(const Source, Target:string; const Scale: Byte);
var Image: TImage;
JPG: TJpegImage;
begin
Image := TImage.Create(Application);
JPG := TJpegImage.Create;
try
Image.Picture.Bitmap.LoadFromFile(Source);
JPG.Assign(Image.Picture.Bitmap);
JPG.CompressionQuality := Scale;
JPG.Compress;
JPG.SaveToFile(Target);
finally
Image.free;
JPG.Free;
end;
end;
装的时候,不要全部都选上,看看说明!
其中有4种语言包。
我建议你其他3语言的包别装,只能4选1的!
GraphicStringsRU.pas,GraphicStringsDE.pas,GraphicStringsFR.pas
好象分别是俄语,德语,法语的支持包(我是这样理解的)
Good luck!!!
我稍微改了一下quark的代码,可以转换各种格式到jpg。
procedure Image2JPG(const Source, Target:string; const Scale: Byte);
var Image: TImage;
JPG: TJpegImage;
GraphicClass: TGraphicExGraphicClass;
Graphic: TGraphic;
begin
Image := TImage.Create(Application);
JPG := TJpegImage.Create;
try
GraphicClass := FileFormatList.GraphicFromContent(Source);
if GraphicClass = nil then
Image.Picture.LoadFromFile(Source)
else
begin
Graphic := GraphicClass.Create;
Graphic.LoadFromFile(Source);
Image.Picture.Graphic := Graphic;
end; JPG.Assign(Image.Picture.Graphic);
JPG.CompressionQuality := Scale;
JPG.Compress;
JPG.SaveToFile(Target);
finally
Image.free;
JPG.Free;
end;
end;