procedure GetBitmapInfo(Filename: string; var Info: BITMAPINFOHEADER);
begin
FillChar(Info,Sizeof(Info),0);
with TFileStream.Create(Filename,fmOpenRead,fmShareDenyWrite) do
try
Seek(Sizeof(BITMAPFILEHEADER),soFromBeginning);
ReadBuffer(Info,Sizeof(Info));
finally
Free;
end;
end;
var
Info: BITMAPINFOHEADER;
Str: string;
begin
GetBitmapInfo('d:\temp\01.bmp',Info);
Str:=
'Ancho = ' + IntToStr(Info.biWidth) + #13 +
'Alto = ' + IntToStr(Info.biHeight) + #13 +
'Profundidad en bits = ' + IntToStr(Info.biBitCount) + #13 +
'Resolucion horizontal = ' + IntToStr((Info.biXPelsPerMeter * 254) div 10000) + #13 +
'Resolucion vertical = ' + IntToStr((Info.biYPelsPerMeter * 254) div 10000) + #13;
case Info.biCompression of
BI_RGB: Str:= Str + 'Compresion = Sin comprimir';
BI_RLE8: Str:= Str + 'Compresion = RL8';
BI_RLE4: Str:= Str + 'Compresion = RLE4';
BI_BITFIELDS: Str:= Str + 'Compresion = BITFIELDS';
end;
ShowMessage(Str);
end;