rhazell
rhazell

Reputation: 285

How to control image resolution (size) when using TakePhotoFromCameraAction (FMX.MediaLibrary.Actions) in FireMonkey?

On both Android & iOS, I am successfully using TTakePhotoFromCameraAction in FMX to save photos taken by the user into a TImage.

When using TTakePhotoFromCameraAction, can I control the resolution (ultimately the size in bytes) of the photo that's taken? If so, how?

What is the best way to "post process" the resultant TImage to achieve a reduction in size? I ask this because I may need this functionality anyway if I am to begin using TTakePhotoFromLibraryAction to allow a user to choose an existing photo from their gallery.

I do need a solution that will work with both Android & iOS, please.

I am currently using Delphi 10.4.2 Sydney

Upvotes: 0

Views: 1189

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596176

When using TTakePhotoFromCameraAction, can I control the resolution (ultimately the size in bytes) of the photo that's taken? If so, how?

TTakePhotoFromCameraAction has MaxWidth and MaxHeight properties.

If you use IFMXCameraService.TakePhoto() instead, it has an overload that takes a TParamsPhotoQuery parameter, which has a RequiredResolution field.

What is the best way to "post process" the resultant TImage to achieve a reduction in size? I ask this because I may need this functionality anyway if I am to begin using TTakePhotoFromLibraryAction to allow a user to choose an existing photo from their gallery.

TTakePhotoFromLibraryAction also has MaxWidth and MaxHeight properties.

And IFMXTakenImageService.TakeImageFromLibrary() has an overload that has an ARequiredResolution parameter, and an overload that takes a TParamsPhotoQuery parameter.

Upvotes: 2

Related Questions