• 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: CGImageRef printing issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGImageRef printing issue


  • Subject: Re: CGImageRef printing issue
  • From: David Duncan <email@hidden>
  • Date: Wed, 12 Aug 2009 12:30:20 -0700

On Aug 11, 2009, at 11:39 PM, Renzil D'Souza wrote:

Once I get the CGImageSourceRef, I make a call to
CGImageSourceCopyProperties() passing it the imageSource . But this always
returns a NULL. If I output this CGImageRef to a file, and then read it back
as a CGImageSource, and then call CGImageSourceCopyProperties(), it works
fine and gives me the required properties. But I need it to work without
having to output an image file.

DPI is a function of specific images in an image file, not of the entire file itself (which is what your getting when you call CGImageSourceCopyProperties). You want to call CGImageSourceCopyPropertiesAtIndex instead for the particular image you want to get properties for.


From my experience on Windows, DPIHeight and DPIWidth are properties of the
display device the image is drawn on, and not properties of the image
itself.

They are properties of both. In the case of printing, you are using a fixed grid at 72 PPI. Your source image of course has its own DPI that determines the actual size of the image in real world units. You combine the two to print or display an image at its natural size.


And what is kCGImagePropertyOrientation?

Images don't necessarily have to be oriented with with pixels neighboring columns adjacent on a row of pixels and the orientation reflects this. The 8 defined orientations basically take into account that you can rotate and mirror an image relative to how its pixels are actually ordered.


This is a general property of images, although not supported (or used) in all formats.

Is it that the orientation of a saved image file can be one of a number of enumerations, but the orientation of a CGImageRef is always the default orientation?


Effectively, CGImage has no support for orientations so if an image is meant to be displayed in a different orientation, then it will be drawn incorrectly by Quartz without applying the required transform first.

Now that said, NSImage may be a much simpler method of doing this, so you may want to investigate that alternative instead.
--
David Duncan
Apple DTS Animation and Printing


_______________________________________________

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


References: 
 >CGImageRef printing issue (From: "Renzil D'Souza" <email@hidden>)

  • Prev by Date: Re: CATransition + NSView mask
  • Next by Date: Re: Releasing ivars in -didTurnIntoFault. Should set to nil?
  • Previous by thread: CGImageRef printing issue
  • Next by thread: Line breaks and paragraph breaks
  • Index(es):
    • Date
    • Thread