Tutorial 04
February 26, 2026 · View on GitHub
What you will learn
- When to use
desc.CommandLineNodevsdesc.Node - How
commandLineand{allParams}work - How to write an external processing script
- The
groupmechanism for including/excluding parameters from the command line
Prerequisites
- Completed Tutorial 01.
When to use CommandLineNode
Use desc.CommandLineNode when:
- Your processing logic lives in a standalone script or binary.
- You want process isolation (separate memory space, separate dependencies).
- You are wrapping an existing CLI tool.
Use desc.Node when:
- Your logic is tightly integrated with Meshroom (needs
chunk,logManager, etc.). - You need fine-grained control over the execution flow.
The commandLine attribute
class HelloCommandLine(desc.CommandLineNode):
commandLine = "python " + str(
Path(__file__).parent.parent.parent / "scripts" / "hello_process.py"
) + " {allParams}"
Path(__file__)resolves to the node's.pyfile. We navigate up to the plugin root, then intoscripts/.{allParams}is replaced by all parameters that havegroup="allParams", formatted as--name valuepairs.
For example, with these inputs:
--input /path/to/image.jpg --brightness 20 --contrast 1.5 --outputPath /path/to/output.jpg
The group mechanism
desc.IntParam(
name="brightness",
...
group="allParams", # Included in {allParams}
)
desc.ChoiceParam(
name="verboseLevel",
...
group="", # Excluded from {allParams}
)
group="allParams"— the parameter is included in{allParams}expansion.group=""— the parameter is excluded from the command line.
Important: The output path must also be in group="allParams" so the script knows where to write its result. This is the standard pattern in mrRoma and mrVideoUtils.
No processChunk needed
desc.CommandLineNode does not have a processChunk method. Meshroom handles:
- Building the command from
commandLineand parameter substitution. - Executing it as a subprocess.
- Capturing stdout/stderr for the node's log.
Writing the external script
scripts/hello_process.py is a standard Python script:
import argparse
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--input", required=True)
parser.add_argument("--brightness", type=int, default=0)
parser.add_argument("--contrast", type=float, default=1.0)
parser.add_argument("--outputPath", required=True)
args = parser.parse_args()
import cv2
image = cv2.imread(args.input)
# ... process image ...
cv2.imwrite(args.outputPath, result)
if __name__ == "__main__":
main()
The argument names must match the name attributes of the node's parameters with group="allParams".
How to test it
A pre-configured project is available: open meshroom/tuto04-hello-command-line.mg in Meshroom (make sure you have run scripts/setup_projects.sh first). Or set it up manually:
- Add a HelloCommandLine node to your graph.
- Set the Input Image field to the path of your test image. For this tutorial, we use the Meshroom logo
hello-world-mrlogo.png:
- Adjust Brightness and Contrast parameters.
- Click Compute.
- To view the output in the 2D viewer, double-click on the node or use the dropdown menu at the bottom of the 2D viewer and select Output Image.
- Check the node's log to see the exact command line that was executed.
- The output should show the image with adjusted brightness and contrast.

Expected result
The output image has brightness and contrast adjusted according to the parameters. The processing was done by the external script, not by the node itself.