https://github.com/immstudios/nxcg
Cairo, Pango and PIL based graphics library
https://github.com/immstudios/nxcg
Last synced: 12 months ago
JSON representation
Cairo, Pango and PIL based graphics library
- Host: GitHub
- URL: https://github.com/immstudios/nxcg
- Owner: immstudios
- License: gpl-3.0
- Created: 2019-04-09T07:47:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T21:23:38.000Z (almost 6 years ago)
- Last Synced: 2025-01-25T23:45:00.445Z (over 1 year ago)
- Language: Python
- Size: 26.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NXCG
====
This library combines power of PIL (or Pillow), PyCairo and Pango and focuses on
2d graphics for broadcast applications.
## Installation
```bash
apt install -y python3 python3-pip
apt install -y python3-pil python3-cairo gir1.2-gtk-3.0 python3-gi-cairo
pip3 install nxtools
```
## Usage
Hello world
```python
from nxcg import *
cg = CG(1920, 1080)
cg.text("Hello World!", pos=(100,100), color="#cc0000", font="Sans 36")
cg.save("hello.png")
```
## Color presets
| Color | Name | Color | Name | Color | Name |
|-------|------|-------|------|-------|------|
|  | iron |  | graphite |  | graphite dark |
|  | steel |  | gold |  | cyan |
|  | orange |  | red |  | green |
|  | blue |  | yellow |  | white |
|  | black |  | black glass 60 |  | black glass 65 |
|  | black glass 70 |  | black glass 75 |  | black glass 80 |
|  | logo gray |  | living coral |  | ultra violet |
|  | greenery |  | rose quartz |  | serenity |
|  | marsala |  | radiant orchid |  | emerald |
|  | tangerine |  | honeysuckle |  | turquoise |
|  | mimosa |  | blue iris |  | pepper |
|  | sand |
## Documentation
Code is quite self-documenting see `nxcg/core.py` for build-ins
and `plugins/test_plugin.py` to see how to write your own plug-ins :-)
See NXTV sources for more advanced usage tips and underlying libraries documentation:
- http://www.pygtk.org/pygtk2reference/class-pangolayout.html
- https://developer.gnome.org/pygtk/stable/pango-markup-language.html