Hi,

I am wanting to edit metadata in a JPEG, and am just testing
code (below) to read and write out an image without modification using CGImage 
to make sure I can do so without changing the image.  I am unable to obtain an
output file which is identical to the input file.  Any suggestions?  have tried 
setting kCGImageDestinationLossyCompressionQuality to 1.0.

Thanks,
Hugo

    // Load the image
    NSURL *absURL= [NSURL fileURLWithPath:@"testImage.JPG"];
    CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)absURL, 
NULL);
    size_t numImages=CGImageSourceGetCount(source);
    
    // Create an image destination writing to `url'
    NSURL *absURL2= [NSURL fileURLWithPath:@"testImageOutput.JPG"];
 
  CGImageDestinationRef dest =
CGImageDestinationCreateWithURL((CFURLRef)absURL2,
(CFStringRef)@"public.jpeg", numImages, nil);
    
    size_t i=0;
    for (i=0; i<numImages; ++i)
    {
        CFMutableDictionaryRef mMetadata = 
(CFMutableDictionaryRef)CGImageSourceCopyPropertiesAtIndex(source, i, nil);
        CGImageDestinationAddImageFromSource(dest, source, i, mMetadata);
    }  
    
    BOOL status = CGImageDestinationFinalize(dest);


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to