裁减图片

      语言类学习笔记 2008-5-26 13:31
procedure TForm1.Cut(sf:string);
var
  jpg: TJPEGImage;
  Bmp: TBitmap;
begin
  jpg := TJPEGImage.Create;
  Bmp := TBitmap.Create;
  try
    jpg.LoadFromFile(sf);
    self.Image1.Picture.LoadFromFile(sf);
    Bmp.Assign(jpg);
    bmp.Canvas.CopyRect(rect(0,0,jpg.width,jpg.Height),bmp.Canvas,rect(0,0,jpg.Width,jpg.Height-30));
    if SavePictureDialog1.Execute then
    begin
      jpg.SaveToFile(self.SavePictureDialog1.FileName);
      self.Image2.Picture.LoadFromFile(self.SavePictureDialog1.FileName);
    end; 
    //Image2.Canvas.CopyRect(Rect(0,0,Image1.Width,Image1.Height),Bmp.Canvas,Rect(0,0,Image1.Width,Image1.Height-30));
  finally
    jpg.Free;
    Bmp.Free;
  end;
end;
标签集:TAGS:裁减图片 裁减 图片
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}