Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 30, 2012, 09:36 PM   #1
Thethuthinang
macrumors member
 
Join Date: Jan 2011
Color Calibration Problem

I am reading pixels from an image using NSReadPixel. This gives me a color with NSDeviceRGBColorSpace. I read in a small collection of these colors and then recreate the image with the reduced color set using the NSBitmapImageRep method:

Code:
initWithBitmapDataPlanes:(unsigned char **)planes
pixelsWide:(NSInteger)width
pixelsHigh:(NSInteger)height
bitsPerSample:(NSInteger)bps
samplesPerPixel:(NSInteger)spp
hasAlpha:(BOOL)alpha
isPlanar:(BOOL)isPlanar
colorSpaceName:(NSString *)colorSpaceName
bytesPerRow:(NSInteger)rBytes
bitsPerPixel:(NSInteger)pBits
To do this, I need to have my image data as unsigned characters. So I use the NSColor method getRed:green:blue:alpha: (then multiply each of the floats by 255 typecasted as unsigned char). I use NSDeviceRGBColorSpace for the colorSpace name in the initWithBitmapPlanes: method.

The colors in the image that I get as a result are off. How can I fix this problem?

If I fill bezier paths with the colors I create from the unsigned char bitmaps, then the colors match better (using both colorWithCalibratedRed:green:blue:alpha: and colorWithDeviceRed:green:blue:alpha

Last edited by Thethuthinang; Jun 30, 2012 at 09:37 PM. Reason: spacing
Thethuthinang is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:34 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC