FMX.Graphics.TBitmap.LoadFromFile

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure LoadFromFile(const AFileName: string);

C++

void __fastcall LoadFromFile(const System::UnicodeString AFileName);

Properties

Type Visibility Source Unit Parent
procedure
function
public
FMX.Graphics.pas
FMX.Graphics.hpp
FMX.Graphics TBitmap

Description

Loads from a file the image content of the current TBitmap object.

It replaces any existing image. The object is resized to match the image.

Note: The loaded image's visible size can be affected if the TBitmap is contained in other components, like TImage or TImageControl.

The AFileName parameter specifies the image file to be loaded.

TBitmap remains unchanged if:

  • AFileName is not found.
  • AFileName cannot be opened because it is used (exclusively) by something else.
  • AFileName has an unsupported image format or is not actually an image.

LoadFromFile does not raise any errors in these cases.

The optional Rotate parameter specifies the degrees to rotate the image upon loading, counter-clockwise. For example, 180 rotates, not mirror-flips, the image upside down. The object is resized to the smallest rectangle that can display the entire rotated image.

Note: For a list of formats supported by each platform, see TBitmapCodecManager.

See Also