Hello! I’m looking for some help on a plug-in for stitching images of equal dimensions end-to-end into a single image. The documentation for plug-ins has me a little confused, specifically the word that seems to be missing from sentence “processAsset is called for every image passed to this node. Return true to continue processing the, or false to not.”
My plug-in, which currently does not work as I intend it to, is this:
module.exports = {
accumulator: null,
accumulatorWidth: 0,
workflowEnd: function (document, rbnode) {
this.accumulator = null;
this.accumulatorWidth = 0;
},
processAsset: function (document, rbnode, asset) {
if (!this.accumulator) {
this.accumulator = asset.emptyImageAccumulator();
this.accumulator.drawCIImage(asset.CIImage());
this.accumulatorWidth += asset.imageWidth();
return true;
}
this.accumulatorWidth += asset.imageWidth();
const newAccumulator = asset.emptyImageAccumulatorOfSize(
CGSizeMake(this.accumulatorWidth, asset.imageHeight())
);
newAccumulator.drawCIImage(this.accumulator.image());
newAccumulator.drawCIImage(
asset
.CIImage()
.imageByApplyingTransform(
CGAffineTransformMakeTranslation(
this.accumulatorWidth - asset.imageWidth(),
0
)
)
);
this.accumulator = newAccumulator;
asset.setCIImage(newAccumulator.image());
return true;
},
};
If I don’t reset the accumulator after the workflow ends I get a result closer to what I want (the images stitched together end-to-end), but that’s only after running the workflow twice. I think this is a symptom of me misunderstanding when processAsset
should return true
or false
.
Additionally, is there a faster way to reload plug-ins than this?
- delete the plug-in node
- quit Retrobatch
- delete the .retrobatchplugin from ~Library/Application Support/Retrobatch/Plug-Ins
- double-click the plugin and install it
- re-open Retrobatch
- add the plug-in node back