LoginSignup
1
1

More than 5 years have passed since last update.

カメラロールにビットマップを保存する

Posted at

概要

TBitmap のインスタンスをカメラロールに保存したい!

実装

超簡単!

IFMXPhotoLibraryインターフェースを TPlatformServices から取り出して、AddImageToSavedPhotosAlbum を呼べば完了!

uses
  FMX.Platform, FMX.MediaLibrary;

procedure SaveToCameraRoll(const iBmp: TBitmap);
var
  PhotoLib: IFMXPhotoLibrary;
begin
  if
    TPlatformServices.Current.SupportsPlatformService(
      IFMXPhotoLibrary,
      PhotoLib)
  then
    PhotoLib.AddImageToSavedPhotosAlbum(iBmp);
end;

おまけ

この IFMXPhotoLibrary は Android でも定義されていて、適切な場所に保存してくれます!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1