begin bmp:=TBitmap.Create; jpeg:=TJPEGImage.Create; jpeg.LoadFromFile(fname); with bmp do begin PixelFormat:=pf24bit; Height:=60; Width:=self.RzListBox.Width; Canvas.Brush.Color:=$00F0EDE6; Canvas.FillRect(Canvas.ClipRect); Canvas.StretchDraw(Bounds(0,0,80,60), jpeg); end; //这里你可以用save之类的方法了 bmp.Free; jpeg.Free;
--------------------------------------------------------
--convert JPEG to BMP
uses JPEG;
procedure JPEGt*****P(const FileName: TFileName); var jpeg: TJPEGImage; bmp: TBitmap; begin jpeg := TJPEGImage.Create; try jpeg.CompressionQuality := 100; {Default Value} jpeg.LoadFromFile(FileName); bmp := TBitmap.Create; try bmp.Assign(jpeg); bmp.SaveTofile(ChangeFileExt(FileName, '.bmp')); finally bmp.Free end; finally jpeg.Free end; end;
--------------------------------------------------------
--有一个TGIFImage组件
function GifT*****p(filename: string): TBitmap; var GIF: TGIFImage; begin GIF := TGIFImage.Create; try GIF.LoadFromFile(filename); Result := TBitmap.Create; Result.Assign(GIF.Bitmap); finally GIF.Free; end; end;
http://blog.csdn.net/yanjiaye520/article/details/6676323
|
请发表评论