ImageEn, unit iexBitmaps

TIEFindFormatMethod


Declaration

type TIEFindFormatMethod = (ffContentOnly, ffVerifyByExtension, ffFallbackToExtension);


Description

Methods used by FindFileFormat to determine the type of an image:
Value Description
ffContentOnly Only the content of the file is examined. The filename is ignored (No extension checking)
ffVerifyByExtension The content is examined to determine the type. This is then compared to the file extension and ioUnknown is returned if the type does not match (Strict extension checking)
ffFallbackToExtension The content is examined to determine the type. If it cannot be determined (which can happen with some Dicom and Raw formats), then the type is guessed by the file extension (Optimistic extension checking)


Example

// Determine the file type only by examining the file header/content
if FindFileFormat( sFilename, ffContentOnly ) = ioJPEG then
  ShowMessage( 'File content is JPEG' );

// Determine the file type by examining the file header/content, check it has the correct file extension
if FindFileFormat( sFilename, ffVerifyByExtension ) = ioJPEG then
  ShowMessage( 'File content is JPEG and it has a JPEG extension' );

// Determine the file type by examining the file header/content. If that fails use the correct file extension
if FindFileFormat( sFilename, ffFallbackToExtension ) = ioDICOM then
  ShowMessage( 'File appears to be a DICOM' );