psd-d ~main
D PSD parsing library
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
PSD-D
psd-d is a lose experimental port of psd_sdk to D to support basic extraction of layer info and layer data from photoshop files. Some features are not supported (yet), but we'll add them over time.
Only the PSD format is supported, there's currently no support for PSB.
Parsing a document
To parse a PSD document, use parseDocument
in psd
.
PSD document = parseDocument("myFile.psd");
Extracting layer data from layer
To extract layer data (textures) from a layer use Layer.extractLayerImage()
PSD doc = parseDocument("myfile.psd");
foreach(layer; doc.layers) {
// Skip non-image layers
if (layer.type != LayerType.Any) continue;
// Extract the layer image data.
// The output RGBA output is stored in Layer.data
layer.extractLayerImage();
// write_image from imagefmt is used here to export the layer as a PNG
write_image(buildPath(outputFolder, layer.name~".png"), layer.width, layer.height, layer.data, 4);
}
- Registered by Clipsey
- ~main released a year ago
- Inochi2D/psd-d
- BSD 2-clause
- Copyright © 2021, Luna Nielsen
- Authors:
- Dependencies:
- none
- Versions:
-
0.6.3 2023-Jun-06 0.6.2 2022-Jul-01 0.6.1 2022-Jan-25 0.6.0 2021-Sep-15 0.5.0 2021-Sep-15 - Download Stats:
-
-
14 downloads today
-
95 downloads this week
-
375 downloads this month
-
10881 downloads total
-
- Score:
- 3.7
- Short URL:
- psd-d.dub.pm