creasepattern
Basic tools to work with Origami Crease Patterns.
Usage
Install with pip
pip install creasepattern
This installs the crease executable:
Usage:
crease creasepattern.cp image.png
crease creasepattern.cp image.svg
cp2png(infile, outfile, size=2048, margin=20, aa_scale=4)
Convert .cp files to .png
Size of the output file is scaled to the given size, either horizonally or vertically, whichever is larger.
aa_scale is used to anti alias. Set to 1 to disable anti aliasing.
from creasepattern import cp2png
cp2png('file.cp', 'file.png')
cp2svg(infile, outfile, margin=10)
Convert .cp files to .svg
from creasepattern import cp2svg
cp2svg('file.cp', 'file.svg')
opx2png(infile, outfile, size=2048, margin=20, aa_scale=4)
Convert Oripa .opx to .png
opx2svg(infile, outfile, margin=10)
Convert Oripa .opx to .svg
opx2cp(infile, outfile)
Convert Oripa .opx to .cp
orh2png(infile, outfile, size=2048, margin=20, aa_scale=4)
Convert Orihime .orh to .png
orh2svg(infile, outfile, margin=10)
Convert Orihime .orh to .svg.
Only supports exporting normal lines, so no folded bases, aux circles and non-interfering aux lines.
orh2cp(infile, outfile)
Convert Orihime .orh to .cp.
from_cp(infile: str) -> Cp
Convert .cp to a Cp object.
from_cp_str(lines: list[str]) -> Cp
Convert string lines in .cp format to a Cp object.
from_opx(infile: str) -> Cp
Convert Oripa .opx to a Cp object.
from_orh(infile: str) -> Cp
Convert Orihime .orh to a Cp object
to_svg(cp: Cp) -> str
Convert a Cp object to an svg string
to_png(cp: Cp) -> Image
Convert a Cp object to a PIL Image
to_cp(cp : Cp) -> str`
Convert a Cp object to a .cp file string.
Roadmap
- (Must) Make size of output configurable
- (Must) Make edge types configurable
- (Could) Support more filetypes
Metadata
Release files for creasepattern 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| creasepattern-0.0.12.tar.gz | 8.7 kB | Without provenance | Details for creasepattern-0.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| creasepattern-0.0.12-py3-none-any.whl | Python 3 | none | any | Details for creasepattern-0.0.12-py3-none-any.whl |
Total release size: 20.6 kB
Release files / creasepattern-0.0.12.tar.gz
| Download URL | creasepattern-0.0.12.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9a01836f7d439ade148af4da4ca946797d77a73977328f7c1d97617d8346071
|
|
BLAKE2b-256 checksum How to use checksums |
a79452871acbf57536c71897f0bd01d05d91168be9610a3b734e787e0741f01e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
|
Release files / creasepattern-0.0.12-py3-none-any.whl
| Download URL | creasepattern-0.0.12-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bfc51d4bc982ed53a38f2ea0a14cbf18c21da748490b82834d77cd1ee1ab6a4
|
|
BLAKE2b-256 checksum How to use checksums |
c63c9d74d6d14e02d9bc4054464cd9965faba35d3d4a61432767c9f76054abdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
|
Security for creasepattern 0.0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.