Skip to content

JacobDev1/xl-converter

Repository files navigation

XL Converter

Easy-to-use image converter for modern formats.

Available for Windows and Linux.

Read the Manual

Features

JPEGLI

Generate fully compatible JPEG images with up to 35% better compression ratio.

Format Support

Maximize image compression with JPEG XL and AVIF. Also available: WebP, JPEG, and PNG.

Parallel Encoding

Run encoders in parallel for increased throughput.

Lossless JPEG Transcoding

Reduce the file size of your JPEG images by 16% - 22% with Lossless JPEG Transcoding. This process is reversible.

Downscaling

Scale down images to resolution, percent, shortest (and longest) side, and megapixels.

Download

Official website

Building from Source

Note

The recommended way of using XL Converter is through the official binary releases. The building process is time-consuming and tedious.

Windows 10

Install:

Clone the repo.

git clone -b stable --depth 1 https://github.com/JacobDev1/xl-converter.git
cd xl-converter

Provide tool binaries.

Setup venv.

python -m venv env_build
env_build\Scripts\activate.bat
pip install -r requirements.txt

Install redistributable

Run the application.

python main.py

Building

Bundling requires recompiling the bootloader to prevent Windows from deleting the EXE (due to false positives).

Install MSYS2 and launch MINGW64.

pacman -Syu
pacman -S --needed git cmake mingw-w64-x86_64-gcc

Close the MSYS2 terminal and launch CMD inside project's root directory.

Clone PyInstaller.

env_build\Scripts\activate
git clone -b v6.11.1 --depth 1 https://github.com/pyinstaller/pyinstaller.git misc\pyinstaller

Recompile the bootloader.

cd misc\pyinstaller\bootloader
set PATH=C:\msys64\mingw64\bin;%PATH%
python waf all --gcc
cd ..
pip install .
cd ..\..

Reload the environment to avoid the ModuleNotFoundError error.

deactivate
env_build\Scripts\activate

Bundle:

python build.py

Linux (Ubuntu-based)

Install packages.

sudo apt update
sudo apt install git make curl fuse p7zip-full

Install xcb QPA dependencies.

sudo apt install '^libxcb.*-dev' libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev

Install pyenv via Automatic installer then add it to shell

Install Python build packages.

sudo apt install wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev liblzma-dev

Compile and setup Python 3.13.

pyenv install 3.13
pyenv global 3.13

Clone and set up the repo.

git clone -b stable --depth 1 https://github.com/JacobDev1/xl-converter.git
chmod -R +x xl-converter
cd xl-converter

Provide tool binaries.

Create and activate a virtual environment.

python -m venv env_build
source env_build/bin/activate

Install Python dependencies

pip install -r requirements.txt

Now, you can run it.

python main.py

Building

Make sure GCC is installed (build-essential).

Recompile the bootloader:

source env_build/bin/activate
git clone -b v6.11.1 --depth 1 https://github.com/pyinstaller/pyinstaller.git misc/pyinstaller
cd misc/pyinstaller/bootloader
python waf all --gcc
cd ..
pip install .
cd ../..

Reload the environment to avoid the ModuleNotFoundError error.

deactivate
source env_build/bin/activate

Build:

python build.py

Providing Tool Binaries

To build XL Converter, you need to provide various binaries. This can be quite challenging.

Tip

Use the official builds as a reference.

Libraries:

Below you'll find references on how to arrange the binaries. You will also need to add dependencies alongside them.

Linux (x86_64)

./xl-converter/bin/linux/
├── avifdec
├── avifenc
├── cjpegli
├── cjxl
├── djxl
├── imagemagick
│   └── magick
├── jpegtran
├── jxlinfo
└── oxipng

Windows (x86_64)

./xl-converter/bin/win/
├── exiftool
│   ├── exiftool.exe
│   └── exiftool_files
├── imagemagick
│   └── magick.exe
├── jpegtran
│   └── jpegtran.exe
├── libavif
│   ├── avifdec.exe
│   └── avifenc.exe
├── libjxl
│   ├── cjpegli.exe
│   ├── cjxl.exe
│   ├── djxl.exe
│   └── jxlinfo.exe
└── oxipng
    └── oxipng.exe

On Windows, I recommend using MSYS2 MINGW64 for building.

Note

When building libjpeg-turbo, embed this manifest into jpegtran.exe with mt.exe from Visual Studio. This enables a UTF-8 support in arguments.

Tip

Use ldd in MSYS2 to check which DLLs need bundling alongside the executables.

Info

Tip

To manage multiple Python versions on Windows, you can use: py launcher, pyenv-win, Scoop or Chocolatey.

Testing

Setup repo.

Create a test environment.

python -m venv env_dev
source env_dev/bin/activate
pip install -r requirements.txt -r requirements_test.txt

Unit Tests

python test.py

You can control which tests to run. Run python test.py --help to learn more.

Functional Tests

test_convert.py is a separate test suite focusing on validating program's output.

Linux

sudo apt install xvfb
make test-convert

Windows

python test_convert.py