• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions


  • Subject: Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions
  • From: Andreas Mayer <email@hidden>
  • Date: Tue, 27 Mar 2012 18:41:33 +0200

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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions
      • From: Ray <email@hidden>
    • Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions
      • From: Ray <email@hidden>
References: 
 >Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions (From: Ray <email@hidden>)
 >Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions (From: Marco Tabini <email@hidden>)
 >Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions (From: Andreas Mayer <email@hidden>)
 >Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions (From: Ray <email@hidden>)

  • Prev by Date: Re: File types...
  • Next by Date: Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions
  • Previous by thread: Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions
  • Next by thread: Re: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions
  • Index(es):
    • Date
    • Thread