~pierrec/hare-bmp

Basic BMP image format support
image: remove the palette
add encode and decode

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~pierrec/hare-bmp
read/write
git@git.sr.ht:~pierrec/hare-bmp

You can also use your local clone with git send-email.

#hare-bmp

This package provides an implementation of the BMP Image Format. Only the 8bpp with 256 palette, 24bpp and 32bpp formats are supported.

https://www.digicamsoft.com/bmp/bmp.html

https://en.wikipedia.org/wiki/BMP_file_format

#Installation

#System-wide installation

make install

#Vendoring

git subtree -P vendor/hare-bmp/ add https://git.sr.ht/~pierrec/hare-bmp main

#Usage

#Encoding

use image::bmp;
use io;

fn run(src: io::handle, width: u32, height: u32, pixels: []u8) (void | io::error) = {
        const img = bmp::image {
                width = width,
                height = height,
                pixels = pixels,
                ...
        };
        bmp::encode(src, img)?;
};

#Decoding

use image::bmp;
use io;

fn run(src: io::handle) (void | bmp::error) = {
        const img = bmp::decode(src)?;
};