JPEGLI Optimizer is a simplistic, drag-and-drop GUI-based desktop tool designed to be an open source based alternative of JPEGmini. It uses Computer Vision (OpenCV) to analyze every image individually—detecting noise, texture, and edges—to calculate the compression level. It then uses the jpegli encoder to compress the image without visible quality loss.
- Smart Compression: Automatically determines the best quality setting based on image content (Texture/Noise/Edge analysis).
- Drag & Drop: Simple GUI to process single files or huge batches instantly.
- Metadata Safe: Preserves all EXIF, IPTC, and XMP data using ExifTool, including file created and modified dates.
- Safety Checks: Only overwrites the file if the file size is actually reduced.
- Resize Options: Optional downscaling for web optimization.
- High Efficiency: Powered by the new JPEG XL library's
cjpegliencoder (backward compatible with standard JPEG).
Unlike standard compressors that apply a static quality (e.g., Quality 85%) to every image, this tool analyzes the "perceptual complexity" of a photo:
- High Texture/Noise: The tool allows aggressive compression because the texture hides artifacts.
- Flat Areas/Skies: The tool increases quality to prevent banding and blocking.
- Text/Sharp Edges: The tool protects edges to ensure sharpness.
Install the required Python libraries:
pip install tkinterdnd2-universal pillow opencv-python numpy pywin32-
cjpegli: Download the libjxl binaries (jxl-x64-windows-static.zip) from github.com/libjxl/libjxl/releases, extract
cjpegli.exeand place in a folder named jxl inside the project root. -
ExifTool: Download the "Windows Executable" zip from exiftool.org. Extract the zip content into the project root. You should have
exiftool(-k).exeand theexiftool_filesfolder side-by-side with the python script. Renameexiftool(-k).exetoexiftool.exe.
Ensure your directory looks like this:
/Project_Folder
│
├── JPEGli_opt.py # This script
├── exiftool.exe # For metadata preservation
└── /jxl
└── cjpegli.exe # The encoder
- Run the script:
Or double-click the py file.
python optimizer.py
- Toggle "Auto-optimize": Enables the computer vision analysis.
- Backup": Make a back-up of your existing image files.
- Drag and drop your
.jpg/.jpegfiles onto the window. - The tool will replace the original files only if they can be compressed smaller without visual loss.
As shown in this XnView comparison view—with the JPEGmini result above and the script output below—the visual similarity is nearly identical, though this script retains slightly more detail, less blurriness and blockiness when compared at 400% zoom level. Pictured are tiny rocks on the sole of the shoe.
27 diverse JPEG images including portraits, landscapes, architecture, text graphics, and various lighting conditions.
Total images: 27
✓ Processed: 23
⊘ Skipped: 4 (already optimized)
✗ Errors: 0
Original: 65.88 MB
New size: 45.66 MB
Saved: 20.22 MB (30.7% reduction)
Distance distribution:
The adaptive algorithm selected distances based on image characteristics:
- 0.65 (Conservative): 10 images - Low texture, smooth areas, portraits
- 0.80 (Moderate): 4 images - Medium complexity
- 1.00 (Balanced): 2 images - Mixed content
- 1.20 (Aggressive): 11 images - High texture, complex scenes
Total images: 27 (all except one processed)
Original: 65.88 MB
Saved: 20.73 MB (36% reduction)
The JPEGLI optimizer achieved 30.7% compression vs JPEGmini's 36% - a difference of only 5.3%. The JPEGLI optimizer's conservative approach skips optimized images and preserves fine details better, making it a quality-first open source alternative to commercial solutions.