Skill

Automate Vector Graphics and Diagram Creation

Skill automating LibreOffice Draw ODG diagrams - creation, SVG/PDF/PNG conversion, batch processing, UNO scripting.


71
Spark score
out of 100
Updated 4 days ago
Version 15.5.1

Add to Favorites

Why it matters

Streamline the creation, editing, and conversion of vector graphics and diagrams. Automate complex drawing tasks and generate visual assets efficiently using the native ODG format.

Outcomes

What it gets done

01

Create new ODG drawings from scratch or templates

02

Convert between ODG, SVG, PDF, PNG, and JPG formats

03

Automate flowchart and diagram generation

04

Perform batch processing of graphics operations

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-draw | bash

Overview

LibreOffice Draw

A skill automating LibreOffice Draw ODG diagram creation, SVG/PDF/PNG conversion, and batch processing via the soffice CLI or Python/UNO scripting. Use when creating or converting vector diagrams in ODG format, or automating batch diagram/flowchart generation.

What it does

This skill covers LibreOffice Draw for creating, editing, converting, and automating vector graphics and diagram workflows in the native ODG (OpenDocument Drawing) format - graphics creation (new drawings from scratch, template-based diagrams, flowcharts, org charts, technical drawings and schematics), format conversion (ODG to/from SVG, PDF, PNG, JPG), diagram automation (template-based generation, automated flowchart creation, dynamic shape generation, batch production), graphics manipulation (shape creation and manipulation, path and bezier curve editing, layer management, text and label insertion), and integration via the command-line soffice tool or Python/UNO scripting.

When to use - and when NOT to

Use it when creating vector graphics/diagrams in ODG format, converting between ODG/SVG/PDF/PNG, automating diagram or flowchart generation, creating technical drawings/schematics, or batch-processing graphics operations.

Inputs and outputs

Create a new drawing via the command line (soffice --draw template.odg) or via Python with UNO: the script resolves a local component context via uno.getComponentContext(), creates a com.sun.star.bridge.UnoUrlResolver service, connects to a running LibreOffice instance over a socket (uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext), instantiates a com.sun.star.drawing.DrawingDocument, gets the first draw page via getDrawPages().getByIndex(0), then saves it with doc.storeToURL("file:///path/to/drawing.odg", ()) and closes the document. Conversion uses soffice --headless --convert-to <format> <file> for ODG-to-SVG/PDF/PNG and SVG-to-ODG, with batch conversion via a shell loop over *.odg. Supported input formats: ODG (native), SVG, PDF. Supported output formats: ODG, SVG, PDF, PNG, JPG, GIF, BMP, WMF, EMF. Python libraries named for ODF/SVG work: ezodf (ODF handling), odfpy (ODF manipulation), and svgwrite (SVG generation).

Integrations

Command-line reference: soffice --headless (headless mode), soffice --headless --convert-to <format> <file> (conversion), and soffice --draw (open Draw directly). Best practices: use layers for organization, create templates for recurring diagrams, use vector formats for scalability, name objects for easy reference, store ODG source files in version control, test conversions thoroughly, and export to SVG for web use. Troubleshooting: if the UNO socket can't open, run killall soffice.bin to clear any stuck instance, then restart LibreOffice listening on that socket with soffice --headless --accept="socket,host=localhost,port=8100;urp;"; for quality issues in PNG export, pass a --filterData width/height override on the png:PNG_drawing_Export filter:

soffice --headless --convert-to png:PNG_drawing_Export \
  --filterData='{"Width":2048,"Height":2048}' drawing.odg

Who it's for

Developers and technical writers automating diagram/vector-graphics workflows - generating, converting, or batch-processing ODG drawings and their SVG/PDF/PNG exports - via the command line or Python/UNO scripting, related to the writer, calc, impress, base, and workflow-automation skills. Further reference material is pointed to in the LibreOffice Draw Guide, the UNO API Reference, and the W3C SVG Specification.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.