Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving the result of processing an image to another image




Here's what I'd do.

First, let's start with the output in QC, because that's how you do it in QC!

Take whatever composition you have in mind, and put it into a "Render in Image" (RiI) patch. Hook up that RiI patch to a billboard, so you can see what you are doing in QC. (I tend to set the billboard width to 2, so that the image fills up the entire width of the viewer.)

Publish the Image output of the RiI patch, so that your code can get to it ... see below.

Inside your RiI, whatever image you want to be processed, publish that input. Notice when you get to the Root, that Image is now an input to RiI. Publish that input, so that you can get to that input from your code.

So now your qtz file should have one published input, and one published output.

Now for the code ....

In my case, I want to do all my processing off-screen, so in my code, I create an offscreen NSWindow initWithContentRect: ... with some negative coordinates.

Then, I create a QCView, sized to the desired output image size. I set the content view of my offscreen window to be my QCView.

Next, you'd hook up your image object to the view, something like this:

        success = [myQCView setValue:myImage forInputKey:@"Image"];

Now you are ready to "run" the composition.

    BOOL started = [myQCView startRendering];

That's enough to make it generate its first frame, which, if you're using QC for still images, is enough. It's time to get the output image.

image = [myQCView valueForOutputKey:@"Image"]; // image with NSCGImageRep

Then, you can stop rendering: [myQCView stopRendering];


That should do it!





On May 5, 2005, at 5:33 PM, Benoit Marchant wrote:

Hi

Starting with an image (CGImage, CIImage or NSImage), processing it with a composition, how does one save that to another image ?

Also, is there a way to filter compositions on the fact that they would render an image compared to an animation ?

Thanks,

Benoit
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden
References: 
 >Saving the result of processing an image to another image (From: Benoit Marchant <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.