Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing CGImageProperties to get EXIF properties
    primarykey
    data
    text
    <p>I want to be able to add a text comment to the metadata of a JPEG and be able to read it back from within an iphone app.</p> <p>I thought this would be fairly simple as ios4 contains support for EXIF info. So I added metadata using a Windows tool called used AnalogExif and read it back from my app using:</p> <pre><code>NSData *jpeg = UIImageJPEGRepresentation(myUIImage,1.0); CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)jpeg, NULL); NSDictionary *metadata = (NSDictionary *) CGImageSourceCopyPropertiesAtIndex(source,0,NULL); NSMutableDictionary *metadataAsMutable = [[metadata mutableCopy]autorelease]; [metadata release]; NSMutableDictionary *EXIFDictionary = [[[metadataAsMutable objectForKey:(NSString *)kCGImagePropertyExifDictionary] </code></pre> <p>And that works...to a point :)</p> <p>What I get back in the metadata dictionary is something like:</p> <pre><code>(gdb) po metadata { ColorModel = RGB; Depth = 8; Orientation = 1; PixelHeight = 390; PixelWidth = 380; "{Exif}" = { ColorSpace = 1; PixelXDimension = 380; PixelYDimension = 390; }; "{JFIF}" = { DensityUnit = 0; JFIFVersion = ( 1, 1 ); XDensity = 1; YDensity = 1; }; "{TIFF}" = { Orientation = 1; }; } </code></pre> <p>But thats all I can get! I've edited the JPEG file with every EXIF editor I can find (mostly PC ones I should say) and although they all say I have added JPEG comments and EXIF captions and keywords, none of that info seems to be available from the Apple SDK in my app.</p> <p>Has anyone managed to set a text field in the metadata of a jpeg and manage to read it back from an iphone app?</p> <p>I didn't want to use a third party library if at all possible</p> <p>many thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload