Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Image Writer Plugin Sample Code - unexpected color results
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image Writer Plugin Sample Code - unexpected color results



Dear all,

Solved the problem with the sample code: re: not producing color images:

By removing: kCGBitmapByteOrder32Host, the Image Writer sample code now produces color images.

Would removing this have an impact on other platform architectures (I'm on intel: MBP Core Duo 10.5.2)?
Why should having it result in unexpected results?



Working:
cgImage = CGImageCreate([qcImage bufferPixelsWide], [qcImage bufferPixelsHigh], 8, (pixelFormat == QCPlugInPixelFormatI8 ? 8 : 32), [qcImage bufferBytesPerRow], colorSpace, (pixelFormat == QCPlugInPixelFormatI8 ? 0 : kCGImageAlphaPremultipliedFirst), dataProvider, NULL, false, kCGRenderingIntentDefault);


Original:
cgImage = CGImageCreate([qcImage bufferPixelsWide], [qcImage bufferPixelsHigh], 8, (pixelFormat == QCPlugInPixelFormatI8 ? 8 : 32), [qcImage bufferBytesPerRow], colorSpace, (pixelFormat == QCPlugInPixelFormatI8 ? 0 : kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host), dataProvider, NULL, false, kCGRenderingIntentDefault);



Regards, Ian

*******************************
Ian Grant
Senior Lecturer in Digital Art
Faculty of the Arts
Thames Valley University
Ealing, UK
W5 5DX
<email@hidden>
*******************************



On 1 Mar 2008, at 20:49, Ian Grant wrote:

Hi,

I was just playing with the Image Writer Plug-in sample code - and seem to be getting unexpected color results:

Sample Code:
/* Figure out pixel format and colorspace to use */
	colorSpace = [qcImage imageColorSpace];
	if(CGColorSpaceGetModel(colorSpace) == kCGColorSpaceModelMonochrome)
	pixelFormat = QCPlugInPixelFormatI8;
	else if(CGColorSpaceGetModel(colorSpace) == kCGColorSpaceModelRGB)
	pixelFormat = QCPlugInPixelFormatARGB8;
	else
	return NO;

...

cgImage = CGImageCreate([qcImage bufferPixelsWide], [qcImage bufferPixelsHigh], 8, (pixelFormat == QCPlugInPixelFormatI8 ? 8 : 32), [qcImage bufferBytesPerRow], colorSpace, (pixelFormat == QCPlugInPixelFormatI8 ? 0 : kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host), dataProvider, NULL, false, kCGRenderingIntentDefault);

<PreviewScreenSnapz001.png>



I've experimented changing the parameters of CGImageCreate().

Is the CGImage (with the default example code) supposed to always be greyscale? [ apologies if I simply have misunderstood the code]
What CGImageCreate() parameters would I need to match the colorspace of the default QC context?
and
When would the [qcImage imageColorSpace] return anything other than default [linear?] RGB?
In my composition QC generates the source image with a 'Render in Image' patch. What colorspace would images created internal to QC be - with color correction and without color correction?
If I imported an image with a color profile, do color spaces get respected [I assume 'yes' with color correction selected]?


In what context with images created in QC would the colorSpace return as Monochrome?

I read the threads from Jonas S 'QCRenderer colorspace problems [was QCRenderer work area size]' and Raphael Sebbe 'QCRenderer and colorspace parameterizing'.

Thanks, any insights would be welcome.

Regards, Ian


******************************* Ian Grant Senior Lecturer in Digital Art Faculty of the Arts Thames Valley University Ealing, UK W5 5DX <email@hidden> *******************************



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

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Image Writer Plugin Sample Code - unexpected color results (From: Ian Grant <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.