ffpsd
Python bindings to ffpsd, a library that reads and writes Photoshop PSD and PSB files.
import ffpsd
import numpy as np
def run(input_path, picture_path, output_path):
doc = ffpsd.Document.open(input_path)
width, height = doc.width, doc.height
print(f"{width} x {height}, {doc.depth} bit, {doc.layer_count} layers")
# The composite Photoshop saved with the file, as PNG; None when the file has none.
composite = doc.merged_image()
if composite is not None:
print(f"composite: {len(ffpsd.encode_png(composite))} bytes of PNG")
# Layers go from the bottom up, so the top one is -1.
top = doc.layer(-1)
print(f"top layer: {top.name}, {top.bounds.width} x {top.bounds.height}")
# A copy of it on top, half transparent, in Multiply mode.
copy = doc.duplicate_layer(-1)
copy.name = "Copy"
copy.opacity = 128
copy.blend_key = ffpsd.fourcc("mul ")
# A PNG, JPEG or WebP as a layer in the document's mode and depth, 50 px from the corner, half the canvas in size, mirrored.
image = ffpsd.load_picture(picture_path, doc.color_mode, doc.depth)
picture = doc.add_layer("Picture", image, 50, 50)
picture.resize(width // 2, height // 2)
picture.flip(ffpsd.FlipDirection.HORIZONTAL)
# A mask that hides a 100 x 100 square in the picture's corner and shows the rest.
picture.set_mask(np.zeros((100, 100), np.uint8), 50, 50, 255)
# A Levels layer over everything that brightens the midtones.
doc.add_levels_layer("Levels", ffpsd.Levels(channels=[ffpsd.LevelsChannel(gamma=1.5)]))
# 100 px more canvas on every side, then save, each channel RLE or raw, whichever is smaller.
doc.resize_canvas(width + 200, height + 200, ffpsd.Anchor.CENTER)
doc.save(output_path, ffpsd.Compression.RLE_OR_RAW)
print(f"saved {doc.layer_count} layers to {output_path}")
What it does for now
- PSD and PSB, and either into the other; RGB and gray documents, and either into the other.
- Layers: raster layers, groups, the background and Levels adjustments; added, copied from this or another document, moved and removed; name, opacity, visibility, clipping and blend mode; pixels in and out.
- Pixel masks, read, set and removed.
- The canvas and the layers resized, turned and flipped; the canvas grown or cut from any anchor.
- The composite the file stores, read and replaced; resolution and version info.
- Every image resource and tagged block, raw, for what ffpsd does not interpret itself.
- PNG, JPEG and WebP in and out.
In Python
- Pixels are NumPy arrays, planar as PSD keeps them:
(channels, height, width), uint8, uint16 or float32 by the depth. Arrays ffpsd gives own their memory without a copy; one it takes is copied only when it is not C-contiguous, sopixels.transpose(2, 0, 1)of an interleaved picture works as is. - Calls that take time, such as saving, pixels in and out and resizing, release the GIL, so separate documents
work in threads at once. A document belongs to one thread at a time: touching one that another thread is
working on raises
ffpsd.InvalidOperationError. - Errors are
ffpsd.Errorand also the built-in exception they mean:ValueError,IndexError,OSError,RuntimeErrororNotImplementedError. - A layer removed from its document raises on use instead of crashing.
- With
pip install ffpsd[pil],ffpsd.from_pilandffpsd.to_piltake and give Pillow images. - Type stubs come with the package.
More in the repository: building from source and the roadmap.
License
MIT. The vendored libraries built in keep their own permissive licenses, which the package carries.
Metadata
Release files for ffpsd 0.4.7
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 |
|---|---|---|---|---|
| ffpsd-0.4.7.tar.gz | 3.9 MB | With provenance | Details for ffpsd-0.4.7.tar.gz |
Built distributions (wheels)
Total release size: 12.6 MB
Release files / ffpsd-0.4.7.tar.gz
| Download URL | ffpsd-0.4.7.tar.gz |
|---|---|
| Size | 3.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c2d8245e7fae8197fd0a9249bcee10b552d9137c618bb4a98083e0a9d2f3d01
|
|
BLAKE2b-256 checksum How to use checksums |
aa13657c481e2c9c7d7eba31bad12da5835da2d2b3ee9441d6431d4bf9aa1851
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp312-abi3-win_amd64.whl
| Download URL | ffpsd-0.4.7-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 957.5 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
43e5c35b0c7100b45bf4d1ffddabe94d55284921b5d26b7d2fae7d966108aba4
|
|
BLAKE2b-256 checksum How to use checksums |
73113369b8a28203154b7d17b71dab908de928a76bef608ef256eb200e257966
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ffpsd-0.4.7-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c00cb2d15991a1309a6872ebd10780d1c72cdc901a004645802f85593c353535
|
|
BLAKE2b-256 checksum How to use checksums |
694d5786c74f6b73747550bddf52d640ead5ec41e2fc9368917109290d3183d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | ffpsd-0.4.7-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 768.7 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f26bdb91f955839c3e06872a7656db1b8e43870a2c104bfeedcfa904bea50ac7
|
|
BLAKE2b-256 checksum How to use checksums |
217fa39427d9454f7b4b720c43e30bc2f71eabca53c2911498c79fb095542305
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp311-cp311-win_amd64.whl
| Download URL | ffpsd-0.4.7-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 958.5 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0205f7c2e3aeb3d1b1566f159b29b803a02f316f1c507460442c3c4b0a83d753
|
|
BLAKE2b-256 checksum How to use checksums |
e2ccb11244e149c7e6ea9903c1bf6ba5474565cf8e05f2f55ad036117a905887
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ffpsd-0.4.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
69afc71b46c1d61a9a5ebffc3992a109742655ecbbf0a9d6fe3d93f20a875d33
|
|
BLAKE2b-256 checksum How to use checksums |
20445d3fa782e610ad901a21a1fc75dbd6d69eb26cacd00aa1e2d408c5c0995a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | ffpsd-0.4.7-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 770.6 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
30005b94737ac3b646b67a24ed3652f98f23df7fdae916a23d0bc7e4609000ea
|
|
BLAKE2b-256 checksum How to use checksums |
659a12a8bdce6b1501cefc9ff68d14d2cdd201f505f23cd63f088e8a07985b36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp310-cp310-win_amd64.whl
| Download URL | ffpsd-0.4.7-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 958.2 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ddad84f11f88aada8b57efc9b7b9b79dd2d48bd1e65ce0abb04495365607a600
|
|
BLAKE2b-256 checksum How to use checksums |
0cd4e2d303416df091e3557af233251f31b21c2ac06ea0bbb124da09e4e59315
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ffpsd-0.4.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6b1687d655e205448293915b384b3300233f44b2edcaeb61e9a4b69c8f0f0112
|
|
BLAKE2b-256 checksum How to use checksums |
e892007bbbe06c315278f8947833d7745f88b414e2554856028f41f3c6d4de78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / ffpsd-0.4.7-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | ffpsd-0.4.7-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 770.2 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
493b18d69622d992ac52bf1b93d779a60ebfec7479553566eecb6c0b6c897ff4
|
|
BLAKE2b-256 checksum How to use checksums |
97fb555242a57f2afa800fc83c31b1e4d8354b940e9b2cfe2850934e9b137c81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logSecurity for ffpsd 0.4.7
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.
Full provenance
All 10 files in this release have been uploaded with provenance metadata.
Attestation for ffpsd-0.4.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logA 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.