Declaration
function FindStreamFormat(Stream: TStream): TIOFileType;
Description
Returns the format of the file found in a stream by reading the file header.
Some formats
cannot be detected by content alone. Sony ARW and Kodak DCR are TIFF internally so will return as ioTIFF. WBMP and Implicit Dicom will return as ioUnknown.
Stream1.Position := 0;
if FindStreamFormat( Stream1 ) = ioBMP then
ShowMessage( 'It is a bitmap' );