bpg

BPG (Better Portable Graphics) for Nim

Wrapper score 15/100 · tests present · no docs generated

Wraps a native library — check OS Compatibility below for platform-specific linking notes.

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install bpg
choosenim install bpg
git clone https://github.com/def-/nim-bpg.git

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
bpg - - - - - - -

Source

Repository https://github.com/def-/nim-bpg.git
Homepage https://github.com/def-/nim-bpg
Registry Source nimble_official

README

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.