Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Gráficos (https://www.clubdelphi.com/foros/forumdisplay.php?f=8)
-   -   gif a string o cargar bitmap (https://www.clubdelphi.com/foros/showthread.php?t=33420)

ivan022481 06-07-2006 06:56:38

gif a string o cargar bitmap
 
Hola, desde y gracias por leer este hilo y mas gracias si encuentran una solucion.
El problema es el siguiente: necesito convertir un GIF a texto, les explico, tengo un GIF que tiene como imagen un numero, necesito leer ese GIF y pasarlo a string o RTF para poder leerlo, e encontrado una posible solucion, pero es leyendo un bitmap en lugar de un gif:

Código Delphi [-]
function BitmapaTxt(pict: TBitmap): string;
var
  bi, bb, rtf: string;
  bis, bbs: Cardinal;
  achar: ShortString;
  hexpict: string;
  I: Integer;
begin
  GetDIBSizes(pict.Handle, bis, bbs);
  SetLength(bi, bis);
  SetLength(bb, bbs);
  GetDIB(pict.Handle, pict.Palette, PChar(bi)^, PChar(bb)^);
  rtf := '{\rtf1 {\pict\dibitmap0 ';
  SetLength(hexpict, (Length(bb) + Length(bi)) * 2);
  I := 2;
  for bis := 1 to Length(bi) do
  begin
    achar := IntToHex(Integer(bi[bis]), 2);
    hexpict[I - 1] := achar[1];
    hexpict[i] := achar[2];
    Inc(I, 2);
  end;
  for bbs := 1 to Length(bb) do
  begin
    achar := IntToHex(Integer(bb[bbs]), 2);
    hexpict[I - 1] := achar[1];
    hexpict[i] := achar[2];
    Inc(I, 2);
  end;
  rtf := rtf + hexpict + ' }}';
  Result := rtf;
end;


Hasta el momento convierto la imagen a .bmp, la cargo en un tBitMap, pero da error, me dice "bitmap image is not valid", reviso el archivo y es un .bmp, la solucion adecuada seria poder ver los caracteres del .gif convertirlos a string o rtf, si no, saber porque no puedo cargar el .bmp en el TBitMap. desde ya muchas gracias.


La franja horaria es GMT +2. Ahora son las 12:43:43.

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