thanks, i did that and it works.
http://atlas.walagata.com/w/peterbon...veToStream.zip
I wrote 2 procedures to save and load a jpeg to a stream properly.

[pascal]// save a jpeg to a memory stream with correct positioning
procedure JPegSaveToStream(AJPG : TJPegImage ; AStream : TMemoryStream);
Var
LStart, LEnd : Int64;
begin
// store current stream position
LStart := AStream.Position;
// skip size of stream position
AStream.Seek(8, LStart);
// write the jpeg
AJPG.SaveToStream(AStream);
// store the new position
LEnd := AStream.Position;
// seek back to start position
AStream.Position := LStart;
// write jpeg end position to correct position when loading
AStream.Write(LEnd, ;
// seek back to end of stream
AStream.Position := LEnd;
end;

// load a jpeg from a memory stream with correct positioning
procedure JPegLoadFromStream(AJPG : TJPegImage ; AStream : TMemoryStream);
Var
LEnd : Int64;
begin
// load the jpeg end position
AStream.Read(LEnd, ;
// load the jpeg
AJPG.LoadFromStream(AStream);
// go to the correct end position
AStream.Position := LEnd;
end;[/pascal]

seems messy though - I wish I knew why it gets the position wrong.

Peter