# LivePNG
LivePNG is a format to create avatars based on PNG images.
## Demo
https://github.com/user-attachments/assets/efdddbcf-2850-4325-ab2c-0381f46072f1
## Examples
The easiest way to understand the format is by looking at the `examples` folder.
## Models structure
Every model is described by a JSON file called `model.json` inside its folder.
Its properties are:
- `name`: Name of the model
- `version`: Version of LivePNG (for now only 1 is available)
- `styles`: The list of [styles](#Styles) a model has.
### Styles
A style is supposed to be a different style for a model, for example a clothes change or a different state.
Every style has a name `style_name`, and is contained in the `assets/style_name` folder.
Every style has at least one [expression](#Expressions).
![livepng drawio](https://github.com/user-attachments/assets/fcfc6975-7cf7-44e1-a55b-c34d6765095f)
### Expressions
An expression is supposed to be a different expression for a model, for example a different face expression based on the mood or the emotions of a character.
Every expression has an `expression_name`, and is contained in the `assets/style_name/expression_name`.
Expressions might be different for each style.
If you want a default expression, name it `idle`, otherwise the first expression in alphabetic order is taken.
Every expression has at least one [variant](#Variants)
### Variants
Variants are different variants of an expression. Their objective is to make the character appear more lively, and show different images for each expression.
Every variant has a `variant_name` and is contained in the `assets/style_name/expression_name/variant_name`.
The variant_name folder must contain the image files that show different states of the lips.
## Python Examples
### Installing
To install and update the package, you can user pip:
```
pip install -U livepng
```
### Quick start
```Python
from livepng import LivePNG
model = LivePNG("path/to/model.json")
# Setting the second style
styles = model.get_styles()
model.set_current_style(styles[list(styles.keys())[1]])
# Setting an happy expression
model.set_current_expression("happy")
# Add a function as a callback
# we are setting a stub function `update_image` as callback
# this function will be called every time there is a frame update
# You can subscribe to more events implementing th Live2DModelObserver interface
model.subscribe_callback(update_iamge)
# Start speaking with lipsync
# It will play audio and set a random variant before starting to speak
# It will call update_image every 0.1s passing the frame to show
model.speak("file.wav", random_variant=True, play_audio=True, frame_rate=10, interrupt_others=True, start_thread=True)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/francescocaracciolo/livepng",
"name": "livepng",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "avatar, png, lipsync, livepng, anime",
"author": "Francesco Caracciolo",
"author_email": "francescocaracciolo78@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5f/f6/46460592a722da0a2bb2630f351780fd1ad1280fee10b62b9f3da4188234/livepng-0.1.8.tar.gz",
"platform": null,
"description": "# LivePNG\nLivePNG is a format to create avatars based on PNG images.\n\n## Demo\nhttps://github.com/user-attachments/assets/efdddbcf-2850-4325-ab2c-0381f46072f1\n\n## Examples\nThe easiest way to understand the format is by looking at the `examples` folder.\n\n## Models structure\nEvery model is described by a JSON file called `model.json` inside its folder.\nIts properties are:\n- `name`: Name of the model\n- `version`: Version of LivePNG (for now only 1 is available)\n- `styles`: The list of [styles](#Styles) a model has.\n\n\n### Styles\nA style is supposed to be a different style for a model, for example a clothes change or a different state.\nEvery style has a name `style_name`, and is contained in the `assets/style_name` folder.\nEvery style has at least one [expression](#Expressions).\n\n![livepng drawio](https://github.com/user-attachments/assets/fcfc6975-7cf7-44e1-a55b-c34d6765095f)\n\n\n### Expressions\nAn expression is supposed to be a different expression for a model, for example a different face expression based on the mood or the emotions of a character.\nEvery expression has an `expression_name`, and is contained in the `assets/style_name/expression_name`.\nExpressions might be different for each style.\nIf you want a default expression, name it `idle`, otherwise the first expression in alphabetic order is taken.\nEvery expression has at least one [variant](#Variants)\n\n### Variants\nVariants are different variants of an expression. Their objective is to make the character appear more lively, and show different images for each expression. \nEvery variant has a `variant_name` and is contained in the `assets/style_name/expression_name/variant_name`.\nThe variant_name folder must contain the image files that show different states of the lips.\n\n## Python Examples\n### Installing\nTo install and update the package, you can user pip:\n```\npip install -U livepng\n```\n### Quick start\n\n```Python\nfrom livepng import LivePNG\n\nmodel = LivePNG(\"path/to/model.json\")\n# Setting the second style\nstyles = model.get_styles()\nmodel.set_current_style(styles[list(styles.keys())[1]])\n# Setting an happy expression\nmodel.set_current_expression(\"happy\")\n# Add a function as a callback\n# we are setting a stub function `update_image` as callback\n# this function will be called every time there is a frame update\n# You can subscribe to more events implementing th Live2DModelObserver interface\nmodel.subscribe_callback(update_iamge)\n# Start speaking with lipsync\n# It will play audio and set a random variant before starting to speak\n# It will call update_image every 0.1s passing the frame to show\nmodel.speak(\"file.wav\", random_variant=True, play_audio=True, frame_rate=10, interrupt_others=True, start_thread=True)\n```\n",
"bugtrack_url": null,
"license": "GGPLv3",
"summary": "LivePNG is a format to create avatars based on PNG images with lipsync support",
"version": "0.1.8",
"project_urls": {
"Download": "https://github.com/FrancescoCaracciolo/LivePNG/archive/refs/tags/0.1.8.tar.gz",
"Homepage": "https://github.com/francescocaracciolo/livepng"
},
"split_keywords": [
"avatar",
" png",
" lipsync",
" livepng",
" anime"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0c48ed7addd0d500857ab36a74497ee712bd5f2a3915bbe488089c21a4e690a1",
"md5": "06b0af16fb9b266c40c436b23004363d",
"sha256": "d0ac790bcef7b3e2088aa434bb9ca7fc68800d3db8e46697f07d7ddc91285a97"
},
"downloads": -1,
"filename": "livepng-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "06b0af16fb9b266c40c436b23004363d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24781,
"upload_time": "2024-10-03T11:25:10",
"upload_time_iso_8601": "2024-10-03T11:25:10.089831Z",
"url": "https://files.pythonhosted.org/packages/0c/48/ed7addd0d500857ab36a74497ee712bd5f2a3915bbe488089c21a4e690a1/livepng-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5ff646460592a722da0a2bb2630f351780fd1ad1280fee10b62b9f3da4188234",
"md5": "c19cfb350132c16f5b15f93fbaee35cd",
"sha256": "3dd7ee7e45362beda48ad30628bdb53af8fcb1e9af2d3e817cef68e4c2082cf9"
},
"downloads": -1,
"filename": "livepng-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "c19cfb350132c16f5b15f93fbaee35cd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 23973,
"upload_time": "2024-10-03T11:25:11",
"upload_time_iso_8601": "2024-10-03T11:25:11.437236Z",
"url": "https://files.pythonhosted.org/packages/5f/f6/46460592a722da0a2bb2630f351780fd1ad1280fee10b62b9f3da4188234/livepng-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-03 11:25:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "francescocaracciolo",
"github_project": "livepng",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "livepng"
}