ImageEn, unit iexHelperFunctions

GetImageDetails

GetImageDetails


Declaration


function GetImageDetails(const Filename: string;
                         out iWidth: Integer;
                         out iHeight: Integer;
                         out iBitsPerPixel: Integer
                         ): Boolean; overload;
function GetImageDetails(const Filename: string): TPoint; overload;



Description


Return the size and color depth of an image. Result is false if a load error occurs.
The second overload only returns only the width and height (which will be -1,-1 if a load error is encountered).

Note: Color depth is TImageEnIO.Params.BitsPerSample * TImageEnIO.Params.SamplesPerPixel.

See also: BitsPerPixelToStr


Example


if GetImageDetails('D:\MyImage.jpeg', iWidth, iHeight, iBitsPerPixel) then
begin
  lblWidth.Caption := IntToStr(iWidth);
  lblHeight.Caption := IntToStr(iHeight);
  lblColorDepth.Caption := BitsPerPixelToStr(iBitsPerPixel);
end;