怎样判断图片是16*16还是32*32的?

解决方案 »

  1.   

    var
      bmp: TbitMap;
    begin
      bmp := TBitMap.Create;
      try
        bmp.LoadFromFile('c:\a.bmp');
        if (bmp.Width = 16) and (bmp.Height = 16) then
        begin    end
        else
          if (bmp.Width = 32) and (bmp.Height = 32) then
          begin      end;
      finally
        bmp.Free;
      end;
    end;
      

  2.   

    Image控件使用了TBitmap类。这个类的可以得到图片的Width,Height
    TImage.Picture.Bitmap.Width
    TImage.Picture.Bitmap.Height
      

  3.   

    TImage.Picture.Bitmap.Width
    TImage.Picture.Bitmap.Height这个才是得到图片实际的宽高
    bmp.Width bmp.Height这个是控件的宽高
    两个是不同的哈
      

  4.   

    看楼上那些的,也可以读bmp的文件头