Ver Mensaje Individual
  #2  
Antiguo 21-09-2006
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 24
seoane Va por buen camino
Para leer la cabecera de los archivos bmp puedes usar algo como esto:

Código Delphi [-]
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;

// Un ejemplo de como usar la función anterior
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;
Responder Con Cita