Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   Informacion sobre bitmap (https://www.clubdelphi.com/foros/showthread.php?t=35802)

RedVenom 21-09-2006 06:34:12

Informacion sobre bitmap
 
estoy haciendo un proyectito para una clase pero nunca he trabajado con imagenes en delphi me gustaria saber como puedo hacer para obtener toda la informacion de la cabezera de una imagen bmp y mostrarla al usuario. Nose como extraerla de la imagen bmp.
De antemano les agradezco su ayuda.

seoane 21-09-2006 14:23:31

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;


La franja horaria es GMT +2. Ahora son las 02:16:21.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi