I'm using this code (Writing image metadata (EXIF/TIFF/IPTC) to image file in OS X) to read EXIF/TIFF/IPTC data from image files. It's working great, but I would also need to copy the clipping path over. It's saved to a non standard index called "Photoshop" (just like the Others are called Iptc and similar).
I can't figure out how to access this information to copy it over to a newly created NSImage. The method in the link does not seem to access any non-standard informations. Any help appreciated. Thanks
EDIT ----
Here is a sample image: http://www.mad-sharky.com/clipping_path.jpg
This one contains a clipping path, it can be verified usign this tool: http://regex.info/exif.cgi you can see the "Photoshop" section. That part contains all the data I am missing with the code I am using. (Code is the same as the link above)
I only have an old .psd file which does not have a clipping path. But does have layers.
This quick bit of example code uses the Photoshop image properties. kCGImageProperty8BIMDictionary
NSURL *imageFileURL = [NSURL fileURLWithPath:@"/users/username/foo.psd"];
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((__bridge CFURLRef)imageFileURL, NULL);
NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(imageSource, 0,
NULL);
NSDictionary *bim = properties[(__bridge id)kCGImageProperty8BIMDictionary];
NSLog(@"bim %@",bim);
CFRelease(imageSource);
In my Image I have some image layers:
The NSLog from the code above returns
imageRead[11220:452087] bim { LayerNames = ( "Layer 0", "Layer 5", "Layer 6", "Layer 4", "Layer 3", "Layer 2", "Layer 1" ); Version = 1; }
If I wanted to know all the keys I could use:
id allKeys = [bim allKeys];
NSLog(@"allKeys %@",allKeys);
And get:
imageRead[11531:463848] allKeys ( Version, LayerNames )
I could then use:
id LayerNames = [bim objectForKey:@"LayerNames"];
NSLog(@"LayerNames %@",LayerNames);
to get :
imageRead[11563:465657] LayerNames ( "Layer 0", "Layer 5", "Layer 6", "Layer 4", "Layer 3", "Layer 2", "Layer 1" )
Or
valueForKey:, allValues
I cannot test if a clipping path would come back unfortunately
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With