#banner #minecraft #image-generation #image

mcbanner

A simple library to generate Minecraft banner images

2 releases

0.1.1 Feb 23, 2024
0.1.0 Feb 23, 2024

#908 in Images

MIT license

26KB
225 lines

MCBanner

A simple library to generate Minecraft banner images.

It uses the image under the hood for the image generation.

Usage

Add this to your Cargo.toml:

[dependencies]
mcbanner = "0.1.1"

Example

The Banner struct is the main entrypoint of the library.

use mcbanner::{Banner, Pattern, MCColor};

fn main() {
    let mut banner = Banner::new(MCColor::Lime);
    banner.add_pattern(Pattern::Creeper, MCColor::Black);
    banner.render();
    banner.save("banner.png").unwrap();
}

Running this example code gives you the next result:

License

This project is licensed under the MIT License - see the LICENSE file for details.


lib.rs:

Overview

This library is a simple way to create Minecraft banner images. It uses the image crate under the hood for the image generation.

Usage

The [Banner] struct is the main entrypoint of the library.

use mcbanner::{Banner, Pattern, MCColor};

fn main() {
    let mut banner = Banner::new(MCColor::Red);
    banner.add_pattern(Pattern::Bricks, MCColor::Orange);
    banner.render();
    banner.save("banner.png").unwrap();
}

Dependencies

~6–13MB
~124K SLoC