pillow-wmf
A Windows Metafile reader/writer/renderer for Pillow.
Like in the old Windows days, a GDI backend draws graphics and can also record actions to a Windows Metafile. Rasterizing one of these WMFs is just a matter of playing it back, which produces a Pillow Image.
Links
Usage
from PIL import Image
import pillow_wmf # registers the WMF loader ahead of Pillow's built-in stub
with Image.open("drawing.wmf") as image:
image.load(size=(640, 480))
image.save("drawing.png")
Rendering limits
render(data, size, limits=Limits(...)) bounds input bytes, records, points,
objects and saved DC states. max_bitmap_pixels limits each decoded bitmap
or glyph. max_geometry_points (default 1,000,000) limits cumulative curve
flattening and dynamic pen expansion, including their stroke caps, joins and
repeated realizations. Input polygon points, fixed-size stroke bodies and
fixed-table pens (including their caps and joins) do not spend this expansion
budget.
Pen realization and identical stroke coverage are reused within one drawing
operation. Reusing them does not spend the allowance again; subsequent
operations generate and charge their own geometry.
The geometry allowance belongs to the raster context and is not restored by
RestoreDC. Each flattened curve also has a fixed 65,536-point limit.
RasterContext accepts max_objects, max_saved_states, max_bitmap_pixels
and max_geometry_points for direct drawing. render() passes its Limits
object's object/save allowances to the backend; Pillow loading uses the defaults.
Default policy values are defined in pillow_wmf.limits.
Resource exhaustion raises pillow_wmf.binary.ResourceLimitError, including
during play(..., strict=False); it is never treated as a recoverable omission.
An execution-time failure makes the context unusable and may leave partial
pixels. Pillow reports rendering resource failures as OSError. These limits
bound particular allocations and generated geometry, not total rendering time.
Drawing diagnostics
RasterContext and Recorder retain requested calls by default for existing
diagnostic callers. Pass trace_calls=False to omit that history; WMF recording,
handle validation and saved drawing state still work. RecordingContext also
accepts this option for its own history, independently of its two backends.
render() and the Pillow loader disable call history because they only return
pixels. TraceContext remains the backend for collecting a command trace.
License
pillow-wmf is WTFPL with one additional clause:
- Don't blame me.
Fonts have their own licenses, rip them out if you don't want to comply:
Metadata
Release files for pillow-wmf 0.2.0
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 |
|---|---|---|---|---|
| pillow_wmf-0.2.0.tar.gz | 211.8 kB | Without provenance | Details for pillow_wmf-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pillow_wmf-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pillow_wmf-0.2.0-py3-none-any.whl |
Total release size: 455.2 kB
Release files / pillow_wmf-0.2.0.tar.gz
| Download URL | pillow_wmf-0.2.0.tar.gz |
|---|---|
| Size | 211.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0144c15d5a72c349dd64dbbd193132ccd6a683c16456f57a76dcb4576bdbe43e
|
|
BLAKE2b-256 checksum How to use checksums |
3f0e94c9f7d7aea8838b1d2040cc39ed2ee61da60a821621232c82e7b2225146
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.17
|
Release files / pillow_wmf-0.2.0-py3-none-any.whl
| Download URL | pillow_wmf-0.2.0-py3-none-any.whl |
|---|---|
| Size | 243.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
735b9ea56bf725810bb06a8bd766a9b2bd7d29dd5142256e0d62882d07b271bf
|
|
BLAKE2b-256 checksum How to use checksums |
9eca2759dceb985d558f82b14cba7f5d7ac6f78b358896e438ffd6b17e383e1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.17
|
Security for pillow-wmf 0.2.0
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.