Image format png

yvessimon Messages postés 637 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 9 janvier 2017 - 18 juil. 2008 à 12:08
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 - 18 juil. 2008 à 16:42
Bonjour,

Comment transferer une image *.png dans une image *.bmp ?

Merci
Salutations

1 réponse

f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
18 juil. 2008 à 16:42
pnglib tout simplement ...

uses pngimage;

var
  BMP : TBitmap;
  PNG : TPNGObject;
begin
  PNG := TPNGObject.Create;
  try
    PNG.LoadFromFile( ... );
    BMP := TBitmap.Create;
    try
   
      BMP.Assign(PNG);
      { ou }
      BMP.Width := PNG.Width;
      BMP.Height := PNG.Height;
      BMP.PixelFormat := pf24bit;
      BMP.Canvas.Draw(0,0,PNG);
 
      BMP.SaveToFile( ... );
    finally
      BMP.Free;
    end;
  finally
    PNG.Free;
  end;
end;

<hr size="2" width="100%" />
0
Rejoignez-nous