Skip to main content

Pure-Python cross-platform parser for Vexy Lines .lines vector art files

Project description

vexy-lines-py

Parse Vexy Lines .lines vector art files in pure Python — no app, no macOS, no heavy dependencies.

Install

pip install vexy-lines-py

Python 3.11+. Runtime dependency: loguru only.

Quick start

from vexy_lines import parse, GroupInfo, LayerInfo

doc = parse("artwork.lines")
print(doc.caption, doc.dpi)          # "My Art"  300
print(doc.props.width_mm, "x", doc.props.height_mm, "mm")

# Walk the layer tree
for node in doc.groups:
    if isinstance(node, GroupInfo):
        for child in node.children:
            if isinstance(child, LayerInfo):
                for fill in child.fills:
                    p = fill.params
                    print(p.fill_type, p.color, f"interval={p.interval}")
                    # "linear"  "#1a2b3c"  interval=2.5

# Embedded source image (JPEG)
if doc.source_image_data:
    open("source.jpg", "wb").write(doc.source_image_data)

# Embedded preview image (PNG)
if doc.preview_image_data:
    open("preview.png", "wb").write(doc.preview_image_data)

Convenience wrappers for image extraction:

from vexy_lines import extract_source_image, extract_preview_image

extract_source_image("artwork.lines", "source.jpg")
extract_preview_image("artwork.lines", "preview.png")

API

parse(path) -> LinesDocument

Parse a .lines file and return a fully populated LinesDocument.

  • FileNotFoundError — path does not exist
  • xml.etree.ElementTree.ParseError — file is not valid XML

extract_source_image(path, output) -> Path

Parse and save the embedded JPEG source image to output. Raises ValueError if no source image is present.

extract_preview_image(path, output) -> Path

Parse and save the embedded PNG preview to output. Raises ValueError if no preview is present.

Types

Type Key attributes
LinesDocument caption, version, dpi, props, groups, source_image_data, preview_image_data
DocumentProps width_mm, height_mm, dpi, thickness_min/max, interval_min/max
GroupInfo caption, object_id, expanded, `children: list[GroupInfo
LayerInfo caption, object_id, visible, mask, fills: list[FillNode], grid_edges
FillNode xml_tag, caption, params: FillParams, object_id
FillParams fill_type, color, interval, angle, thickness, smoothness, uplimit, downlimit, multiplier, dispersion, shear, raw
MaskInfo mask_type, invert, tolerance

FillParams.raw holds every original XML attribute, including algorithm-specific keys not promoted to named fields.

Colors are normalised to #RRGGBB (opaque) or #RRGGBBAA. The raw Vexy Lines #AARRGGBB encoding is converted automatically.

Fill types

14 algorithms are recognised in FillParams.fill_type:

Value Algorithm
linear Parallel straight lines
circular Concentric circles
trace Free-curve strokes following image contours
spiral Archimedean spirals
wave Sine-wave strokes
radial Lines radiating from a centre point
halftone Halftone dot/line patterns
scribble Random scribble-style strokes
fractals Fractal-branching strokes
handmade Sketch-style handmade strokes
peano Peano space-filling curves
sigmoid Sigmoid-shaped strokes
trace_area Area-trace fill
source_strokes Strokes derived from the source image

The mapping from XML tags to these names is available as FILL_TAG_MAP. The full set of recognised tags is FILL_TAGS.

Full documentation

Read the docs for the complete API reference, file format specification, and more examples.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vexy_lines_py-1.0.6.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vexy_lines_py-1.0.6-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file vexy_lines_py-1.0.6.tar.gz.

File metadata

  • Download URL: vexy_lines_py-1.0.6.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vexy_lines_py-1.0.6.tar.gz
Algorithm Hash digest
SHA256 227f3a9f6eebcc4ff60135a3d0b4b09572198f237c6b384c68124447f6da55b3
MD5 40bb2abb1ec1a37c155ddb628b685b10
BLAKE2b-256 d2af85ac1d2b90e8bc9c0f325a4bcd07b741891b0ed9a92eff00b1304f5a063a

See more details on using hashes here.

File details

Details for the file vexy_lines_py-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: vexy_lines_py-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vexy_lines_py-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9396c0c9219670f15d0ba02eebc9ae9b3bebf368481e065939fb3dd760e9562d
MD5 8e9378485757c38700ff7fa0838f87f3
BLAKE2b-256 02a01ed6dd2a5a05e467e22198b3deeeaa6642cf68639d6ff63d7fa4998b7694

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page