• 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: Michael Vannorsdel <email@hidden>
  • Date: Mon, 16 Jun 2008 23:33:38 -0600

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.

_______________________________________________

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: NSXMLDocument and XSD substitutionGroup
  • Next by Date: Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file? BACK ON TRACK
  • Previous by thread: NSXMLDocument and XSD substitutionGroup
  • Next by thread: Re: Convert CGImageRef from BGR to RGB
  • Index(es):
    • Date
    • Thread