AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Bitmap zu Icon ohne Farbe Verlust ?

Ein Thema von Praxist · begonnen am 23. Aug 2008 · letzter Beitrag vom 23. Aug 2008
Antwort Antwort
Praxist

Registriert seit: 6. Jul 2008
39 Beiträge
 
Delphi 7 Professional
 
#1

Bitmap zu Icon ohne Farbe Verlust ?

  Alt 23. Aug 2008, 11:21
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
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#2

Re: Bitmap zu Icon ohne Farbe Verlust ?

  Alt 23. Aug 2008, 13:20
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;
Angehängte Dateien
Dateityp: zip icon2file_133.zip (19,7 KB, 52x aufgerufen)
Thomas
  Mit Zitat antworten Zitat
Praxist

Registriert seit: 6. Jul 2008
39 Beiträge
 
Delphi 7 Professional
 
#3

Re: Bitmap zu Icon ohne Farbe Verlust ?

  Alt 23. Aug 2008, 13:40
Ich habe auch die Hilfe im Anhang gelesen : )

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

Danke
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:52 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