Inspect and export objects from CorelDRAW CDR files via COM automation.
Coding
CorelDRAW Editor
Try itInspect, edit, and export CorelDRAW CDR files via COM automation.
What it does
Inspect, edit, and export CorelDRAW CDR files via COM automation.
The skill document
CorelDRAW Editor
Use this skill to work with .cdr files through CorelDRAW itself. Prefer CorelDRAW COM automation over raw parsing because CDR is proprietary and version-sensitive.
Requirements
- Windows with CorelDRAW installed and registered for automation, usually
CorelDRAW.ApplicationorCorelDRAW.Application.. - Python 3.9+.
pywin32. If missing and local package installation is acceptable, runpy -3 -m pip install --user pywin32.- Optional: ImageMagick for contact sheets and alpha/size verification.
Safety Rules
- Inspect first. Never edit blind.
- Preserve originals by default. For any edit that changes a document, create or open a copy and save to an explicit output path.
- Treat delete, ungroup, flatten/rasterize, font substitution, color conversion, and overwriting existing files as potentially destructive. Only do them when the user clearly asked or after making a copy.
- Close CorelDRAW in
finallyblocks withdoc.Close()andapp.Quit(). - Report assumptions, especially when objects are unnamed or selected by coordinates/indexes.
Core Workflow
- Confirm the
.cdrpath and output destination. - Inspect structure:
scripts/coreldraw_editor.py inspect input.cdr --json metadata.json- Review pages, layers, shape indexes, names, types, positions, and sizes.
- Make a page preview when objects are unnamed:
scripts/coreldraw_editor.py preview input.cdr preview.png --page 1 --dpi 300
- Decide object selectors:
- Use one-based shape indexes from inspection.
- Use ranges such as
7-20for clusters. - Use comma/range specs such as
2,5,8-10for non-contiguous selections. - Use layer names or indexes when the document has multiple printable layers.
- For exports, export selections or full top-level objects:
scripts/coreldraw_editor.py export input.cdr outdir --item logo.png:3 --format pngscripts/coreldraw_editor.py export input.cdr outdir --item tree.png:7-20 --transparent --manifest out.csv
- For document edits, use copy-first plans:
scripts/coreldraw_editor.py apply-plan input.cdr edited.cdr --op '{"op":"rename","shapes":"4","name":"logo-primary"}'scripts/coreldraw_editor.py apply-plan input.cdr edited.cdr --plan edits.json
- Validate by reopening or inspecting the edited copy, and by exporting a preview/contact sheet when visual correctness matters.
Supported Script Operations
The bundled script intentionally supports conservative operations that map cleanly to CorelDRAW's COM API:
rename: set shape names.move: move selected shapes bydx,dyin document units.set-position: set selected shapes tox,y.resize: set selected shapes towidth,height.rotate: rotate selected shapes byangledegrees.duplicate: duplicate selected shapes with optionaldx,dyoffset.delete: delete selected shapes from the edited copy.group: group selected shapes.ungroup: ungroup selected shapes.layer-visible: set layer visibility.layer-printable: set layer printability.save-copy: save an output.cdrcopy without further edits.
For more specialized tasks such as precise fill/outline replacement, font substitution, text replacement, PowerClip edits, lens/effect edits, or import placement, first inspect the generated Corel COM wrapper under Python's win32com.client.gencache folder and script against the exact installed CorelDRAW version. Use page previews before and after.
Validation
- For PNG exports, verify transparency and dimensions with ImageMagick when available:
magick identify -format "%f %[channels] %[pixel:p{0,0}] %wx%h\n" *.png
- For many exports, create a contact sheet:
magick montage *.png -thumbnail 180x180 -set label "%t" contact_sheet.png
- For edited CDR output, re-run
inspecton the edited copy and export a preview before reporting success.
Practical Notes
CorelDRAW.Application.is more deterministic than the version-independent ProgID when multiple Corel versions exist.- Shape indexes are document/order dependent. Re-inspect after operations that add/delete/group/ungroup shapes.
- Exporting a selection usually crops to the selection bounds. Complex effects, lenses, transparencies, missing fonts, and linked assets may render differently depending on export format.
- If generic tools cannot decode CDR, that is normal; continue with CorelDRAW automation.
Related skills
All-in-one PDF workflow for document tasks.
Convert drawio/diagrams.net flowchart and diagram files into self-contained HTML pages with embedded SVG rendering. Use when the user uploads or mentions a .drawio file and wants to convert it to HTML, view it in a browser, or share it as a web page. Triggers on phrases like "drawio转html", "流程图转网页",
Turn images into editable business documents.
Turn Word documents into polished PDFs.
Create, analyze, proofread, and modify Office documents (.docx, .xlsx, .pptx) using the officecli CLI tool. Use when the user wants to create, inspect, check...