KritaEx (KritaEx v0.1.1)
View SourceProvides functions to extract embedded images from Krita .kra files
Summary
Functions
Extracts the embedded png to a specified location
Aliased to read_png/2
with raw: false
Reads the embedded png in binary format
Aliased to valid_kra?/2
with raw: false
Verifies that the supplied .kra is valid
Functions
Extracts the embedded png to a specified location
Parameters
- kra: Path to .kra file or binary content (use of
raw
is required to use binary) - out_path: Output filepath
- options:
- raw: expect binary input (default
false
) - create_dirs: create output directories (default
true
)
- raw: expect binary input (default
Returns :ok
or {:error, reason}
.
Examples
iex(1)> KritaEx.extract_png("test/files/test.kra", "tmp/output.png")
:ok
iex(2)> KritaEx.extract_png("idontexist.kra", "tmp/output.png")
{:error, {:failed_read, :enoent}}
Aliased to read_png/2
with raw: false
Reads the embedded png in binary format
Parameters
- kra: Path to .kra file or file contents (use of
raw
is required to use binary) - options:
- raw: expect binary input (default:
false
, seeread_png/1
)
- raw: expect binary input (default:
Examples
KritaEx.read_png("test/files/test.kra")
{:ok,
<<137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 64, 0,
0, 0, 64, 8, 6, 0, 0, 0, 170, 105, 113, 222, 0, 0, 0, 9, 112, 72, 89, 115, 0,
0, 46, 35, 0, 0, 46, ...>>}
Aliased to valid_kra?/2
with raw: false
Verifies that the supplied .kra is valid
Parameters
- kra: Path to .kra file or file contents (use of
raw
is required to use binary) - options:
- raw: expect binary input (default:
false
, seevalid_kra?/1
)
- raw: expect binary input (default:
Returns true
or false
Examples
iex(1)> KritaEx.valid_kra?("test/files/test.kra")
true
iex(2)> KritaEx.valid_kra?("test/files/invalid.kra")
false