Skip to main content

LivePNG is a format to create avatars based on PNG images with lipsync support

Project description

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 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.

livepng drawio

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 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

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livepng-0.1.5.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

livepng-0.1.5-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file livepng-0.1.5.tar.gz.

File metadata

  • Download URL: livepng-0.1.5.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for livepng-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b57afda52fa0038b552fbb8c23fa5907d1ece83e0308be952cdc46a2b3087f81
MD5 18a4e49ad66943310a3e9eaaafa56d5e
BLAKE2b-256 c76b2a2a1927e4d8c590562ed288ef9c8b96beea96a905d419ded72866277a77

See more details on using hashes here.

File details

Details for the file livepng-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: livepng-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for livepng-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dd00dbc11eafdd2422ff08082a0c876a3b5bec2efd4d32c5a8db58054ac1d473
MD5 2fdaf9d3d460639739921538557cdcc7
BLAKE2b-256 60baf56ef1c8a05547d1e5ecd7f9a8041ac305357fc3add4d4d1c8a005399b9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page