https://github.com/iori2333/render
A Python library for rendering images
https://github.com/iori2333/render
Last synced: 6 months ago
JSON representation
A Python library for rendering images
- Host: GitHub
- URL: https://github.com/iori2333/render
- Owner: iori2333
- License: lgpl-2.1
- Created: 2023-01-13T14:33:29.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T18:03:28.000Z (over 2 years ago)
- Last Synced: 2023-10-23T13:35:48.204Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 1.04 MB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Render
## Overview
CSS-style rendering support for Python.
## Example
```python
from render import Image, FixedContainer, RenderImage, Palette, JustifyContent, Alignmentif __name__ == "__main__":
im1 = RenderImage.empty(100, 100, color=Palette.BLUE)
im2 = RenderImage.empty(50, 50, color=Palette.GREEN)
im3 = RenderImage.empty(200, 200, color=Palette.RED)
el1, el2, el3 = map(Image.from_image, (im1, im2, im3))
container = FixedContainer.from_children(
width=500,
height=300,
children=[el1, el2, el3],
alignment=Alignment.CENTER,
justify_content=JustifyContent.SPACE_AROUND,
)
out_im = container.render()
out_im.save("out.png")
```This will generate [out.png](assets/out.png):
