Apple's Image Exporter Plugin

volkerk's picture

I want to be able to write images out of QC and Apple's "Image Exporter" plugin is a good start. Unfortunately, it does not allow for custom file names, only the path. Files are always called "Image-00001.png" and the index is increased every time a new image is written.

I tried to muck around with the plugin source code to change it that the path input is used as path + filename. but it turned out i do not know enough about c#, tried but could not figure it out.

i know it is very simple, this is the relevant code snippet:

fileURL = [NSURL fileURLWithPath:[Bad link]];
imageDestination = (fileURL ? CGImageDestinationCreateWithURL((CFURLRef)fileURL, kUTTypePNG, 1, NULL) : NULL);

how do i change it to use self.inputPath as the path and filename?

plugin xcode source: http://developer.apple.com/mac/library/samplecode/ImageExporter/Introduc...

thx for your help

cybero's picture
Re: Apple's Image Exporter Plugin

You would need to be creating an input in Cocoa to allow for the setting of a special name with numeric accretion.

BTW , this doesn't solve the coding problem you face, but it does give more control, see this post http://kineme.net/forum/Discussion/DevelopingCompositions/Howexportimage...

psonice's picture
Re: Apple's Image Exporter Plugin

Try replacing the fileURL line with this one*:

fileURL = [NSURL fileURLWithPath:[self.inputPath stringByStandardizingPath]];

  • disclaimer: I'm not able to test it right now, and have a bad habit of posting stuff like this up in the wrong language or something ;)

On the same subject, I've had a nearly-finished replacement for the image exporter written for weeks now, but I'm still stuck when it comes to getting a 16/32bit colour image out of QC. I've done this without difficulty in an actual application, it's the QCPlugin part that's throwing me.

I asked on the QC mailing list without any real response, anyone care to help? Here's my last email to the list:

Quote:
First I'm locking the buffer rep with [QCPlugInInputImageSource lockBufferRepresentationWithPixelFormat: colorSpace: forBounds:]. Colorspace/bounds I get from the image, pixelformat I'm using QCPlugInPixelFormatARGB8 for 8 bit or QCPlugInPixelFormatRGBAf for 16/32 (I suspect a problem here: isn't the 16 bit format in QC 16bit integer? 8/32bit should be OK though. And I'm not worrying about PPC support.)

Then, I'm creating a CGImage provider, followed by a CGImage using CGImageCreate:

cgImage = CGImageCreate([qcImage bufferPixelsWide], [qcImage
bufferPixelsHigh], bitdepth, bitdepth * 4, [qcImage
bufferBytesPerRow], colorSpace, bitmapInfo, dataProvider, NULL, false,
kCGRenderingIntentDefault);

I think that's all OK (with the exception of the pixel format being wrong for 16 bit, but with 16 bit being somewhat broken in QC I'm more concerned with 8/32 bit modes) apart from the CGBitmapInfo part. For 8 bit it's just kCGImageAlphaPremultipliedFirst, but what should I be using for the 16/32 bit modes? I thought "kCGBitmapFloatComponents | kCGBitmapByteOrder32Host" should cover it, but no matter what I try it seems to either not use float values or has wrong byte ordering :/

cybero's picture
Re: Apple's Image Exporter Plugin

although your suggestion has some merits in some context, unfortunately it doesn't produce a custom file name output option

volkerk's picture
Re: Apple's Image Exporter Plugin

PSonics thanks so much. works like a charm. a custom path + image file name (for instance "~/Desktop/test_01.png" is now accepted as plugin input.

I attached the compiled version of the modified image exporter plugin.

PreviewAttachmentSize
ImageExporter.plugin.zip12.03 KB

cybero's picture
Re: Apple's Image Exporter Plugin

That's interesting that psonice's suggestion works AOK for you. I downloaded and tried your plugin [10.6.4] and I got no output at 64 bit and correct output at 32 bit.

Wish I'd tried that with my code experiments, which were actually looking at outputting a series of numbered files of .png ext with a particular name appended rather than a single file.

Apologies to you psonice, I had based my previous post solely upon the results in 64 bit QC without even thinking about it.

Of course, that still leaves the question as to why that doesn't work in QC 64 bit.

psonice's picture
Re: Apple's Image Exporter Plugin

No problem. I don't get why this isn't working for you - unless Volkerk has done something else to the plugin (seems unlikely), this should just be the standard apple image exporter plugin. The only change is that it now writes to a single filename and not a sequence.

I'm actually using a near-identical plugin in a project (my only changes were to write out jpeg instead of png, and to use a timestamp instead of a number sequence). It's working fine under QC in 64bit mode (in fact it's been running fine for literally months, 24/7!)

volkerk's picture
Re: Apple's Image Exporter Plugin

QC on my machine as set to 32 bit and after i switched to 64, the plugin was still working. Make sure you have it enabled and export happens once you change the image at the input (can be done with a multiplexer)

v.