psdparse 0.1.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: psdparse
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Fast PSD (Photoshop) reader/writer — C++17 core with pybind11 bindings
|
|
5
|
+
Keywords: psd,photoshop,parser,image,graphics
|
|
6
|
+
Author-Email: wamsoft <wtnbgo@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2026 wamsoft
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Classifier: Development Status :: 4 - Beta
|
|
30
|
+
Classifier: Intended Audience :: Developers
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Programming Language :: C++
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
35
|
+
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
|
|
36
|
+
Project-URL: Homepage, https://github.com/wamsoft/psdparse
|
|
37
|
+
Project-URL: Repository, https://github.com/wamsoft/psdparse
|
|
38
|
+
Project-URL: Issues, https://github.com/wamsoft/psdparse/issues
|
|
39
|
+
Requires-Python: >=3.9
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# psdparse
|
|
43
|
+
|
|
44
|
+
Pure C++17 PSD (Photoshop) reader/writer library, with pybind11-based Python bindings.
|
|
45
|
+
|
|
46
|
+
- Lazy I/O: PSD pixel data is **not** copied into memory at parse time. Only the structural metadata (a few hundred KB even for large files) is read upfront; layer pixels are paged in on demand via mmap or stream callbacks.
|
|
47
|
+
- Round-trip save: `load(p) -> save(q)` produces a byte-identical PSD file.
|
|
48
|
+
- Python wrapper: `import psdparse` → `PSDFile.load(path) / layer_image(i) / merged_image() / save(path)`.
|
|
49
|
+
|
|
50
|
+
The library was extracted from the [psdfile](https://github.com/wamsoft/psdfile) kirikiri plugin in 2026. psdfile now consumes this library as a submodule.
|
|
51
|
+
|
|
52
|
+
## Architecture (quick read)
|
|
53
|
+
|
|
54
|
+
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for full details.
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
IteratorBase (psdbase.h, pure virtual — parser only sees this)
|
|
58
|
+
├── MemoryReader (psdparse.h) ... mmap / contiguous buffer
|
|
59
|
+
└── StreamReader (psdparse.h) ... arbitrary seekable stream
|
|
60
|
+
└── Source (pure virtual; subclass per backend)
|
|
61
|
+
├── IStreamSource ... std::istream
|
|
62
|
+
└── (your custom Source) ... e.g. iTJSBinaryStream wrapper
|
|
63
|
+
|
|
64
|
+
WriterBase (psdwrite.h, pure virtual — symmetric to IteratorBase)
|
|
65
|
+
└── FileWriter (FILE*)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`psd::PSDFile::load(const char *path)` mmaps a local file. `loadFromStream(std::istream&)` / `loadFromReader(IteratorBase&)` accept arbitrary I/O. `save(const char *path)` writes the loaded data back as PSD.
|
|
69
|
+
|
|
70
|
+
All public path arguments are **UTF-8** (`char *`). On Win32, conversion to UTF-16 happens internally via `psd::utf8ToWide` (inline in psdbase.h).
|
|
71
|
+
|
|
72
|
+
## Install (Python)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install psdparse # once published to PyPI
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Build from source — needs only a C++17 compiler + CMake 3.16+, **no vcpkg**:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install . # or: pip wheel . -w dist
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`zlib` is taken from the system if present, otherwise fetched from source by
|
|
85
|
+
CMake (`FetchContent`), so no package manager is required. Packaging uses
|
|
86
|
+
[scikit-build-core](https://scikit-build-core.readthedocs.io/); cross-platform
|
|
87
|
+
wheels are built in CI (`.github/workflows/wheels.yml`, cibuildwheel).
|
|
88
|
+
|
|
89
|
+
## Build (C++ library / CLI)
|
|
90
|
+
|
|
91
|
+
Requires CMake 3.16+ and a C++17 compiler. **vcpkg is no longer needed.**
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
# C++ library + CLI (static CRT)
|
|
95
|
+
cmake --preset x64-windows
|
|
96
|
+
cmake --build --preset x64-windows --config Release
|
|
97
|
+
|
|
98
|
+
# C++ library + Python module (dynamic CRT, matches CPython)
|
|
99
|
+
cmake --preset x64-windows-python
|
|
100
|
+
cmake --build --preset x64-windows-python --config Release
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`Makefile` is a thin wrapper:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
make PRESET=x64-windows prebuild build
|
|
107
|
+
make PRESET=x64-windows-python prebuild build
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Build artifacts:
|
|
111
|
+
- `build/x64-windows/psdparse/Release/psdparse_cli.exe`
|
|
112
|
+
- `build/x64-windows-python/python/Release/psdparse.cp312-win_amd64.pyd`
|
|
113
|
+
|
|
114
|
+
Only dependency: `zlib` (system, or auto-fetched from source).
|
|
115
|
+
|
|
116
|
+
## Python API
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
import psdparse
|
|
120
|
+
|
|
121
|
+
p = psdparse.PSDFile()
|
|
122
|
+
p.load(r"path/to/file.psd") # mmap-backed
|
|
123
|
+
|
|
124
|
+
print(p.header.width, p.header.height, len(p.layers))
|
|
125
|
+
for layer in p.layers:
|
|
126
|
+
print(layer.name_unicode, layer.blend_mode.name, layer.opacity)
|
|
127
|
+
|
|
128
|
+
bgra = p.merged_image() # bytes, BGRA, 4*W*H
|
|
129
|
+
layer_bgra = p.layer_image(0, "masked") # bytes, BGRA, 4*w*h
|
|
130
|
+
|
|
131
|
+
p.save(r"out.psd") # byte-identical round-trip
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Full API reference: [docs/PYTHON_API.md](docs/PYTHON_API.md).
|
|
135
|
+
|
|
136
|
+
## Tests
|
|
137
|
+
|
|
138
|
+
Tests live under `tests/` and use [pytest](https://docs.pytest.org/). They need two sample PSDs at the repo root (not in git — see below).
|
|
139
|
+
|
|
140
|
+
```powershell
|
|
141
|
+
# After building with x64-windows-python preset:
|
|
142
|
+
python -m pytest -v
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Sample PSDs
|
|
146
|
+
|
|
147
|
+
The 27 pytest tests use these files:
|
|
148
|
+
|
|
149
|
+
| File | Size | Description |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| `UI-PSDサンプル.psd` | 800×600, 50 layers, ~2 MB | UI button mock-up. Folder groups, transparent overlays. |
|
|
152
|
+
| `園部由夏_a.psd` | 2500×3500, 28 layers, ~21 MB | Illustration. PASS_THROUGH groups, Unicode layer names (luni records). |
|
|
153
|
+
|
|
154
|
+
Place them at the repo root (the conftest.py also checks `tests/data/` first). They are listed in `.gitignore`. If you can't source them, the tests will skip rather than fail.
|
|
155
|
+
|
|
156
|
+
## tools/psd_export.py
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
python tools/psd_export.py input.psd [--out-dir DIR] [--mode masked|image|mask]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Outputs `layers.json` (full layer metadata), `merged.png` (composite), and per-layer PNGs.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
psdparse.cp313-win_amd64.pyd,sha256=mPsKVtZfaSK6ZUifdL37cyD06BY1UueOx9g46Yg9feM,408064
|
|
2
|
+
psdparse-0.1.0.dist-info/METADATA,sha256=1slTZcbKkHh_xP-zMDV9Gm25fWlWrgEyQkZXyH53wl0,6485
|
|
3
|
+
psdparse-0.1.0.dist-info/WHEEL,sha256=UZrbbE4r80xj7Ncfa6JoeTVe-77bdXLkKUA63V8pKWQ,106
|
|
4
|
+
psdparse-0.1.0.dist-info/licenses/LICENSE,sha256=B1u-g7n_GOPvjE1noRJE13ryitgihTr5eThpwQlkmSU,1085
|
|
5
|
+
psdparse-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wamsoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
Binary file
|