• 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: Ray <email@hidden>
  • Date: Tue, 27 Mar 2012 17:31:35 +0200

On Mar 27, 2012, at 4:50 PM, Andreas Mayer wrote:

> The documentation for UIImage -scale says:
>
> "If you load an image from a file whose name includes the @2x modifier, the scale is set to 2.0. If the filename does not include the modifier but is in the PNG or JPEG format and has an associated DPI value, a corresponding scale factor is computed and reflected in this property. "
>
> 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 (is mentioned in this WWDC session I was talking about). Hmm...


_______________________________________________

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: Andreas Mayer <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>)

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