Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   imagenes tif (https://www.clubdelphi.com/foros/showthread.php?t=63089)

thelibmx 29-01-2009 01:19:25

imagenes tif
 
Hola compañeros, he estado buscando en el club sobre como mostrar imagenes tif y no encontre nada, tal ves no hize la busqueda bien, en fin, ocupe otro codigo y una funcion que encontre para poder vizualizar las imagenes tif, pero tengo un problema, adapte la funcion como venia y me deja ver las imagenes tif en el timage, pero manejo mas de 1000 imagenes, entonces llega un punto en el que me sale el siguiente mensaje

Código Delphi [-]
raise Exception.Create('Unable to create TBitmap buffer');

esto tiene su origen en esta parte de codigo

Código Delphi [-]

function ReadTiffIntoBitmap(Filename: String): TBitmap;
var
  OpenTiff: PTIFF;
  FirstPageWidth,FirstPageHeight: Cardinal;
  FirstPageBitmap: TBitmap;
begin
  OpenTiff:=TIFFOpen(Filename,'r');
  if OpenTiff=nil then raise Exception.Create(
           'No se puede abrir el archivo '''+Filename+'''');
  TIFFGetField(OpenTiff,TIFFTAG_IMAGEWIDTH,@FirstPageWidth);
  TIFFGetField(OpenTiff,TIFFTAG_IMAGELENGTH,@FirstPageHeight);
  FirstPageBitmap:=nil;
  try
    FirstPageBitmap:=TBitmap.Create;
    FirstPageBitmap.PixelFormat:=pf32bit;
    FirstPageBitmap.Width:=FirstPageWidth;
    FirstPageBitmap.Height:=FirstPageHeight;
  except
    if FirstPageBitmap<>nil then FirstPageBitmap.Destroy;
    TIFFClose(OpenTiff);
    raise Exception.Create('Unable to create TBitmap buffer');
  end;
  TIFFReadRGBAImage(OpenTiff,FirstPageWidth,FirstPageHeight,
               FirstPageBitmap.Scanline[FirstPageHeight-1],0);
  TIFFClose(OpenTiff);
  TIFFReadRGBAImageSwapRB(FirstPageWidth,FirstPageheight,
               FirstPageBitmap.Scanline[FirstPageHeight-1]);
  Result:=FirstPageBitmap;
end;
y la imagen la mando llamar con esto
Código Delphi [-]
Image1.Picture.Bitmap.Assign(ReadTiffIntoBitmap(ubicacion));


no entiendo que es lo que hace que salga ese mensaje, podrian darme una pista de que podria ser y como podria solucionarse,se que es tal ves algo con la memoria pero todavia no ubico bien, o si conocen alguna manera de ver las imagenes tif con componentes que tenga delphi les estare agradecido.

uso delphi2006

Les agradezco su atencion y todos los tips que me puedan dar :)


La franja horaria es GMT +2. Ahora son las 05:56:02.

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