• 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: Convert CGImageRef from BGR to RGB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert CGImageRef from BGR to RGB


  • Subject: Re: Convert CGImageRef from BGR to RGB
  • From: Rodrigo Gutierrez <email@hidden>
  • Date: Tue, 17 Jun 2008 20:48:37 -0400

Let's just say that vImage isn't an option on the platform I would like to develop for. I was hoping there would be an approach that used a CGColorSpaceRef and the CGImageCreateCopyWithColorSpace method. I'm not sure if this is a valid approach though since the apple docs for doing these types of things are fairly sparse IMHO. The Quartz 2D Programming Guide even mentions BGR vs RGB color profiles, but doesn't clearly say to go from one profile to another.

-rod

If you get your image data into a bitmap form you can use vImage's (Accelerate Framework) permute functions to quickly rearrange the channel ordering. There might be another way using color spaces, but none that I know off hand.


On Jun 16, 2008, at 5:09 PM, Rodrigo Gutierrez wrote:

I'm pulling data off a streaming web camera, and it appears that the camera sends jpeg data using the BGR color space. Right now I am creating a CGImageRef by doing the following:

CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, jpegData, jpegDataLength, NULL);
CGImageRef imageRef = CGImageCreateWithJPEGDataProvider(provider, NULL, true, kCGRenderingIntentDefault);


Where jpegData is the payload of several packets concatenated, and jpegDataLength is the length of the jpegData buffer... basic stuff. This approach gets me an image but my reds and blues are flipped. I checked out the documentation and google and I couldn't find a clear way to swap the red and blue using Cocoa. Can someone steer me in the right direction?

I appreciate any help.

"I love deadlines. I like the whooshing sound they make as they fly by." --Douglas Adams


_______________________________________________

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


  • Prev by Date: unexpected nil outlet
  • Next by Date: Re: unexpected nil outlet
  • Previous by thread: Re: Convert CGImageRef from BGR to RGB
  • Next by thread: Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file? BACK ON TRACK
  • Index(es):
    • Date
    • Thread