How to export an image from QC to a file?

capsaicin's picture

Hi,

I'm working on a project in QC, and there's one thing I can't figure out. It seems SO simple, but I can't find any way to export an image from QC. There's probably a way with code but I'm a total dunce in that department!

What I'm going for is to stick my whole composition into a Render In Image, and then have a MIDI button mapped to trigger snapping a screenshot. It's for an installation that possibly hundreds of people will interact with, so ideally I could specify the location the screenshots are saved, and a filenaming convention to keep older files from being overwritten.

Anybody know how to do anything like that in QC? Or, if I'd need XCode/etc, any idea how to go about it? As I said I'm a total code moron, please use kid gloves, haha.

Thanks!

-John

smokris's picture
Re: How to export an image from QC to a file?

http://developer.apple.com/mac/library/samplecode/ImageExporter/

Click "Download Sample Code", unzip it, open it in Xcode, select "Project / Set Active Target / Build & Copy", then select "Build / Build".

Restart Quartz Composer, and you'll see a new patch called Image Exporter. Connect the Render In Image to it, and enable it for one frame when you'd like to save an image (i.e., pass Keyboard through the Pulse patch).

Correction: don't toggle the "Enable" input --- this causes the image filename counter to reset. Instead, use a 2-port Multiplexer, with the first image disconnected and the second image fed from the Render In Image --- then toggle the Multiplexer's input port. The Image Exporter will only write a file when it receives a non-null image.

usefuldesign.au's picture
Re: How to export an image from QC to a file?

Yeah and you can use some string patches to generate the save file path (URL) that is dependant on MIDI or other inputs. Or use Javascript of course — the hammer that hits all pointy metal objects.

Smokris, are you aware of what the pixel dimension limitations on this plugin are?

Are they determined by internal QC limits or the actual plug-in?

I was restricted to about 3000 px wide (image was strip like so image height wasn't an issue) when I was outputting to print and this wasn't quite HighRes at 30cm (250 ppi slightly less than the ideal of 300ppi).

smokris's picture
Re: How to export an image from QC to a file?

usefuldesign.au wrote:
Smokris, are you aware of what the pixel dimension limitations on this plugin are?

Are they determined by internal QC limits or the actual plug-in?

The plugin itself doesn't impose any limits on image size.

I just successfully exported an 8192x8192 image using the plugin.

monobrau's picture
Re: How to export an image from QC to a file?

The NI Image Exporter that installs into QC when you install the fxfactory plugs has an image exporter that let's you have more control (file name, don't overwrite, type etc.)

http://www.noiseindustries.com/fxfactory/

usefuldesign.au's picture
Re: How to export an image from QC to a file?

Quote:
The plugin itself doesn't impose any limits on image size.

Maybe it is GPU related? I'm on the venerable NV GeForce FX 5200. It was done to 1fps or less when I put the comp inside a RII patch so at bigger sizes perhaps it just choked. I left the comp runnning for 30 minutes and it didn't generate a single export file.

capsaicin's picture
Re: How to export an image from QC to a file?

Wow, awesome, thanks guys! I am on my way to bed but I'll check these out and report back. The exported images are web-bound, so even if I was limited to 3000 pixels wide that would be overkill for what I need.

Cheers,

-John

capsaicin's picture
Re: How to export an image from QC to a file?

This works perfectly when I set it up as you described. Thanks!

capsaicin's picture
Re: How to export an image from QC to a file?

Hmm, this requires me to buy fxfactory... looks cool, but for now I'll still with the free option!

gtoledo3's picture
Re: How to export an image from QC to a file?

If you do the demo, it should install the needed plugin and leave it there.

Slugn's picture
Re: How to export an image from QC to a file?

this is fantastic, just what I was looking for..works just fine on OS X 10.8.. had to change the base SDK to 10.8 in xcode, but other wise, works like a charm!!!

it is a good idea to use pulse if you are exporting an image from an updating source such as a syphon client/server instance.

attached composition needs the "export to image" plugin already compiled and installed ;)

PreviewAttachmentSize
export to png.qtz66.25 KB

mildlife's picture
Re: How to export an image from QC to a file?

Hi mates. This would be exactly what I'm looking for. I tryed fxfactory plugin with no luck. And I haven't use xcode, so I am lost how to create the plugin with that. I managed to change base SDK, but then failing to create a plugin. Is xcode in Mavericks somehow differend? Or could somebody share a ready QC plugin?

opticalflow's picture
Re: How to export an image from QC to a file?

Hy there, urgent question. i have an school exibition next week and i cant figurit this out. Xcode is making me dissy.

im having troubel to make the sdk file work with QC. i have a basic knowlege of QC i get the phylosophie. But on the other hand i a tottall noob in Xcode.

I want to export asweel frames from QC controllet by a midi controller.

I managed to get rid of the "2missing target thing in Xcode"

First Big question; when xcode tells me it works were do i find the "QCPlugInPatch:ImageExporterPlugIn" to put it in the plugin folder...?

second question how to i make this work on 10.9.5 osx

liebe grüsse felix

Achim Breidenbach's picture
Re: How to export an image from QC to a file?

Felix:

1) If the Xcode project setup correctly for building QC plugins it will install the plugin to the correct folder automatically. However you can get the binary by right clicking the "Product" in the right column in Xcode to reveal a context menu. Select "Show in Finder" to get to the build folder and the file. Make sure the file you see is not just an "alias" (if so, right click on the file again and select "Show original")

2) Select the target in the left column (first item in the list). You will see the targets settings. Select the "Build Settings" and look for "Base SDK". Here select "10.9".

You may also check the "Architectures" options to be set to "Universal", building for 32 and 64 bit. So you won't have trouble running it in QC when set to 32 or 64 bit. However this may cause additional compiler warnings and errors.

Good Luck!

dust's picture
Re: How to export an image from QC to a file?

here is the code i use to export an image. i had to make this because the image exporter plugin example wouldn't work when apple introduced sandboxing into applications. you can put the code in the execute function of the plugin. i use a pulse on the enable to ensure the image is only written once. see project it might build ? haven't looked at it in while.

http://www.dustino.co/nnor/code/source/image-export/

PreviewAttachmentSize
imgExp.zip60.66 KB