Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Convertir TGraphic a TJPEGImage (https://www.clubdelphi.com/foros/showthread.php?t=80810)

courtois 30-06-2007 09:06:21

Convertir TGraphic a TJPEGImage
 
Convierte casi cualquier decendiente de TGraphic en un TJPEGImage
g puede ser un TBitMap, un TGifImage,un TMetafile, etc
Código Delphi [-]
function ToJPG(g: TGraphic): TJPEGImage;
var BMP: TBitmap;
begin
  try
    BMP:=TBitmap.Create;
    BMP:=ToBMP(g);//de nuevo el truco de TGraphic a TBitMap :)
    Result:=TJPEGImage.Create;
    Result.Assign(BMP);
    Result.CompressionQuality:=90;//puede ser entre 1 y 100
    Result.Compress; //comprimimos
  except
    Result:=nil;
  end;
end;


La franja horaria es GMT +2. Ahora son las 00:23:57.

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