CIImage <-> bitmap data <-> NSImage

  • I have a test application that creates a CIImage instance from an on-disk
    image file (jpg, tiff, bmp, etc.).

    I need to apply several core image filters then obtain the raw bitmap data
    for that image so that I can apply a few hand-created "filters".  I _may_
    need to convert the resulting data into an NSImage.  Actually I may have to
    move between an arbitrary number of a closed set of representations.

    I've found several code snippets than render a CIImage instance into an
    offscreen bitmap, but I've seen non-deterministic results (possibly a
    problem with the code I grabbed).

    This doesn't seem, to me anyway, that what I am trying to do is that
    uncommon, yet moving image representations between Core Image, Cocoa
    (NSImage), and raw data doesn't seem very straightforward - which leads me
    to believe that I am missing something.  (And yes, I realize that a CIImage
    is just a "recipe"; there is no underlying image representation until it is
    "rendered").

    Any pointers would be appreciated,
    CxT
  • On Oct 17, 2007, at 5:37 AM, Simon Raisin wrote:

    > This doesn't seem, to me anyway, that what I am trying to do is that
    > uncommon, yet moving image representations between Core Image, Cocoa
    > (NSImage), and raw data doesn't seem very straightforward - which
    > leads me
    > to believe that I am missing something.  (And yes, I realize that a
    > CIImage
    > is just a "recipe"; there is no underlying image representation
    > until it is
    > "rendered").

    Under Tiger, you can create an NSCIImageRep, and add that to your
    NSImage. After that, you can draw as you would any another CIImage.

    In terms of getting CIImage to an NSImage, there are some details here:
    <http://theocacao.com/document.page/350>

    > I've found several code snippets than render a CIImage instance
    > into an
    > offscreen bitmap, but I've seen non-deterministic results (possibly a
    > problem with the code I grabbed).

    It's probably an issue with that sample. It should work fine.

        - Scott
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today