From: Jens Gruschel Subject: Re: Loading Images From Stream Date: 07 Sep 1999 00:00:00 GMT Message-ID: <37D547A5.687DA229@pegtop.de> Content-Transfer-Encoding: 7bit References: <7r3c3o$t6513@forums.borland.com> X-Accept-Language: de Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.delphi.graphics Hi Petr! Try something like this to write your images to a BIG file: (instead of JPGs you can use Bitmaps, too, just replace JPegImage with Bitmap) Var TempJPegImage: TJPegImage; TempFileStream: TFileStream; TempFileStream := TFileStream.Create(FileName,fmCreate OR fmShareDenyWrite); Try TempJPegImage := TJPegImage.Create; Try TempJPegImage.LoadFromFile (ImageName); TempJPegImage.SaveToStream (TempFileStream); Finally TempJPEGImage.Free; End; Finally TempFileStream.Free; End; And to load them again: TempFileStream := TFileStream.Create(Globals.SLIFileName,fmOpenRead OR fmShareDenyWrite); Try TempJPegImage := TJPegImage.Create; Try TempJPegImage.LoadFromStream (TempFileStream); Whereever.Canvas.Draw (0,0,TempJPegImage); Finally TempJPegImage.Free; End; Finally TempFileStream.Free; End; If you have more than one image stored in your BIG file (I guess you have), a file position table might help. All you need is an array (if you don't know how many images there are better solutions than this one) like this: Var ImageTable: Array[0..99] of LongInt; before you save the the first image to the stream: TempFileStream.Position := NumberOfImages*SizeOf(LongInt); before you save a single image to the stream: ImageTable[i] := TempFileStream.Position; before you close the stream: TempFileStream.Position := 0; TempFileStream.Write (ImageTable,NumberOfImages*SizeOf(LongInt)); for reading the images again, first read the table (once in FormCreate?) and set the Position of the Stram. Hope this helps... Jens