• 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: NSBitmapImageRep getPixel and color Spaces
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBitmapImageRep getPixel and color Spaces


  • Subject: Re: NSBitmapImageRep getPixel and color Spaces
  • From: Heinrich Giesen <email@hidden>
  • Date: Thu, 2 Mar 2006 10:37:51 +0100


On 02.03.2006, at 01:11, Daniel Vollmer wrote:

For reference, the file I am using for testing is a grayscale PNG
image with 8bpp and the info panel displays the color-space as
"Calibrated Gray Colorspace", the created NSBitmapImageRep which I
fill with data and display is using NSCalibratedWhiteColorSpace.

The data in the PNG data (or PNG file) are NOT alpha premultiplied and not gamma corrected. After creating an imageRep with

imageRep = [[NSBitmapImageReg alloc] initWithData:pngData]; (typo in your mail?)
or
imageRep = [NSBitmapImageReg imageRepWithData:pngData]
the pixels in the corresponding bitmapData are alpha premultiplied
but not gamma corrected. If the PNG data contain a gAMA chunk
you can find the value in the imageReps property dictionary:
NSNumber gamma = [imageRep valueForProperty:@"NSImageGamma"];
This value is evaluated during the rendering process. The pixels
you read with getPixel:atX:y: are the data of the bitmapData of
the imageRep, i.e. they NOT gamma corrected. This may explain the
difference of what you said:


.. but when I create an NSImage (and a
corresponding NSBitmapImageRep) from the raw data and display it, the
gamma-curve (for a grayscale image) looks slightly different then
when I am displaying the image in Preview.app.

The difference is the difference between no gamma correction (raw data) and gamma correction (raw data after rendering).

--
Heinrich Giesen
email@hidden


_______________________________________________ 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
  • Follow-Ups:
    • Re: NSBitmapImageRep getPixel and color Spaces
      • From: Daniel Vollmer <email@hidden>
  • Prev by Date: Re: Need HELP - Dragging a view
  • Next by Date: Re: How to get the values entered in pagesettings panel in a Document based Application
  • Previous by thread: Re: NSBitmapImageRep getPixel and color Spaces
  • Next by thread: Re: NSBitmapImageRep getPixel and color Spaces
  • Index(es):
    • Date
    • Thread