Function oliframe::add_border

source ·
pub fn add_border(
    img: &DynamicImage,
    width: BorderWidth,
    color: &Color,
    radius: Option<u32>
) -> RgbaImage
Expand description

Adds a border to the given image

§Arguments

  • img - The image to add a border to
  • width - The width of the border, either in pixels or as a percentage of the average dimension
  • color - The color of the border
  • radius - The radius of the border corners, in pixels

§Returns

A new image with the border added

§Examples

use oliframe::{add_border, BorderWidth};
use oliframe::image::DynamicImage;
use oliframe::Color;

let img = DynamicImage::new_rgb8(100, 100);
let border = add_border(&img, BorderWidth::Pixels(10), &"red".parse::<Color>().unwrap(), None);