Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inochi2d/kra-d
Experimental KRA loader made for Inochi Creator
https://github.com/inochi2d/kra-d
Last synced: about 2 months ago
JSON representation
Experimental KRA loader made for Inochi Creator
- Host: GitHub
- URL: https://github.com/inochi2d/kra-d
- Owner: Inochi2D
- License: bsd-2-clause
- Created: 2023-06-29T22:17:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-25T10:44:02.000Z (4 months ago)
- Last Synced: 2024-08-25T11:46:47.021Z (4 months ago)
- Language: D
- Size: 39.1 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KRA-D
`kra-d` is a port of [libkra](https://github.com/2shady4u/libkra) to D to support basic extraction of layer info and layer data from krita files.### Dependencies
`dxml` by jmdavis is required
- [https://github.com/jmdavis/dxml](https://github.com/jmdavis/dxml)
- [https://code.dlang.org/packages/dxml](https://github.com/jmdavis/dxml)## Parsing a document
To parse a Krita document, use `parseDocument` in `kra`.
```d
KRA document = parseDocument("myFile.kra");
```## Extracting layer data from layer
To extract layer data (textures) from a layer use `Layer.extractLayerImage()`
```d
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
- Only support for 'RGBA 8bit integer' documents
- Unsupported *Transparency Mask*
- Unsupported *Filter Mask*
- Unsupported *Transform Mask*
---**Thanks to LunaTheFoxgirl** for the inspiration for the project.