• 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: Best way to composite/tile multiple CGImages to one image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to composite/tile multiple CGImages to one image


  • Subject: Re: Best way to composite/tile multiple CGImages to one image
  • From: Graham Cox <email@hidden>
  • Date: Sat, 08 Mar 2014 16:30:00 +1100

On 8 Mar 2014, at 4:12 pm, Trygve Inda <email@hidden> wrote:

> I get the same times doing it this way, but maybe my color spaces are
> different. The CGImage returned from my AVAsset is:
>
> <CGColorSpace 0x100550490> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB;
> Composite NTSC)
>
> I am not really sure what color space to pass into:
>
> [NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL.....

>
> Currently I am using NSDeviceRGBColorSpace.
>
> Any thoughts?
>
> T.

My guess is that this is a mismatch, because while both spaces are RGB, one is NTSC derived and the other probably a simple linear RGB.


Unfortunately NSBitmapImageRep only accepts a colour space *name*. It might be that the colorspace used by your images doesn't have a name - try using CGColorSpaceCopyName on the CGColorSpaceRef you get from CGImageGetColorSpace.

If it's NULL, you'll have to drop down to:

CGBitmapContextCreate(...) which accepts the actual CGColorSpaceRef. This will also accept the CGBitmapInfo obtained from your image to ensure that the format matches.

Once done compositing, use CGBitmapContextCreateImage to get the CGImage (which shouldn't do an additional copy of the buffer as long as you treat the image as read-only), then initialize an NSImage from it (again, should be only a wrap operation). At this point you'll have an image using the original NTSC colorspace. If that has to be drawn to the screen, likely it will need to do a similar conversion. Could be that what you gain on the roundabouts you'll lose on the swings.

--Graham



_______________________________________________

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


  • Follow-Ups:
    • Re: Best way to composite/tile multiple CGImages to one image
      • From: Trygve Inda <email@hidden>
References: 
 >Re: Best way to composite/tile multiple CGImages to one image (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Best way to composite/tile multiple CGImages to one image
  • Next by Date: Re: Best way to composite/tile multiple CGImages to one image
  • Previous by thread: Re: Best way to composite/tile multiple CGImages to one image
  • Next by thread: Re: Best way to composite/tile multiple CGImages to one image
  • Index(es):
    • Date
    • Thread