Navigate back to the homepage


Interstellar design

UX/UI design, Web and Native App develeopement.

about meHow it's doneContact
Link to $ to $ to $ to $ to $ to $ to $


Luke Celitan
category: project, reading time: 2 min
Version Documentation License: MIT Twitter: spaceoutPL


In recent times I have decided to start learing a new programming language. Out of all the possibilities I have found Rust to be the most suitable. Rust is a safe, fast, and memory safe language for writing software, I see a lot of potential in Rust esspeciall in building software for future IoT devices. Rust is also a heavily typed proggraming language which makes it easy to write code that is more readable and easy to debug.

I have embarked on a mission to build something useful with it, the idea for rewritting my previous optimization intercative cli build with typescript to rust came as an obvious choice for me.


Rust cli for batch optimizing images

Cargo-imagermachine was designed as a subtool of cargo package manger, so user can run the interactive cli from the command line inside folders that contain pictures.

Imagermachine uses turbo-jpeg library for jpeg files optimization and oxi png for png images. You must install the turbo-jpeg yourself as the cli uses only the bindings to the turbo-jpeg library. Installation guide for respective systems below.

Imagermachine can:

  • Optimize png and jpg images.
  • Resize and crop images.
  • Rename the transformed files based on providedname(index).ext
  • Convert files to Webp
  • todo: set optimalisation custom config


So far the cli has been tested on unix systems (Debian, Mac).
Before using cargo-imagermachine you must install


Follow the official guideline for installing rust on your system


Offical webiste and documentation 👉


1sudo apt-get install libturbojpeg libturbojpeg0-dev

This should be enough to get started on Ubuntu


1brew install jpeg-turbo

! Remember to copy all the export paths that brew will print out after installation, I am using the following config in the cargo.toml file, pkg-config (also via brew) installation is needed for this setup to work.

1turbojpeg = {version = "0.4", features = ["image", "pkg-config"]}

If you have troubles linking the cli to your libturbo, you can try to edit the cargo.toml file and add feature flags into turbojpeg features array, for more reference follow this link.

Screenshot of cargo-imagermachine


In order to install cargo-imagermachine on your computer, clone the project then run the following command from the project folder:

1cargo install --path .


If you followed the offical rust documentation and cargo / rustc is in scope, navigate to a input folder and run

1cargo imagermachine

Follow directions on the interactive cli to optimize, resize, rename the images.

Show your support

Give a ⭐️ if this project helped you!