Rusty engine

Metadata
creation year: 2021
Glitched icon for rusty engine

This project is a tiny image manipulation library with four different functions and provides an efficient way to perform CPU intensive tasks.

It's written in Rust but is precompiled for Linux, macos and windows that can be called from a Ruby file through FFI.

Ruby setup

The project is already precompiled in three different c libraries (stored in lib/bin) :

  1. librusty_engine.dll (windows)
  2. librusty_engine.dylib (macos)
  3. librusty_engine.so (linux)

Therefore if you want to use it in a ruby script you can simply install the rusty_engine gem and simply require 'rusty_engine_ffi'.

Usage

Converter

Example :

require 'rusty_engine_ffi'

RustyEngine.convert('images/input.jpg', 'images/output.jpg')

Arguments :

  1. input file path
  2. output path file

Slim

Example :

require 'rusty_engine_ffi'

RustyEngine.slim('images/input.jpg', 'images/output.jpg', '90', 'global', '3', 'red', '99')

Arguments :

  1. input file path
  2. output path file
  3. probability
  4. probability area
  5. direction
  6. colors
  7. colors probabilities

Brush

Example :

require 'rusty_engine_ffi'

RustyEngine.brush('images/input.jpg', 'images/output.jpg', '90', '5', '10', '2')

Arguments :

  1. input file path
  2. output path file
  3. probability
  4. min
  5. max
  6. direction

Pixel sorting

Example :

require 'rusty_engine_ffi'

RustyEngine.sort('images/input.jpg', 'images/output.jpg', '1', 'true', '0', '0', '30', 'true', '60', '100', '0')

Arguments :

  1. input file path
  2. output path file
  3. smart sorting
  4. detection type
  5. min
  6. max
  7. multiple range
  8. min 2
  9. max 2
  10. sorting by

Development

Project architecture

Compilation

To compile this project you need the following softwares installed on you machine :

For compiling the rust code for your architecture : cargo build --release

For cross compilation, use cross :

Windows cross build --release --target x86_64-pc-windows-gnu

Linux cross build --release --target x86_64-unknown-linux-gnu

The compiled library is now available in the target/release/ directory.

Icon

Icons made by Freepik from www.flaticon.com