smartcrop.rs
Smartcrop is a content-aware image cropping library that attempts to find the best crop for a given image and aspect ratio.
The original Javascript implementation smartcrop.js was developed by Jonas Wagner.
This is a fork of https://github.com/bekh6ex/smartcrop.rs by Bekh-Ivanov Aleksey, since the original project is unmaintained and does not support newer versions of the image crate.
It also includes a new feature: removing black borders around an image before finding the best crop.
How to use
let height = 1920;
let width = 1080;
let res = find_best_crop.expect;
let c = res.crop;
let cropped = image.crop_imm;
let scaled = cropped.resize;