如何获得jpg和bmp图象的长和宽,从文件中读取,不是从图象框读取

解决方案 »

  1.   

    var
      PicHeight, PicWidth: integerbegin         PicHeight := Image.Picture.Height; {取图片高}
                PicWidth := Image.Picture.Width;   {取宽}
      

  2.   

    interface中要uses Graphics, Jpeg;var
     myBmp: TBitmap;
     myJpg: TJpegImage;
    begin
     myBmp:=TBitmap.Create;
     myJpg:=TJpegImage.Create;
     try
      myBmp.LoadFromFile('D:\My Documents\My Pictures\pig.bmp');
      myJpg.LoadFromFile('D:\My Documents\My Pictures\样品.jpg');
      Memo1.Text:='The Bitmap Width='+IntToStr(myBmp.Width)+', Height='+IntToStr(myBmp.Height);
      Memo1.Lines.Append('The JpegImage Width='+IntToStr(myJpg.Width)+', Height='+IntToStr(myJpg.Height));
     finally
      myBmp.Free;
      myJpg.Free;
     end; //end of try
    end;