kra-d 0.5.5
D KRA 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:
KRA-D
kra-d
is a port of libkra to D to support basic extraction of layer info and layer data from krita files.
Dependencies
dxml
by jmdavis is required
Parsing a document
To parse a Krita document, use parseDocument
in kra
.
KRA document = parseDocument("myFile.kra");
Extracting layer data from layer
To extract layer data (textures) from a layer use Layer.extractLayerImage()
KRA doc = parseDocument("myfile.kra");
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);
}
ToDO
- Add support to Colorize Mask
Current Limitations
- Unsupported Transparency Mask
- Unsupported Filter Mask
- Unsupported Transform Mask
Thanks to LunaTheFoxgirl for the inspiration for the project.
- 0.5.5 released a year ago
- Inochi2D/kra-d
- BSD 2-clause
- Copyright © 2023, otrocodigo
- Authors:
- Dependencies:
- dxml
- Versions:
-
0.5.5 2023-Jul-02 0.5.4 2023-Jul-01 0.5.2 2023-Jun-30 0.5.1 2023-Jun-30 0.5.0 2023-Jun-30 - Download Stats:
-
-
13 downloads today
-
108 downloads this week
-
567 downloads this month
-
4012 downloads total
-
- Score:
- 3.3
- Short URL:
- kra-d.dub.pm