• Stars
    star
    164
  • Rank 230,032 (Top 5 %)
  • Language
    Python
  • Created almost 15 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

concatenate SVG files

svg_stack - combine multiple SVG elements into a single SVG element

Overview

svg_stack combines multiple SVG elements into a single SVG element. It can be called from the command line (less flexible) or called from the Python interface (more flexible).

This tool primarily exists to automatically composite SVG files into a single SVG file that remains compatible with Inkscape. If compatibility with Inkscape is not required, one can create an svg file with multiple, nested <svg> elements. Inkscape, however, doesn't seem to handle nested <svg> elements particularly well. Thus, this tool was born.

Example command line usage

For example, given the files red_ball.svg and blue_triangle.svg:

svg_stack.py --direction=h --margin=100 red_ball.svg blue_triangle.svg > shapes.svg

will stack them horizontally with a 100 px margin between them. The result will be in a file called shapes.svg.

Example Python usage

A Qt like API provides more advanced layout capabilities. For example:

#!/usr/bin/env python

import svg_stack as ss

doc = ss.Document()

layout1 = ss.HBoxLayout()
layout1.addSVG('red_ball.svg',alignment=ss.AlignTop|ss.AlignHCenter)
layout1.addSVG('blue_triangle.svg',alignment=ss.AlignCenter)

layout2 = ss.VBoxLayout()

layout2.addSVG('red_ball.svg',alignment=ss.AlignCenter)
layout2.addSVG('red_ball.svg',alignment=ss.AlignCenter)
layout2.addSVG('red_ball.svg',alignment=ss.AlignCenter)
layout1.addLayout(layout2)

doc.setLayout(layout1)

doc.save('qt_api_test.svg')

See also

Meta-data

Command-line usage

Usage: svg_stack.py FILE1 [FILE2] [...] [options]

concatenate SVG files

This will concatenate FILE1, FILE2, ... to a new svg file printed to
stdout.



Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  --margin=MARGIN       size of margin (in any units, px default)
  --direction=DIRECTION
                        horizontal or vertical (or h or v)

More Repositories

1

stdeb

produce Debian packages from Python packages
Python
496
star
2

bui-backend

backend server for Browser User Interface (BUI)
Rust
89
star
3

matplotlib-ancient

python 2D plotting library
Python
24
star
4

nucleo-h743zi

Examples programs for nucleo-h743zi board
Rust
17
star
5

adskalman

Kalman filtering routine in Python/numpy
Python
9
star
6

burst_s5

standards-compliant HTML slideshows with HTML5 video and animated graphics from ReStructuredText and Inkscape
Python
7
star
7

collective.buildbot

A set of zc.buildout recipes and support for declarative configuration for Buildbot
6
star
8

async-change-tracker

reactive change notifications using futures
Rust
5
star
9

framed-serial

Add frames to serial connections. Useful for embedded devices. Can be built with no_std.
Rust
5
star
10

pinpoint

a Python library for N-view camera calibration
Python
5
star
11

raii-change-tracker

tracks changes to data and notifies listeners
Rust
4
star
12

ptpd

Debian packaging for ptpd (precision time protocol daemon)
C
4
star
13

ipp-sys

rust bindings to Intel IPP
Rust
3
star
14

micromanager1.3

open source microscopy software
C++
3
star
15

txtraits

twisted traits, networked traits using twisted
Python
3
star
16

mcclibhid

C
2
star
17

pairs2groups

find homogeneous groups of items based on pairwise information
Python
2
star
18

static_site_index

build directory index pages for static sites
Python
2
star
19

motmot-camtrig

camera trigger firmware and Python host code for the Motmot project
C
2
star
20

wjul

Python
2
star
21

avbin-debian

debian packaging for avbin
C
2
star
22

nalgebra-mvn

Multivariate normal distribution using nalgebra.
Rust
2
star
23

remote_traits

multi-process support for Enthought Traits
Python
2
star
24

PyUniversalLibrary

data acquisition library wrapper for Universal Library
Python
2
star
25

teensy_loader_cli

command-line bootloader for PJRC Teensy boards
C
1
star
26

data_tracker

Track changes to data and notify listeners
Rust
1
star
27

mplsizer

unofficial mirror of mplsizer toolkit for Matplotlib
Python
1
star
28

libdc1394-sys

FFI bindings for libdc1394
Rust
1
star
29

yew-tincture

Rust
1
star
30

lapacke-static

Statically compiled LAPACKE library
C
1
star