[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TRasterImage.LoadFromStream

LoadFromStream - loads data for the image from a specified data stream, optionally supplying its size.

## Declaration

Source position: graphics.pp line 1316

`public procedure TRasterImage.LoadFromStream(`
`AStream: TStream`
`); override; overload; procedure TRasterImage.LoadFromStream(`
`AStream: TStream;`
`ASize: Cardinal`
`); virtual; overload;`

## Arguments

`AStream` |  | Stream with the image data loaded in the method.

## Arguments

`AStream` |  | Stream with the image data loaded in the method.
`ASize` |  | Number of byte to read from the stream.

## Description

LoadFromStream is an overloaded method in TRasterImage used to load image data from the TStream instance specified in AStream.

One of the overloaded variants provides an ASize argument which contains the number of bytes to read from the stream. When the ASize argument is omitted, the remaining content in the stream is read starting at the current position in the stream.

LoadFromStream calls BeginUpdate to increment the internal update counter in the class instance. EndUpdate is called when the stream has been processed in the method.

LoadFromStream discards an existing shared image and its save stream, and clears existing handles and raw image data in the class instance. No additional actions are performed in the method when ASize is 0 (zero).

LoadFromStream re-creates the save stream for the shared image and copies the content in AStream to the save stream. The ReadStream method is called to load the image data for the class instance.

## See also

TRasterImage.BeginUpdate |  | BeginUpdate - start the update process.
TRasterImage.EndUpdate |  | EndUpdate - finishes the update process.
TRasterImage.Clear |  | Removes raw image data and frees the internal save stream.
TRasterImage.ReadStream |  | ReadStream - loads image data into the raw image.