To draw a circle, we can use draw_filled_circle_mut. The function needs the center position and the radius of the circle.
use imageproc::{drawing, image};
fn main() {
let mut buf = image::ImageBuffer::new(100, 100);
drawing::draw_filled_circle_mut(
&mut buf,
(50, 50),
30,
image::Rgb::from([128u8, 255u8, 64u8]),
);
buf.save("circle.png").unwrap();
}circle.png:
To only draw the border, we can use draw_hollow_circle_mut.
To draw on a copied image, we can use draw_filled_circle and draw_hollow_circle.
➡️ Next: Drawing Ellipses
📘 Back: Table of contents

