#pixel-art #nearest-neighbor #graphics #scale2x

magnify

Simple pixel-art scaling algorithms

2 unstable releases

0.2.0 Aug 7, 2024
0.1.0 Jul 3, 2023

#295 in Images

26 downloads per month

EUPL-1.2

11KB
190 lines

Magnify-rs

This is a rust library implementing some simple Pixel-art scaling algorithms.

Currently supported algorithms

  • Scale2x, Scale3x
  • Eagle
  • Nearest neighbor scaling

Example

This code scales image.bmp using the Scale3X algorithms and then saves the result into converted.bmp.

use image::ImageReader;
use magnify::Algorithm;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let img = ImageReader::open("image.bmp")?.decode()?;

    let converted_img = magnify::convert(img, Algorithm::Scale3X);
    converted_img.save("converted.bmp")?;

    Ok(())
}

Dependencies

~2.5MB
~52K SLoC