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

pip install git+https://github.com/sign/image-to-human-avatar

To then process an image:

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

Download files

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

Source Distribution

image_to_human_avatar-0.2.3.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

image_to_human_avatar-0.2.3-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file image_to_human_avatar-0.2.3.tar.gz.

File metadata

  • Download URL: image_to_human_avatar-0.2.3.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for image_to_human_avatar-0.2.3.tar.gz
Algorithm Hash digest
SHA256 dec83d1205c6cdb78b967c328f33a5437480d0c91f873c9017df877640325821
MD5 90151a8130e13ec474485264cc235902
BLAKE2b-256 7922058cad63a5c1e68a7fa3732f680570af222a1e50a04a0314e3457b971ff9

See more details on using hashes here.

File details

Details for the file image_to_human_avatar-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: image_to_human_avatar-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for image_to_human_avatar-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 73974ca5f37ff53eb4458a66ef21361ee4e78a12290c5989785d0aec2e36c42f
MD5 61212c74b279bc83fc201c8f0a5b39dc
BLAKE2b-256 2338a7d6fde5f881ff169d16c00f59c7ada0468c6a7fe27a940b7f8aadd385bf

See more details on using hashes here.

Supported by

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