• 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: CGImageSourceCopyPropertiesAtIndex returns nil?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGImageSourceCopyPropertiesAtIndex returns nil?


  • Subject: Re: CGImageSourceCopyPropertiesAtIndex returns nil?
  • From: Scott Thompson <email@hidden>
  • Date: Thu, 27 Oct 2005 11:12:38 -0500


On Oct 27, 2005, at 3:46 AM, Steve Gehrman wrote:


I'm trying to get the properties of an .ai image.

CGImageSourceCopyPropertiesAtIndex returns nil.

But, If I create an NSImage, I can get the size. Why doesn't CGImageSourceCopyPropertiesAtIndex return a kCGImagePropertyPixelWidth and kCGImagePropertyPixelHeight?

Because a ".ai" image is simply a PDF. PDF's are drawn in a device independent drawing space and don't have an intrinsic "pixel" size. The pdf does not receive it's pixel size until you draw it on a context and Quartz transfers the drawing to a device that does have pixels.


I suspect that when you create an NSImage from it, NSImage is making the assumption that the image will be drawn to a 72 dpi (screen resolution) device and it is returning a size based on that assumption. If you were to draw that image to a 300 dpi laser printer, however, you pixel counts would be wrong.

Scott

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >CGImageSourceCopyPropertiesAtIndex returns nil? (From: Steve Gehrman <email@hidden>)

  • Prev by Date: Re: Accessor macros used by GNUstep but not Cocoa?
  • Next by Date: Re: WebView novice question
  • Previous by thread: CGImageSourceCopyPropertiesAtIndex returns nil?
  • Next by thread: Clicking the Dock
  • Index(es):
    • Date
    • Thread