Save a Picture as an HEIC file

In my app I save images captured by the camera as JPEG using the Picture.Save method. This takes a Picture.Formats enum with values for BMP, GIF, JPEG, PNG and TIFF. As my images are photos of things and the web service that I upload these images to has always accepted JPEG images, I use Picture.JPEG for the format parameter.

The web service has recently been updated to also support HEIC format images, but there’s no enum for .HEIC in Picture.Formats. Is there a way to save HEIC files based on a Picture?

Technically you could use CGImageDestinationMBS class to export to HEIC format.

Thanks @Christian_Schmitz but while CGImageDestinationMBS seems to be available for iOS, some of the CGImageMBS methods seem not to be available. Specifically, I can’t call CGImageMBS.CreateImage(pic As Picture) to get a CGImageMBS from a Xojo Picture.

Looking through the available methods, it looks as though I need to use the shared method CGImageMBS.CreateImageWithFile to get a CGImageMBS from an existing Xojo Picture saved to a JPEG file which sort of defeats the purpose.

What I’m trying to do is take a Xojo Picture and save that as an HEIC file rather than converting it to JPEG and potentially losing some quality in that process. Is there a way to do this with MBS?