ramdev
ramdev

Reputation: 191

Convert image to HEIC/HEIF in Xamarin iOS

I am working on a Xamarin Form Project where we need to Take a photo or upload a photo in the app and compress the photo and convert it to HEIC/HEIF before uploading to the server. We used Plugin.Media.CrossMedia before but that library is converting image to Jpg after taking photo/upload from gallery. And we also use cross media to compress the image. Is there a way in Xamarin to convert image to HEIC/HEIF and compress the image?

Upvotes: 0

Views: 222

Answers (1)

Zack
Zack

Reputation: 1609

For in-program photo upload, you can use Renderer to customize ContentPage, refer to the sample of the official documentation (it should be noted that AVCaptureStillImageOutput class is deprecated), you can use Apple's AVCapturePhotoOutput class to capture a photo, use the AVCapturePhotoSettings class to change the data format of the photo to HEIF/HEVC format, and then save the image for upload. (Video captured on the iPhone 8, iPhone 8 Plus, and iPhone X running iOS 11 or later uses the HEVC codec by default). For more details, please refer to Apple's official documentation:Capturing Still and Live Photos|Apple Developer

Upvotes: 0

Related Questions