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.
The project is already precompiled in three different c libraries (stored in lib/bin
) :
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'
.
Example :
require 'rusty_engine_ffi'
RustyEngine.convert('images/input.jpg', 'images/output.jpg')
Arguments :
Example :
require 'rusty_engine_ffi'
RustyEngine.slim('images/input.jpg', 'images/output.jpg', '90', 'global', '3', 'red', '99')
Arguments :
Example :
require 'rusty_engine_ffi'
RustyEngine.brush('images/input.jpg', 'images/output.jpg', '90', '5', '10', '2')
Arguments :
Example :
require 'rusty_engine_ffi'
RustyEngine.sort('images/input.jpg', 'images/output.jpg', '1', 'true', '0', '0', '30', 'true', '60', '100', '0')
Arguments :
src/
contains the Rust codetarget/
contains the compiled rust code (this directory is not present in git)lib/
contains the files included in the gemlib/bin/
contains the compiled rust libraries for osx, linux and windowslib/rusty_engine.rb
is the ruby file that uses FFI to call the libraries inside lib/bin/
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.
Icons made by Freepik from www.flaticon.com