Overview
This is a library and tool that streamlines applying component images to a template image. A config is provided that defines boundaries of the regions within the template image to apply the component images to.
There is strictness to prevent overlapping configs and additional support for determining coverage of the template image.
Masking is not current supported.
Installation
$ sudo pip install image_template_overlay_apply
You may choose to clone the project instead:
$ git clone https://github.com/dsoprea/image_template_overlay_apply.git
$ cd image_template_overlay_apply
$ sudo pip install -e .
Library Usage
It is recommended that you use the source-code of the tool as a roadmap to using the library. There is also excellent unit-test coverage that may be used for guidance.
Tool Usage
The tool has full command-line documentation. You can also read the template from STDIN and write the output image to STDOUT (using the same format as the input).
Example
Using example data in assets/example.
Config:
{
"placeholders": {
"top-left": {
"left": 0,
"top": 0,
"width": 50,
"height": 100
},
"top-right": {
"left": 50,
"top": 0,
"width": 50,
"height": 100
},
"middle-center": {
"left": 0,
"top": 100,
"width": 100,
"height": 100
},
"bottom-center": {
"left": 0,
"top": 200,
"width": 100,
"height": 100
}
}
}
Running:
$ template_image_apply_overlays \
assets/example/layout.json \
--template-filepath assets/example/template.png \
--component-filepath top-left assets/example/top_left.png \
--component-filepath top-right assets/example/top_right.png \
--component-filepath middle-center assets/example/middle_center.png \
--component-filepath bottom-center assets/example/bottom_center.png \
--output-filepath /tmp/output.png
Applying: [top-left] [top_left.png]
Applying: [top-right] [top_right.png]
Applying: [middle-center] [middle_center.png]
Applying: [bottom-center] [bottom_center.png]
Writing.
The output will look like:
Tests
To run the unit-tests:
$ nose2 -v tests
Metadata
Release files for image-template-overlay-apply 0.0.2
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 |
|---|---|---|---|---|
| image_template_overlay_apply-0.0.2.tar.gz | 6.4 kB | Without provenance | Details for image_template_overlay_apply-0.0.2.tar.gz |
Release files / image_template_overlay_apply-0.0.2.tar.gz
| Download URL | image_template_overlay_apply-0.0.2.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8a930ea4231035aa291acbdd9aea74065faaaeefb8ac23f3bce372512123912
|
|
BLAKE2b-256 checksum How to use checksums |
a45ed1944a9ca9e8d635f87104442031df7243f25385f1ff08af5f260d9274ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.5.2
|
Security for image-template-overlay-apply 0.0.2
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.