首页 > 解决方案 > Delphi Android 应用程序为我提供了图库中图像的副本。我如何获得原件?

问题描述

试图从图库中获取图像 - 它工作正常,但我得到了重新压缩的副本。

我正在使用以下简单代码从 Android 上的图库中获取图像:

procedure TakePhotoFromGallery;
begin
  FParams.RequiredResolution := TSize.Create(MaxInt, MaxInt);
  // FParams.RequiredResolution := TSize.Create(3000, 4000); specifiying original dimensions does not help
  FParams.Editable := False; // Don't ask user to edit the photo after selecting it
  FParams.NeedSaveToAlbum := False; // Seems to have no effect

  if TPlatformServices.Current.SupportsPlatformService(IFMXTakenImageService, FGalleryService) then
    FGalleryService.TakeImageFromLibrary(nil, FParams);
end;

我订阅TMessageReceivedImagePath并收到这样的图像:

procedure TMyObject.ReceivedImagePath(const Sender: TObject; const M: TMessage);
begin
  if M is TMessageReceivedImagePath then
    Log.d('ReceivedImagePath ' + TMessageReceivedImagePath(M).Value);
end;

一切正常,但有一个问题。出于某种原因,我从缺少 EXIF 的图库中获取了图像的副本。原始图像是 3000x400px 2.5mb,我得到 3000x4000px 3.45mb。我需要原件来读取它的 EXIF 数据。

我如何获得原始图像?

标签: androiddelphigallerydelphi-10.3-rio

解决方案


推荐阅读