Am 27.03.2012 um 17:31 schrieb Ray: >> So I would expect PNG images to retain their scale value when saved and >> loaded. >> >> If this does not work, there seems to be a bug somewhere. >> Ray, did you try to explicitly set the image's scale value before creating >> the PNG representation? > > Well, I don't save it to a file, but to a NSData property on a Core Data > managed object, and I use UIGraphicsBeginImageContextWithOptions, after which > newImage = UIGraphicsGetImageFromCurrentImageContext() will set the scale of > "newImage" appropriately (under retina to 2.0, I checked with setting a > breakpoint and looking at the scale variable of the image)... It is more that > the imageWithData class method on UIImage always will report a scale of 1.0
The scale value is the same as set in UIGraphicsBeginImageContextWithOptions(), as far as I can tell. But it will be lost when creating PNG data and reading it again. (Since I don't see a way of creating a PNG file without using UIImagePNGRepresentation() it doesn't seem to matter if the data was saved to a file or not.) So either imageWithData does not restore the scale from PNG data or UIImagePNGRepresentation() does not store it in the first place. I see that as a bug, since the PNG format is able to hold that information. Andreas _______________________________________________ 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