Python Lottie
=============
A Python framework to work with Lottie files and Telegram animated stickers.
Quick start
-----------
This section describes some common things you might want to do without having
to read the whole README
### Installation
pip install lottie
### Converting into images
This package provide the script `lottie_convert.py`, it's precise location
depends on how you installed python-lottie.
For PNG, GIF, and Webp you have to install `cairosvg` and `pillow`.
To render a still image:
lottie_convert.py input_file.json output_file.png --frame 30
To render an animated image (GIF or WebP):
lottie_convert.py input_file.json output_file.webp
A list of supported formats is described in the section "Supported Formats" below.
### Turning GIF and such into animations
The lottie format is for vector graphics, this means converting raster images
usually doesn't work too well.
That said, python-lottie does support a few different algorithms to import
raster images, the process is a bit slow for larger images but use it with caution.
To use the potrace vectorization library, install the extras tagged as "trace".
Once set up, just invoke `lottie_convert.py` using the vectorization algorithm
lottie_convert.py input_file.gif output_file.json --bmp-mode trace
For pixel art, you can use the `pizel` algorithm, which doesn't require potrace
lottie_convert.py input_file.gif output_file.json --bmp-mode pixel
If you are ok with keeping raster images as such, you can use the default mode
lottie_convert.py input_file.gif output_file.json
### Converting Telegram animated stickers (tgs)
This format is natively supported by python lottie, but telegram doesn't
support all of the features supported by lottie
(see the section labeled "Supported After Effects Features" for details).
When converting from tgs, nothing special is needed as it's handled as a lottie animation.
lottie_convert.py AnimatedSticker.tgs output_file.webp
But when converting into animated stickers, you might end up with a file that
Telegram doesn't recognize. To help with this, by default `lottie_convert.py`
will scale the animation to be the right size and framerate.
It will also print out any warnings related to unsupported features.
Everything else works like any other conversion:
lottie_convert.py input_file.json output_file.tgs
If you want to see the same warnings for an existing tgs file use `tgs_check.py`
tgs_check.py AnimatedSticker.tgs
### Creating animations from scratch
See the examples at https://mattbas.gitlab.io/python-lottie/examples.html
and read the available lottie objects at https://mattbas.gitlab.io/python-lottie/group__Lottie.html#details
Features
--------
Here is a list of features of the lottie python framework:
* Loading compressed TGS and uncompressed lottie JSON
* Manipulation of lottie objects
* Simple animation presets (eg: shake, linear bounce)
* Bezier path animations (eg: follow path, making paths appear and disappear)
* Wave distortion animation (eg: for flags)
* Pseudo-3D rotations
* Animation easing functions
* Inverse Kinematic solver
* Pretty printing and comparison of lottie files
* Rendering text as shapes
## Supported Formats
| Format | Import | Import Animated | Export | Export Animated |
|-----------|-----------|-------------------|-----------|-------------------|
| lottie | 👍 | 👍 | 👍 | 👍 |
| tgs | 👍 | 👍 | 👍 | 👍 |
| SVG | 👍 | 👍 | 👍 | 👍 |
| SVGz | 👍 | 👍 | 👍 | 👍 |
| PNG | 👍 | 👍[^frames] | 👍 | ⛔️ |
| Synfig | 👍 | 👍 | 👍 | 👍 |
| WebP | 👍 | 👍 | 👍 | 👍 |
| dotLottie | 👍 | 👍 | 👍 | 👍 |
| PostScript| ⛔️ | ⛔️ | 👍 | ⛔️ |
| PDF | ⛔️ | ⛔️ | 👍 | ⛔️ |
| BMP | 👍 | 👍[^frames] | ⛔️ | ⛔️ |
| GIF | 👍 | 👍 | 👍 | 👍 |
| TIFF | 👍 | 👍 | 👍 | 👍 |
| MP4 | ⛔️ | ⛔️ | 👍 | 👍 |
| AVI | ⛔️ | ⛔️ | 👍 | 👍 |
| WebM | ⛔️ | ⛔️ | 👍 | 👍 |
| HTML | ⛔️ | ⛔️ | 👍 | 👍 |
| Blender | 👍[^blend]| 👍[^blend] | ⛔️ | ⛔️ |
| Krita | 👍 | ⛔️ | ⛔️ | ⛔️ |
[^frames]: Importing multiple images as frames
[^blend]: Conversion available as a Blender addon
Scripts
-------
python-lottie provides several scripts to convert or manage lottie animations.
For full documentation see https://mattbas.gitlab.io/python-lottie/scripts.html
The main one is `lottie_convert.py`, which can be used to convert between the supported formats.
There is also the script `lottie_gui.py` which provides a graphical interface for lottie playback.
Installation
------------
### Downloads
The packages for the various applications listed below can be downloaded from here:
* [Releases](https://gitlab.com/mattbas/python-lottie/-/releases)
* [Development Snapshot](https://mattbas.gitlab.io/python-lottie/downloads.html)
### Synfig
There's a Synfig studio plugin to export telegram stickers.
To install, just copy (or symlink) ./addons/synfig/pylot-exporter
into the synfig plugin directory.
You might have to copy ./lib/lottie in there as well.
### Inkscape
There are some import/export extensions for inkscape.
Just copy (or symlink) the files under ./addons/inkscape to the inkscape extension
directory.
On my system that's ~/.config/inkscape/extensions/ but you can double check from
Inkscape: Edit > Preferences... > System > User extensions
Note that the extensions require Python 3.
If they are run with a python 2 interpreter, they will try to run themselves using `python3`.
They also need the lottie framework to be in the python path, otherwise you can manually
set the path on the import/export dialogues.
See also https://inkscape.org/~mattia.basaglia/%E2%98%85tgslottie-importexport
### Blender
There are some export addons for blender.
Copy (or symlink) the files under ./addons/blender to the Blender extension
directory.
On my system that's ~/.config/blender/2.80/scripts/addons/ you can check available
paths through the Blender Python console:
import addon_utils; print(addon_utils.paths())
You can also install the addon from Blender using the zipfile created by `make`.
### Pip
You can install from pypi:
pip install lottie
from git:
pip install git+https://gitlab.com/mattbas/python-lottie.git@master
for the source directory:
pip install /path/to/the/sources # this is the path where setup.py is located
Requirements
------------
Python 3.
### Optional Requirements
In order to provide lean installations, this framework doesn't have dependencies
for its core functionality.
To add support for extra formats or advanced functionality, you can install
additional packages.
These requirements are declared as extra in the Pypi package,
follows a table listing dependencies and features
| Packages | Extra | Feature |
|-----------------------------------------------|-------|-----------------------------------------------------------|
| `pillow` | images| To load image assets |
| `glaxnimate` | PNG | To export PNG |
| `cairosvg` | PDF | To export PNG / PDF / PS |
| `glaxnimate`, `pillow` | GIF | To export GIF and animated WebP |
| `fonttools` | text | To render text as shapes |
| `grapheme` | emoji | Adding emoji support to text rendering |
| `cairosvg`, `numpy`, Python OpenCV 2 | video | To export video |
| `glaxnimate` | trace | To convert raster images into vectors |
| `QScintilla` | GUI | Grafical user interface utilities |
| `coverage` | | To show unit test coverage, used optionally by `test.sh` |
If installing from pip, you can install optional requirements like so:
pip install lottie[GIF]
The above example will ensure `cairosvg` and `pillow` are installed.
For more details see https://pip.pypa.io/en/latest/reference/pip_install/#examples.
For convenience, an additional extra requirements is defined,
so you can install all dependencies at once:
pip install lottie[all]
If you are using python-lottie from source you can run
pip install -r requirements.txt
Which will install all the requirements (except for pypotrace, as that package has some issues)
Telegram Animated Stickers
--------------------------
I had to reverse engineer the format because Telegram couldn't be bothered
providing the specs.
A TGS file is a gzip compressed JSON, the JSON data is described here:
https://mattbas.gitlab.io/python-lottie/group__Lottie.html#lottie_json
### Making your own exporters converters
#### Lottie format
If you can get the source image into lottie format, that's 90% of the work done.
I've created Python classes based the format schema and after effects documentation, which
output the correct json. Eg:
foo = lottie.Animation()
# ...
json.dump(foo.to_dict(), output_file)
I'm also creating a proper documentation for the format, see:
https://mattbas.gitlab.io/tgs/group__Lottie.html#details
#### TGS changes
Nothing major, just ensure the root JSON object has `tgs: 1`
#### Gzipping
The tgs file is the JSON described above compressed into a gzip,
and renamed to .tgs
License
-------
AGPLv3+ https://www.gnu.org/licenses/agpl-3.0.en.html
Credits
-------
Copyright 2019 (C) Mattia Basaglia
Links
-----
### Documentation
https://mattbas.gitlab.io/python-lottie/index.html
### Code
https://gitlab.com/mattbas/python-lottie/
### Chat
https://t.me/tgs_stuff
### Download
https://mattbas.gitlab.io/python-lottie/downloads.html
Here you can download packages for pip, blender, and inkscape before they are released.
These packages always have the latest features but they might be unstable.
### Issues
You can report any issue in the tracker on gitlab:
https://gitlab.com/mattbas/python-lottie/-/issues
Supported After Effects Features
--------------------------------
Compare with http://airbnb.io/lottie/#/supported-features
### Legend
* 👍 Supported
* ❔ Unknown / untested
* ⛔️ Not supported
* **python-lottie** refers to this framework in general
* **Telegram** refers to features supported by telegram animated stickers
* **SVG** refers to the exported SVG images from this framework,
features supported here will also reflect on other formats (such as video, png, and similar)
Telegram doesn't support everything in the Lottie format.
https://core.telegram.org/animated_stickers lists some things that are unsupported
but what is listed there isn't correct.
There are several things marked as unsupported in telegram animated stickers that are actually supported.
| **Shapes** | **python-lottie** | **Telegram** | **SVG** |
|----------------------------------|-------------------|------------------|---------|
| Shape | 👍 | 👍 | 👍 |
| Ellipse | 👍 | 👍 | 👍 |
| Rectangle | 👍 | 👍 | 👍 |
| Rounded Rectangle | 👍 | 👍 | 👍 |
| Polystar | 👍 | 👍[^unsupported] | 👍 |
| Group | 👍 | 👍 | 👍 |
| Trim Path (individually) | 👍 | 👍 | 👍 |
| Trim Path (simultaneously) | 👍 | 👍 | 👍 |
| **Fills** | **python-lottie** | **Telegram** | **SVG** |
| Color | 👍 | 👍 | 👍 |
| Opacity | 👍 | 👍 | 👍 |
| Radial Gradient | 👍 | 👍 | 👍 |
| Linear Gradient | 👍 | 👍 | 👍 |
| Fill Rule | 👍 | 👍 | 👍 |
| **Strokes** | **python-lottie** | **Telegram** | **SVG** |
| Color | 👍 | 👍 | 👍 |
| Opacity | 👍 | 👍 | 👍 |
| Width | 👍 | 👍 | 👍 |
| Line Cap | 👍 | 👍 | 👍 |
| Line Join | 👍 | 👍 | 👍 |
| Miter Limit | 👍 | 👍 | 👍 |
| Dashes | 👍 | 👍 | 👍 |
| Gradient | 👍 | 👍[^unsupported] | 👍 |
| **Transforms** | **python-lottie** | **Telegram** | **SVG** |
| Position | 👍 | 👍 | 👍 |
| Position (separated X/Y) | 👍 | 👍 | 👍 |
| Scale | 👍 | 👍 | 👍 |
| Rotation | 👍 | 👍 | 👍 |
| Anchor Point | 👍 | 👍 | 👍 |
| Opacity | 👍 | 👍 | 👍 |
| Parenting | 👍 | 👍 | 👍 |
| Skew | 👍 | ⛔️[^bug] | 👍 |
| Auto Orient | 👍 | 👍[^unsupported] | 👍 |
| **Interpolation** | **python-lottie** | **Telegram** | **SVG** |
| Linear Interpolation | 👍 | 👍 | 👍 |
| Bezier Interpolation | 👍 | 👍 | 👍 |
| Hold Interpolation | 👍 | 👍 | 👍 |
| Spatial Bezier Interpolation | 👍 | 👍 | 👍 |
| Rove Across Time | ⛔️ | ⛔️[^untested] | ⛔️ |
| **Masks** | **python-lottie** | **Telegram** | **SVG** |
| Mask Path | 👍 | 👍[^unsupported] | 👍 |
| Mask Opacity | 👍 | 👍[^unsupported] | 👍 |
| Add | 👍 | 👍[^unsupported] | ⛔️ |
| Subtract | 👍 | 👍[^unsupported] | ⛔️ |
| Intersect | 👍 | 👍[^unsupported] | 👍 |
| Lighten | 👍 | 👍[^unsupported] | ⛔️ |
| Darken | 👍 | 👍[^unsupported] | ⛔️ |
| Difference | 👍 | 👍[^unsupported] | ⛔️ |
| Expansion | 👍 | 👍[^unsupported] | ⛔️ |
| Feather | 👍 | 👍[^unsupported] | ⛔️ |
| **Mattes** | **python-lottie** | **Telegram** | **SVG** |
| Alpha Matte | 👍 | ⛔️[^dok] | 👍 |
| Alpha Inverted Matte | 👍 | ⛔️[^dok] | ⛔️ |
| Luma Matte | 👍 | ⛔️[^dok] | 👍 |
| Luma Inverted Matte | 👍 | ⛔️[^dok] | ⛔️ |
| **Merge Paths** | **python-lottie** | **Telegram** | **SVG** |
| Merge | ⛔️ | ⛔️[^untested] | ⛔️ |
| Add | ⛔️ | ⛔️[^untested] | ⛔️ |
| Subtract | ⛔️ | ⛔️[^untested] | ⛔️ |
| Intersect | ⛔️ | ⛔️[^untested] | ⛔️ |
| Exclude Intersection | ⛔️ | ⛔️[^untested] | ⛔️ |
| **Layer Effects** | **python-lottie** | **Telegram** | **SVG** |
| Fill | 👍 | ⛔️ | ⛔️ |
| Stroke | 👍 | ⛔️ | ⛔️ |
| Tint | 👍 | ⛔️ | ⛔️ |
| Tritone | 👍 | ⛔️ | ⛔️ |
| Levels Individual Controls | 👍 | ⛔️ | ⛔️ |
| **Text** [^text] | **python-lottie** | **Telegram** | **SVG** |
| Glyphs | 👍 | ⛔️ | ⛔️ |
| Fonts | 👍 | ⛔️ | ⛔️ |
| Transform | 👍 | ⛔️ | ⛔️ |
| Fill | 👍 | ⛔️ | 👍 |
| Stroke | 👍 | ⛔️ | ⛔️ |
| Tracking | ⛔️ | ⛔️ | ⛔️ |
| Anchor point grouping | ⛔️ | ⛔️ | ⛔️ |
| Text Path | ⛔️ | ⛔️ | ⛔️ |
| Per-character 3D | ⛔️ | ⛔️ | ⛔️ |
| Range selector (Units) | ⛔️ | ⛔️ | ⛔️ |
| Range selector (Based on) | ⛔️ | ⛔️ | ⛔️ |
| Range selector (Amount) | ⛔️ | ⛔️ | ⛔️ |
| Range selector (Shape) | ⛔️ | ⛔️ | ⛔️ |
| Range selector (Ease High) | ⛔️ | ⛔️ | ⛔️ |
| Range selector (Ease Low) | ⛔️ | ⛔️ | ⛔️ |
| Range selector (Randomize order) | ⛔️ | ⛔️ | ⛔️ |
| expression selector | ⛔️ | ⛔️ | ⛔️ |
| **Other** | **python-lottie** | **Telegram** | **SVG** |
| Expressions | ⛔️ | ⛔️[^untested] | ⛔️ |
| Images | 👍 | ⛔️ | 👍 |
| Precomps | 👍 | 👍 | 👍 |
| Time Stretch | 👍 | ⛔️ | ⛔️ |
| Time remap | 👍 | ⛔️[^dok] | 👍 |
| Markers | ⛔️ | ⛔️[^untested] | ⛔️ |
| 3D Layers | 👍 | ⛔️[^untested] | ⛔️ |
| Repeaters | 👍 | 👍[^unsupported] | 👍 |
| Solids | 👍 | 👍[^unsupported] | 👍 |
[^text]: Note that **python-lottie** offers an alternative to lottie text layers, and can render
text as shapes, so that is supported everywhere
[^untested]: Marked as unsupported but I haven't tested it
[^bug]: Not listed as unsupported, maybe a bug?
[^dok]: Works on telegram desktop
[^unsupported]: Marked as unsupported
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/mattbas/python-lottie/",
"name": "lottie",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": null,
"keywords": "telegram stickers tgs lottie svg animation",
"author": "Mattia Basaglia",
"author_email": "mattia.basaglia@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0e/57/bb9b58bb7279be90e2ebce9dd6d4a603448fa22185558844e61bd916b170/lottie-0.7.1.tar.gz",
"platform": null,
"description": "Python Lottie\n=============\n\nA Python framework to work with Lottie files and Telegram animated stickers.\n\n\nQuick start\n-----------\n\nThis section describes some common things you might want to do without having\nto read the whole README\n\n### Installation\n\n pip install lottie\n\n### Converting into images\n\nThis package provide the script `lottie_convert.py`, it's precise location\ndepends on how you installed python-lottie.\n\nFor PNG, GIF, and Webp you have to install `cairosvg` and `pillow`.\n\nTo render a still image:\n\n lottie_convert.py input_file.json output_file.png --frame 30\n\n\nTo render an animated image (GIF or WebP):\n\n lottie_convert.py input_file.json output_file.webp\n\n\nA list of supported formats is described in the section \"Supported Formats\" below.\n\n\n### Turning GIF and such into animations\n\nThe lottie format is for vector graphics, this means converting raster images\nusually doesn't work too well.\n\nThat said, python-lottie does support a few different algorithms to import\nraster images, the process is a bit slow for larger images but use it with caution.\n\nTo use the potrace vectorization library, install the extras tagged as \"trace\".\n\nOnce set up, just invoke `lottie_convert.py` using the vectorization algorithm\n\n lottie_convert.py input_file.gif output_file.json --bmp-mode trace\n\nFor pixel art, you can use the `pizel` algorithm, which doesn't require potrace\n\n lottie_convert.py input_file.gif output_file.json --bmp-mode pixel\n\nIf you are ok with keeping raster images as such, you can use the default mode\n\n lottie_convert.py input_file.gif output_file.json\n\n### Converting Telegram animated stickers (tgs)\n\nThis format is natively supported by python lottie, but telegram doesn't\nsupport all of the features supported by lottie\n(see the section labeled \"Supported After Effects Features\" for details).\n\nWhen converting from tgs, nothing special is needed as it's handled as a lottie animation.\n\n lottie_convert.py AnimatedSticker.tgs output_file.webp\n\nBut when converting into animated stickers, you might end up with a file that\nTelegram doesn't recognize. To help with this, by default `lottie_convert.py`\nwill scale the animation to be the right size and framerate.\nIt will also print out any warnings related to unsupported features.\nEverything else works like any other conversion:\n\n lottie_convert.py input_file.json output_file.tgs\n\nIf you want to see the same warnings for an existing tgs file use `tgs_check.py`\n\n tgs_check.py AnimatedSticker.tgs\n\n\n### Creating animations from scratch\n\nSee the examples at https://mattbas.gitlab.io/python-lottie/examples.html\nand read the available lottie objects at https://mattbas.gitlab.io/python-lottie/group__Lottie.html#details\n\n\nFeatures\n--------\n\nHere is a list of features of the lottie python framework:\n\n* Loading compressed TGS and uncompressed lottie JSON\n* Manipulation of lottie objects\n* Simple animation presets (eg: shake, linear bounce)\n* Bezier path animations (eg: follow path, making paths appear and disappear)\n* Wave distortion animation (eg: for flags)\n* Pseudo-3D rotations\n* Animation easing functions\n* Inverse Kinematic solver\n* Pretty printing and comparison of lottie files\n* Rendering text as shapes\n\n\n## Supported Formats\n\n| Format | Import | Import Animated | Export | Export Animated |\n|-----------|-----------|-------------------|-----------|-------------------|\n| lottie | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| tgs | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| SVG | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| SVGz | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| PNG | \ud83d\udc4d | \ud83d\udc4d[^frames] | \ud83d\udc4d | \u26d4\ufe0f |\n| Synfig | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| WebP | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| dotLottie | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| PostScript| \u26d4\ufe0f | \u26d4\ufe0f | \ud83d\udc4d | \u26d4\ufe0f |\n| PDF | \u26d4\ufe0f | \u26d4\ufe0f | \ud83d\udc4d | \u26d4\ufe0f |\n| BMP | \ud83d\udc4d | \ud83d\udc4d[^frames] | \u26d4\ufe0f | \u26d4\ufe0f |\n| GIF | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| TIFF | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| MP4 | \u26d4\ufe0f | \u26d4\ufe0f | \ud83d\udc4d | \ud83d\udc4d |\n| AVI | \u26d4\ufe0f | \u26d4\ufe0f | \ud83d\udc4d | \ud83d\udc4d |\n| WebM | \u26d4\ufe0f | \u26d4\ufe0f | \ud83d\udc4d | \ud83d\udc4d |\n| HTML | \u26d4\ufe0f | \u26d4\ufe0f | \ud83d\udc4d | \ud83d\udc4d |\n| Blender | \ud83d\udc4d[^blend]| \ud83d\udc4d[^blend] | \u26d4\ufe0f | \u26d4\ufe0f |\n| Krita | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n\n[^frames]: Importing multiple images as frames\n\n[^blend]: Conversion available as a Blender addon\n\n\n\nScripts\n-------\n\npython-lottie provides several scripts to convert or manage lottie animations.\nFor full documentation see https://mattbas.gitlab.io/python-lottie/scripts.html\n\nThe main one is `lottie_convert.py`, which can be used to convert between the supported formats.\n\nThere is also the script `lottie_gui.py` which provides a graphical interface for lottie playback.\n\n\n\nInstallation\n------------\n\n### Downloads\n\nThe packages for the various applications listed below can be downloaded from here:\n\n* [Releases](https://gitlab.com/mattbas/python-lottie/-/releases)\n* [Development Snapshot](https://mattbas.gitlab.io/python-lottie/downloads.html)\n\n\n### Synfig\n\nThere's a Synfig studio plugin to export telegram stickers.\nTo install, just copy (or symlink) ./addons/synfig/pylot-exporter\ninto the synfig plugin directory.\nYou might have to copy ./lib/lottie in there as well.\n\n\n### Inkscape\n\nThere are some import/export extensions for inkscape.\n\nJust copy (or symlink) the files under ./addons/inkscape to the inkscape extension\ndirectory.\nOn my system that's ~/.config/inkscape/extensions/ but you can double check from\nInkscape: Edit > Preferences... > System > User extensions\n\nNote that the extensions require Python 3.\nIf they are run with a python 2 interpreter, they will try to run themselves using `python3`.\n\nThey also need the lottie framework to be in the python path, otherwise you can manually\nset the path on the import/export dialogues.\n\nSee also https://inkscape.org/~mattia.basaglia/%E2%98%85tgslottie-importexport\n\n\n### Blender\n\nThere are some export addons for blender.\n\nCopy (or symlink) the files under ./addons/blender to the Blender extension\ndirectory.\n\nOn my system that's ~/.config/blender/2.80/scripts/addons/ you can check available\npaths through the Blender Python console:\n\n import addon_utils; print(addon_utils.paths())\n\nYou can also install the addon from Blender using the zipfile created by `make`.\n\n\n### Pip\n\nYou can install from pypi:\n\n pip install lottie\n\nfrom git:\n\n pip install git+https://gitlab.com/mattbas/python-lottie.git@master\n\nfor the source directory:\n\n pip install /path/to/the/sources # this is the path where setup.py is located\n\n\nRequirements\n------------\n\nPython 3.\n\n\n### Optional Requirements\n\nIn order to provide lean installations, this framework doesn't have dependencies\nfor its core functionality.\n\nTo add support for extra formats or advanced functionality, you can install\nadditional packages.\n\nThese requirements are declared as extra in the Pypi package,\nfollows a table listing dependencies and features\n\n\n| Packages | Extra | Feature |\n|-----------------------------------------------|-------|-----------------------------------------------------------|\n| `pillow` | images| To load image assets |\n| `glaxnimate` | PNG | To export PNG |\n| `cairosvg` | PDF | To export PNG / PDF / PS |\n| `glaxnimate`, `pillow` | GIF | To export GIF and animated WebP |\n| `fonttools` | text | To render text as shapes |\n| `grapheme` | emoji | Adding emoji support to text rendering |\n| `cairosvg`, `numpy`, Python OpenCV 2 | video | To export video |\n| `glaxnimate` | trace | To convert raster images into vectors |\n| `QScintilla` | GUI | Grafical user interface utilities |\n| `coverage` | | To show unit test coverage, used optionally by `test.sh` |\n\n\nIf installing from pip, you can install optional requirements like so:\n\n pip install lottie[GIF]\n\nThe above example will ensure `cairosvg` and `pillow` are installed.\nFor more details see https://pip.pypa.io/en/latest/reference/pip_install/#examples.\n\nFor convenience, an additional extra requirements is defined,\nso you can install all dependencies at once:\n\n pip install lottie[all]\n\nIf you are using python-lottie from source you can run\n\n pip install -r requirements.txt\n\nWhich will install all the requirements (except for pypotrace, as that package has some issues)\n\n\nTelegram Animated Stickers\n--------------------------\n\nI had to reverse engineer the format because Telegram couldn't be bothered\nproviding the specs.\n\nA TGS file is a gzip compressed JSON, the JSON data is described here:\nhttps://mattbas.gitlab.io/python-lottie/group__Lottie.html#lottie_json\n\n### Making your own exporters converters\n\n#### Lottie format\n\nIf you can get the source image into lottie format, that's 90% of the work done.\n\nI've created Python classes based the format schema and after effects documentation, which\noutput the correct json. Eg:\n\n foo = lottie.Animation()\n # ...\n json.dump(foo.to_dict(), output_file)\n\nI'm also creating a proper documentation for the format, see:\nhttps://mattbas.gitlab.io/tgs/group__Lottie.html#details\n\n#### TGS changes\n\nNothing major, just ensure the root JSON object has `tgs: 1`\n\n#### Gzipping\n\nThe tgs file is the JSON described above compressed into a gzip,\nand renamed to .tgs\n\n\nLicense\n-------\n\nAGPLv3+ https://www.gnu.org/licenses/agpl-3.0.en.html\n\n\nCredits\n-------\n\nCopyright 2019 (C) Mattia Basaglia\n\n\nLinks\n-----\n\n### Documentation\n\nhttps://mattbas.gitlab.io/python-lottie/index.html\n\n### Code\n\nhttps://gitlab.com/mattbas/python-lottie/\n\n### Chat\n\nhttps://t.me/tgs_stuff\n\n### Download\n\nhttps://mattbas.gitlab.io/python-lottie/downloads.html\n\nHere you can download packages for pip, blender, and inkscape before they are released.\nThese packages always have the latest features but they might be unstable.\n\n### Issues\n\nYou can report any issue in the tracker on gitlab:\n\nhttps://gitlab.com/mattbas/python-lottie/-/issues\n\n\nSupported After Effects Features\n--------------------------------\n\nCompare with http://airbnb.io/lottie/#/supported-features\n\n### Legend\n\n * \ud83d\udc4d Supported\n * \u2754 Unknown / untested\n * \u26d4\ufe0f Not supported\n * **python-lottie** refers to this framework in general\n * **Telegram** refers to features supported by telegram animated stickers\n * **SVG** refers to the exported SVG images from this framework,\n features supported here will also reflect on other formats (such as video, png, and similar)\n\n\nTelegram doesn't support everything in the Lottie format.\nhttps://core.telegram.org/animated_stickers lists some things that are unsupported\nbut what is listed there isn't correct.\n\nThere are several things marked as unsupported in telegram animated stickers that are actually supported.\n\n\n\n| **Shapes** | **python-lottie** | **Telegram** | **SVG** |\n|----------------------------------|-------------------|------------------|---------|\n| Shape | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Ellipse | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Rectangle | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Rounded Rectangle | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Polystar | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \ud83d\udc4d |\n| Group | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Trim Path (individually) | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Trim Path (simultaneously) | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| **Fills** | **python-lottie** | **Telegram** | **SVG** |\n| Color | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Opacity | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Radial Gradient | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Linear Gradient | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Fill Rule | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| **Strokes** | **python-lottie** | **Telegram** | **SVG** |\n| Color | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Opacity | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Width | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Line Cap | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Line Join | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Miter Limit | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Dashes | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Gradient | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \ud83d\udc4d |\n| **Transforms** | **python-lottie** | **Telegram** | **SVG** |\n| Position | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Position (separated X/Y) | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Scale | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Rotation | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Anchor Point | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Opacity | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Parenting | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Skew | \ud83d\udc4d | \u26d4\ufe0f[^bug] | \ud83d\udc4d |\n| Auto Orient | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \ud83d\udc4d |\n| **Interpolation** | **python-lottie** | **Telegram** | **SVG** |\n| Linear Interpolation | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Bezier Interpolation | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Hold Interpolation | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Spatial Bezier Interpolation | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Rove Across Time | \u26d4\ufe0f | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| **Masks** | **python-lottie** | **Telegram** | **SVG** |\n| Mask Path | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \ud83d\udc4d |\n| Mask Opacity | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \ud83d\udc4d |\n| Add | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \u26d4\ufe0f |\n| Subtract | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \u26d4\ufe0f |\n| Intersect | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \ud83d\udc4d |\n| Lighten | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \u26d4\ufe0f |\n| Darken | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \u26d4\ufe0f |\n| Difference | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \u26d4\ufe0f |\n| Expansion | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \u26d4\ufe0f |\n| Feather | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \u26d4\ufe0f |\n| **Mattes** | **python-lottie** | **Telegram** | **SVG** |\n| Alpha Matte | \ud83d\udc4d | \u26d4\ufe0f[^dok] | \ud83d\udc4d |\n| Alpha Inverted Matte | \ud83d\udc4d | \u26d4\ufe0f[^dok] | \u26d4\ufe0f |\n| Luma Matte | \ud83d\udc4d | \u26d4\ufe0f[^dok] | \ud83d\udc4d |\n| Luma Inverted Matte | \ud83d\udc4d | \u26d4\ufe0f[^dok] | \u26d4\ufe0f |\n| **Merge Paths** | **python-lottie** | **Telegram** | **SVG** |\n| Merge | \u26d4\ufe0f | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| Add | \u26d4\ufe0f | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| Subtract | \u26d4\ufe0f | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| Intersect | \u26d4\ufe0f | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| Exclude Intersection | \u26d4\ufe0f | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| **Layer Effects** | **python-lottie** | **Telegram** | **SVG** |\n| Fill | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Stroke | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Tint | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Tritone | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Levels Individual Controls | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| **Text** [^text] | **python-lottie** | **Telegram** | **SVG** |\n| Glyphs | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Fonts | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Transform | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Fill | \ud83d\udc4d | \u26d4\ufe0f | \ud83d\udc4d |\n| Stroke | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Tracking | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Anchor point grouping | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Text Path | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Per-character 3D | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Range selector (Units) | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Range selector (Based on) | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Range selector (Amount) | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Range selector (Shape) | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Range selector (Ease High) | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Range selector (Ease Low) | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| Range selector (Randomize order) | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| expression selector | \u26d4\ufe0f | \u26d4\ufe0f | \u26d4\ufe0f |\n| **Other** | **python-lottie** | **Telegram** | **SVG** |\n| Expressions | \u26d4\ufe0f | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| Images | \ud83d\udc4d | \u26d4\ufe0f | \ud83d\udc4d |\n| Precomps | \ud83d\udc4d | \ud83d\udc4d | \ud83d\udc4d |\n| Time Stretch | \ud83d\udc4d | \u26d4\ufe0f | \u26d4\ufe0f |\n| Time remap | \ud83d\udc4d | \u26d4\ufe0f[^dok] | \ud83d\udc4d |\n| Markers | \u26d4\ufe0f | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| 3D Layers | \ud83d\udc4d | \u26d4\ufe0f[^untested] | \u26d4\ufe0f |\n| Repeaters | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \ud83d\udc4d |\n| Solids | \ud83d\udc4d | \ud83d\udc4d[^unsupported] | \ud83d\udc4d |\n\n[^text]: Note that **python-lottie** offers an alternative to lottie text layers, and can render\ntext as shapes, so that is supported everywhere\n\n[^untested]: Marked as unsupported but I haven't tested it\n\n[^bug]: Not listed as unsupported, maybe a bug?\n\n[^dok]: Works on telegram desktop\n\n[^unsupported]: Marked as unsupported\n",
"bugtrack_url": null,
"license": "GNU Affero General Public License v3 or later (AGPLv3+)",
"summary": "A framework to work with lottie files and telegram animated stickers (tgs)",
"version": "0.7.1",
"project_urls": {
"Chat": "https://t.me/tgs_stuff",
"Code": "https://gitlab.com/mattbas/python-lottie/",
"Coverage": "https://mattbas.gitlab.io/python-lottie/coverage/",
"Documentation": "https://mattbas.gitlab.io/python-lottie/index.html",
"Downloads": "https://mattbas.gitlab.io/python-lottie/downloads.html",
"Homepage": "https://gitlab.com/mattbas/python-lottie/"
},
"split_keywords": [
"telegram",
"stickers",
"tgs",
"lottie",
"svg",
"animation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e57bb9b58bb7279be90e2ebce9dd6d4a603448fa22185558844e61bd916b170",
"md5": "ba9c55724c92d5ed389b8b56ec8b661f",
"sha256": "21fd39c8e68bb1f043bd5c669c3c60c70a9cde59028d35bc615ddef92f42536a"
},
"downloads": -1,
"filename": "lottie-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "ba9c55724c92d5ed389b8b56ec8b661f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 171329,
"upload_time": "2024-10-16T13:29:22",
"upload_time_iso_8601": "2024-10-16T13:29:22.308762Z",
"url": "https://files.pythonhosted.org/packages/0e/57/bb9b58bb7279be90e2ebce9dd6d4a603448fa22185558844e61bd916b170/lottie-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-16 13:29:22",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "mattbas",
"gitlab_project": "python-lottie",
"lcname": "lottie"
}