Skip to main content

Image to Human Avatar

This project aims to automatically process photos of humans into animatable human avatars.

Specifically, we aim to detect the human in the image, position it to our standard positioning, and mask it.

Source Image Area of Interest Cropped Masked
High quality image of a human. Shoulder width $x$ Area of interest in $2.5x$ shoulder width where the center is the neck Image after cropping Image after masking
source source source source

Real Examples

Source Image Avatar Masked Avatar
source avatar masked
source avatar masked
source avatar masked

Conditions

  • Input can be of any aspect ratio.
  • There must be a human in the image (real or fictional).
  • The human must be standing, with their arms down, facing the camera (TODO).
  • The image must be safe-for-work.
  • The creator of the avatar must have the right to use the image.

Usage

# cropping only (crop_image) — lightweight, no torch
pip install image-to-human-avatar

# full avatar pipeline (image_to_avatar): add the [mask] extra for background masking + pose
pip install "image-to-human-avatar[mask]"

To then process an image (requires the [mask] extra):

from human_avatar.image_to_avatar import image_to_avatar
from PIL import Image

image = Image.open("example.jpg")
cropped, masked, pose = image_to_avatar(image)

masked.save("masked.png")

Pass include_pose=False to skip the full-body pose extraction (much faster).

To only crop a person out of an image of any size, without the avatar quality conditions:

from human_avatar.image_to_avatar import crop_image
from PIL import Image

image = Image.open("example.jpg")
crop = crop_image(image, resolution=256)  # 256x256 shoulder-centered crop

Web Server on Docker

docker build -t human-avatar .

docker run --rm -p 9874:8080 -e PORT=8080 \
  -v $(pwd)/output:/mnt/output \
  human-avatar

curl -X POST http://localhost:9874/ \
  -F "output=gs://output/flux" \
  -F "file=@assets/examples/flux/source.jpg"

Pass -F "pose=false" to skip writing the full-body pose.pose file (much faster).

Metadata

Release files for image-to-human-avatar 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for image-to-human-avatar 0.2.4
File Size Uploaded Provenance Actions
image_to_human_avatar-0.2.4.tar.gz 12.5 kB Without provenance Details for image_to_human_avatar-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for image-to-human-avatar 0.2.4
File Interpreter ABI Platform Actions
image_to_human_avatar-0.2.4-py3-none-any.whl Python 3 none any Details for image_to_human_avatar-0.2.4-py3-none-any.whl

Total release size: 25.4 kB

Release files / image_to_human_avatar-0.2.4.tar.gz

Download URL image_to_human_avatar-0.2.4.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
66bfdcbe839882f5fb807730ad1ce706f99d83d8f8c19793375eac05f42fe609
BLAKE2b-256 checksum
How to use checksums
43ea7fad161e642cf0dd61267f76a0ade18a81ce0c28e5027f9be81d99fdd453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / image_to_human_avatar-0.2.4-py3-none-any.whl

Download URL image_to_human_avatar-0.2.4-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dec64915bee1ece42792f6d9f3c4e2c2d20389d2a98b8b08ac67733efdc1c2f9
BLAKE2b-256 checksum
How to use checksums
b461174dc05641c68e1979ff7c8c92f0032ac6b8ee99da155a7f32cd647bf403
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for image-to-human-avatar 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page