« Under the Radar Podca… | Home | Windows DLL Loading e… »

Read HEIC or HEIF image files in FileMaker

If you need to read HEIF or HEIC image files (High Efficiency Image File Format) in FileMaker on Mac or iOS, please check our Container.ReadImage function in MBS FileMaker Plugin:

Set Variable [ $path ; Value: "/Users/cs/Desktop/IMG_3552.HEIC" ] 

Set Variable [ $container ; Value: MBS( "Container.ReadFile"; $path) ] 

If [ MBS("IsError") = 0 ] 

Set Variable [ $image ; Value: MBS( "Container.ReadImage"; $container; "PNG"; "image.png") ] 

If [ MBS("IsError") = 0 ] 

Set Field [ Untitled::image ; $image ] 

End If

End If

So we may need to import the file into a container value first, if you haven't it in a container field already. Second, we use Container.ReadImage to read the image and convert it to a PNG file. PNG supports transparency and has lossless compression, so we prefer it over JPEG.

Alternatively you can use CGImageSource functions and get the images and any metadata like this:

Set Variable [ $path ; Value: "/Users/cs/Desktop/IMG_3552.HEIC" ] 

Set Variable [ $ImageSource ; Value: MBS( "CGImageSource.CreateWithPath"; $path) ] 

If [ MBS("IsError") = 0 ] 

# you can get metadata as JSON to check later...

Set Variable [ $$MetaData ; Value: MBS( "CGImageSource.Properties"; $ImageSource ) ] 

Set Variable [ $$ImageMetaData ; Value: MBS( "CGImageSource.Properties"; $ImageSource; 0 ) ] 

# get image to show

Set Variable [ $image ; Value: MBS( "CGImageSource.ImageAtIndex"; $ImageSource; 0; "PNG"; "image.png") ] 

If [ MBS("IsError") = 0 ] 

Set Field [ Untitled::image ; $image ] 

End If

Set Variable [ $r ; Value: MBS( "CGImageSource.Release"; $ImageSource ) ] 

End If

 

 

Please do not hesitate to contact us with questions.

Claris FileMaker Plugin
20 08 19 - 09:30