Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
Delphi 2006 Professional
|
Re: Header einer Bitmap ändern / hinzufügen
21. Apr 2007, 14:12
Hallo,
so könnts gehen:
Delphi-Quellcode:
const
headerstring = 'this bitmap is property of tumm';
procedure EncodeFile(FName: string);
var
msin, msout: TMemoryStream;
begin
msin := TMemoryStream.Create;
msin.LoadFromFile(FName);
msin.Position := 0;
msout := TMemoryStream.Create;
msout.Write(headerstring, length(headerstring));
msout.CopyFrom(msin,msin.Size);
msout.SaveToFile(FName);
msin.Free;
msout.Free;
end;
function GetDecodedFile(FName: string): TMemoryStream;
var
mstmp: TMemoryStream;
begin
mstmp := TMemoryStream.Create;
mstmp.LoadFromFile(FName);
mstmp.Position := length(headerstring);
Result := TMemoryStream.Create;
Result.CopyFrom(mstmp, mstmp.Size-mstmp.Position);
mstmp.Free;
end;
Informier dich am Besten über die TStream-Descendants.
Lukas Erlacher Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1
|
|
Zitat
|