Get metadata from image file

hello,
I’m trying to get metadata dictionary from an image file
I need help to convert NSURL to CFURLRef
and CFDictionaryRef to NSDictionary to Applescript’s Dictionary

thanks

here is the code

use AppleScript version “2.4”
use framework “Foundation”
use framework “CoreImage”
use scripting additions

set thePath to POSIX path of (path to desktop) & “test.HEIC”
set theURL to current application’s |NSURL|'s fileURLWithPath:thePath
–convert NSURL to CFURLRef
set theImage to current application’s CGImageSourceCreateWithURL(theURL, null)
set theDictionary to current application’s CGImageSourceCopyPropertiesAtIndex(theImage, 0, null)
–convert CFDictionaryRef to NSDictionary to Applescript’s Dictionary

@vaccarolim
as pointed out by Fredrik71, you can’t bridge ‘CF’ Core Foundation types to AppleScriptObjC data types.
So you better off using the ‘CIImage’ class, found in the ‘CoreImage’ framework.
Something like this.

use scripting additions
use framework "Foundation"
use framework "CoreImage"

property myApp : a reference to current application

set imageFilePath to POSIX path of (path to desktop) & "Test.heic"
set imageFileURL to myApp's NSURL's fileURLWithPath:imageFilePath
set coreImage to myApp's CIImage's imageWithContentsOfURL:imageFileURL
set coreImageProperties to coreImage's |properties|() as list

Regards Mark

it works perfectly!
thank you very much