#image-resizing #resize #color-space #alpha #sharp #linear #bilinear

bin+lib sharpened_bilinear

使用预乘 alpha 在线性颜色空间中进行锐化双线性图像缩放

1 个稳定版本

1.0.0 2024年5月15日

#522 in 数学

MIT 许可证

2.5MB
484

锐化双线性

锐化双线性是一个图像缩放库和命令行工具,它使用修改后的双线性插值算法来产生锐化、准确的图像。它支持具有预乘 alpha 的缩放,并在线性空间中操作以避免亮度失真。

安装

要将 Sharpened Bilinear 作为命令行工具使用,请使用 Cargo 安装它

cargo install sharpened_bilinear

要将 Sharpened Bilinear 作为库使用,请将以下内容添加到您的 Cargo.toml

[dependencies]
sharpened_bilinear = "1.0.0"

用法

命令行工具

USAGE: sharpened_bilinear <INPUT> [OPTIONS]

ARGS:
  <INPUT>         Input file path (required)

OPTIONS:
  --output PATH   Output file path
  --factor NUMBER Scale factor
  --width  NUMBER Output image width in pixels
  --height NUMBER Output image height in pixels

Defaults:
  sharpened_bilinear <INPUT> -o <INPUT>_resized.png -f 1.0

If only one of the keys '-w' or '-h' is given, the
the second dimension preserves the aspect ratio or
determined from the '-f' key if factor given.

let input_image = image::open("input.png").unwrap();
let resized_image: image::DynamicImage =
    sharpened_bilinear::resize(&input_image, width, height).into();
resized_image.save("output.png").unwrap();

许可证

Sharpened Bilinear 在 MIT 许可证下授权。

依赖关系