BPG (Better Portable Graphics) for Nim
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src
README.md
bpg.nimble
libbpg.h.patch

README.md

BPG (Better Portable Graphics) for Nim

This is a Nim wrapper of libbpg. I'm using my own fork which creates a libbpg.so.

Usage

For a usage example see decode.nim. Since libbpg isn't included in most distributions we have to build it ourselves:

$ git clone https://github.com/def-/libbpg.git
$ cd libbpg
$ make -j4
$ cp libbpg.so ../nim-bpg
$ cd ../nim-bpg

After this is done we can comfortably use the wrapper:

$ nim c examples/decode
$ examples/decode examples/lena512color.bpg
$ gimp out.ppm

Recreating the wrapper

To recreate the wrapper for new libbpg versions with a changed interface:

$ patch -p1 < libbpg.h.patch
patching file libbpg.h
$ c2nim -o:bpg.nim libbpg.h
Hint: operation successful (155 lines compiled; 0 sec total; 516.528KB) [SuccessX]

No manual interaction should be necessary.