Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Bitmap zu Icon ohne Farbe Verlust ? (https://www.delphipraxis.net/119265-bitmap-zu-icon-ohne-farbe-verlust.html)

Praxist 23. Aug 2008 11:21


Bitmap zu Icon ohne Farbe Verlust ?
 
hallo

ich habe mehrere Funktionen getestet um ein Bitmap in Icon zu konvertieren
das Problem ist nach dem Konvertieren bekomme ich eine ein Icon mit schlechter Qualität

Beispiel mit dieser Funktion : http://www.swissdelphicenter.ch/de/showcode.php?id=913

Ich suche eine Funktion, die ein gutes Icon erstellt ohne oder mit weniger Farben Verlust aber auch soll ein valid Icon erstellen

toms 23. Aug 2008 13:20

Re: Bitmap zu Icon ohne Farbe Verlust ?
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,

So wird die Qualität besser:

Delphi-Quellcode:
uses
  IconsToFile; {Siehe Anhang icon2file.zip}

function Bmp2Ico(Bitmap: TBitmap; IcoFileName: TFilename): Boolean;
var
  Icon: TIcon;
  ImageList: TImageList;
begin
  Result := False;
  ImageList := TImageList.CreateSize(Bitmap.Width, Bitmap.Height);
  try
    ImageList.AllocBy := 1;
    ImageList.AddMasked(Bitmap, Bitmap.TransparentColor);
    Icon := TIcon.Create;
    try
      ImageList.GetIcon(0, Icon);
      Result := hicontofile(IcoFileName, Icon.Handle, BitC24) <> -1;
     // Icon.SaveToFile(IcoFileName);
    finally
      Icon.Free;
    end;
  finally
    ImageList.Free;
  end;
end;
// Beispiel:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
  Bmp2Ico(Image1.Picture.Bitmap, 'c:\Output.ico');
end;

Praxist 23. Aug 2008 13:40

Re: Bitmap zu Icon ohne Farbe Verlust ?
 
Ich habe auch die Hilfe im Anhang gelesen : )

jetzt weiß ich warum mein icon nach dem Speichern schlecht wird :thumb:

Danke


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:21 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz