Generate Command
The generate command creates images from workflow files or inline parameters.
floimg generate [file] [options]Options
Section titled “Options”| Option | Alias | Description |
|---|---|---|
--output | -o | Output file path (required) |
--generator | -g | Generator name (when not using file) |
--params | -p | JSON params (when not using file) |
--format | -f | Output format (png, jpeg, webp) |
--quiet | -q | Suppress output |
Examples
Section titled “Examples”From Workflow File
Section titled “From Workflow File”# Generate from JSON workflowfloimg generate chart-workflow.json -o chart.png
# Generate from YAML workflowfloimg generate workflow.yaml -o output.pngInline Generation
Section titled “Inline Generation”# Generate a QR codefloimg generate -g qr -p '{"data":"https://floimg.com"}' -o qr.png
# Generate a chartfloimg generate -g quickchart -p '{ "type": "bar", "data": { "labels": ["A", "B", "C"], "datasets": [{"data": [10, 20, 30]}] }}' -o chart.pngWith Transforms
Section titled “With Transforms”Workflow file with transforms:
{ "generator": "screenshot", "params": { "url": "https://example.com" }, "transforms": [ { "op": "resize", "params": { "width": 1200 } }, { "op": "convert", "params": { "format": "webp", "quality": 85 } } ]}floimg generate screenshot-workflow.json -o page.webpOutput to S3
Section titled “Output to S3”floimg generate workflow.json -o s3://my-bucket/images/output.pngRequires AWS credentials in environment.
Piping Output
Section titled “Piping Output”# Pipe to another commandfloimg generate workflow.json -o - | upload-tool
# Read params from stdincat params.json | floimg generate -g quickchart -p - -o chart.pngWorkflow File Format
Section titled “Workflow File Format”{ "generator": "quickchart", "params": { "type": "line", "data": { ... } }, "transforms": [ { "op": "resize", "params": { "width": 800 } } ]}generator: quickchartparams: type: line data: labels: [Jan, Feb, Mar] datasets: - data: [10, 20, 30]transforms: - op: resize params: width: 800Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid arguments |
| 3 | Generator not found |
| 4 | Output write failed |
See Also
Section titled “See Also”- CLI Overview - Installation and basics
- Transform Command - Transform existing images