Install & Compatibility
Where this runs
tested against v2025 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 110.5MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 4.3s · import 0.000s · 107MB
110MB installed
● package 110MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
blendLayers
✓ from blendmodes import blendLayers
✗ from blendmodes import blendLayers
This quickstart demonstrates how to create two Pillow images, then blend them together using a specified `BlendType` and opacity, with an optional offset. The result is a new `PIL.Image.Image` object.
from PIL import Image
from blendmodes import blendLayers, BlendType
# Create dummy images for demonstration. In a real application,
# load images from files and ensure they are in 'RGBA' mode.
background_img = Image.new("RGBA", (400, 300), (255, 0, 0, 255)) # Red background
foreground_img = Image.new("RGBA", (200, 150), (0, 0, 255, 128)) # Semi-transparent blue foreground
# Example: Place foreground at offset (50, 50) on background
# The blendLayers function handles positioning by drawing the foreground
# onto a canvas, then applying the blend mode.
# For simpler examples, ensure foreground is smaller or equal to background
# or use offsets carefully.
# Blend the images using 'multiply' mode with 75% opacity and an offset
blended_img = blendLayers(
background=background_img,
foreground=foreground_img,
blendType=BlendType.MULTIPLY,
opacity=0.75,
offsets=(50, 50)
)
# Display or save the result
# blended_img.save("blended_image.png")
print(f"Blended image created with size: {blended_img.size} and mode: {blended_img.mode}")
# blended_img.show() # Uncomment to display the image graphically
Upgrade
Version history
2025latest on PyPI · released Feb 20, 2025
Audit
Dependencies
PillowrequiredRequired for image manipulation and representation (PIL.Image.Image objects).