On Jun 8, 2013, at 8:01 AM, Ken Thomases <k...@codeweavers.com> wrote:

> Alternatively, you could force the image to load and then use 
> +[NSBitmapImageRep representationOfImageRepsInArray:usingType:properties:] to 
> create an NSData from the image's representations and save that to file.

Not a good idea. If you do this with images that were originally JPEG, you’ll 
degrade the image quality if you save it out as JPEG again, since it’ll have to 
run the pixels through the lossy encoder again. Or if you save it in a 
different format the file size will go up a lot.

> Another approach would be to use NSURLConnection to obtain the image data.

Or -[NSData dataWithContentsOfURL:options:error:] if you want the 
short-and-easy form. I wouldn’t recommend this in a real app, though, because 
it blocks while loading the file.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to