Color matching multiple images in one bitmap
Color matching multiple images in one bitmap
- Subject: Color matching multiple images in one bitmap
- From: Clarence Locke <email@hidden>
- Date: Sun, 20 May 2012 09:42:25 -0700
(This was originally posted to the Colorsync-dev list about three weeks ago without any activity on the list, so I'm hoping that someone here can help)
I have an app that is essentially creating a single resultant image from an amalgamation of multiple source images. Each source image is an NSImage that has a single NSBitmapImageRep which carries with it color profile data in its NSImageColorSyncProfileData property.
The effective algorithm is:
NSBitmapImageRep* getBitmapOfImages(NSArray* imagesArray, NSSize bitmapSize)
{
NSBitmapImageRep* bitmap = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL
pixelsWide: bitmapSize.width
pixelsHigh: bitmapSize.height
bitsPerSample: 8
samplesPerPixel: 4
hasAlpha: YES
isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace
bytesPerRow: 0
bitsPerPixel: 0] autorelease];
NSGraphicsContext* bitmapGraphicsContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap];
NSGraphicsContext* originalGraphicsContext = [NSGraphicsContext currentContext];
[NSGraphicsContext setCurrentContext:bitmapGraphicsContext];
for (NSImage* image in imagesArray)
{
NSRect imageRect = /* calculate rect for particular source image */;
[image drawInRect:imageRect ...];
}
[NSGraphicsContext setCurrentContext:originalGraphicsContext];
return bitmap;
}
The issue I am experiencing is that the color of the resultant image generated by my application when printed does not match the color of the source image when printed from another application (which is in this case Aperture).
What attributes do I need to use when creating the destination bitmap so that the color of each source image is rendered properly for that source image when the destination image is printed? Or is there a deeper issue that I am not addressing here?
_______________________________________________
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