KritaEx (KritaEx v0.1.0)

View Source

Provides the functions extract_png/3 and read_png/1 to extract image data from .kra files.

Summary

Functions

Extracts the embedded 'mergedimage.png' inside a .kra file to a specified location

Reads the embedded 'mergedimage.png' inside a .kra file

Functions

extract_png(kra_path, out_path, create_dirs \\ true)

Extracts the embedded 'mergedimage.png' inside a .kra file to a specified location

Parameters

  • kra_path: Path to .kra file
  • out_path: Output filepath
  • create_dirs: Automatically create parent directories?

Returns :ok.

Examples

iex> KritaEx.extract_png("./priv/test.kra", "./tmp/output.png")
:ok

read_png(kra_path)

Reads the embedded 'mergedimage.png' inside a .kra file

Parameters

  • kra_path: Path to .kra file

Returns {:ok, binary()}.

Examples

iex(1)> KritaEx.read_png("./priv/test.kra")
{:ok,
<<137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 9, 196,
  0, 0, 9, 196, 8, 6, 0, 0, 0, 46, 115, 245, 61, 0, 0, 0, 9, 112, 72, 89, 115,
  0, 0, 46, 35, 0, 0, 46, ...>>}