srrt
Recolor a person toward a reference skin colour. You pass the colour, the photo, and a mask of the person. The result is a BGR image with that region moved toward the reference and a soft edge.
from srrt import transfer
result = transfer("#C68642", "person.jpg", "person_mask.png")
result is a uint8 BGR array, the same size as the photo.
Install
pip install srrt
Histogram-rotation mode (idt) needs SciPy:
pip install "srrt[idt]"
Inputs
| Argument | What it is |
|---|---|
reference_color |
#RRGGBB, #RGB, "R,G,B", an RGB tuple, or a close-up skin photo (path or BGR array) |
human_image |
Person photo (path or BGR array) |
human_mask |
Mask of the same height and width. Non-zero pixels are recolored |
Colours are RGB. Image arrays follow OpenCV and are BGR.
A binary mask is feathered over a few pixels. A soft mask (values other than only 0 and 255) is used as the blend itself. Bright, low-chroma pixels inside the mask, such as teeth and eye whites, stay on the original colour.
import cv2
from srrt import transfer
image = cv2.imread("person.jpg")
mask = cv2.imread("person_mask.png", cv2.IMREAD_GRAYSCALE)
result = transfer((198, 134, 66), image, mask, strength=0.8)
cv2.imwrite("out.jpg", result)
A reference photo is sampled the same way as a flat colour:
result = transfer("skin_reference.jpg", image, mask)
Options
| Argument | Default | Meaning |
|---|---|---|
strength |
0.8 |
0 leaves the photo unchanged, 1 applies the full transfer |
feather |
3 |
Edge width in pixels for a binary mask |
luma_shift |
1.0 |
0 keeps original lightness, 1 matches the reference lightness |
erode |
4 |
Border pixels left out of the source colour estimate |
protect_whites |
True |
Keep teeth and eye whites |
seed |
0 |
Sampler seed |
Command line
srrt --reference "#C68642" --image person.jpg --mask person_mask.png --output out.jpg
srrt --reference skin_reference.jpg --image person.jpg --mask person_mask.png --output out.jpg --strength 1
Author
Metadata
Release files for srrt 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| srrt-0.1.1.tar.gz | 12.6 kB | Without provenance | Details for srrt-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| srrt-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for srrt-0.1.1-py3-none-any.whl |
Total release size: 24.7 kB
Release files / srrt-0.1.1.tar.gz
| Download URL | srrt-0.1.1.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85cf66178922c61bede01108541d45e2a88498060e2eab499efa47387fb65f24
|
|
BLAKE2b-256 checksum How to use checksums |
5174f45e97306a6fb2b610791c747e67e936fe67da9eb76e908b91beb54d9ead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / srrt-0.1.1-py3-none-any.whl
| Download URL | srrt-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccdc752a56a7d54625cc8b87cb5544ba50e0fba1d0af48934578fb93f2fef1fc
|
|
BLAKE2b-256 checksum How to use checksums |
50f3dc61f48b3824a758c9b47d54926a8104cd7a9a99c163e659ea21c910fb1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for srrt 0.1.1
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.