Encoding HEIF images on macOS 10.13

Hi!

I am trying to encode CGImages as HEIC/HEIF images on macOS 10.13. I am aware that this is only be possible if the Mac brings a hardware HEVC/HEIC/HEIF encoder, otherwise it will fail. I am using a 2016 MacBook Pro for testing which supports HEVC hardware encode and should support encoding HEIC/HEIF images just fine.


Using macOS 10.13 developer beta 9, this line does not return a valid image destination (NULL):


CGImageDestinationRef destRef = CGImageDestinationCreateWithData((CFMutableDataRef) data, (CFStringRef)AVFileTypeHEIC, 1, NULL);


It fails with this message in the console:


findWriterForType:140: unsupported file format 'public.heic'


Reading .heic images using CoreGraphics works correctly.


Am I missing something? Thanks in advance!

Replies

IIRC HEIF encoding isn't supported at all on macOS yet. 😟

I can not test easily the 10.13.4 beta. Does someboby know if Image IO (CGImageDestinationRef) can export to HEIF (without the need to use the CIContext new API) ?

Thank you in advance,

Romain.