A cross-platform desktop application and web API for enhancing images using Real-ESRGAN AI models and converting them to modern, efficient formats like WebP and AVIF.
- Features
- Profile Management
- Solution Structure
- How it Works
- API Endpoints
- Screenshots
- Processing Options Explained
- Settings
- Prerequisites and Downloads
- Required Files
- Getting Started
- Technologies Used
- Contributing
- License
- Disclaimer
- Configuration Profiles: Save and load entire processing configurations for repeatable workflows.
- Auto-Load Last Profile: The application automatically loads your last-used profile on startup.
- AI-Powered Upscaling: Enhance image resolution by 4x using state-of-the-art Real-ESRGAN models.
- Modern Format Conversion: Convert images to high-efficiency formats like
.webpand.avif. - Batch Processing: Process entire folders of images, including subfolders, in one go.
- Cross-Platform: Runs on Windows, macOS, and Linux.
- Dual Interface: Use the simple and intuitive desktop GUI (built with Avalonia) or the headless Web API for programmatic access.
- Detailed Progress Display: Track overall and per-folder progress with details on file counts and space savings.
- UI/UX Enhancements:
- Drag and Drop support for selecting folders.
- Maximized window on startup for a better view.
- Dark & Light themes.
- Input validation and clear user feedback.
- Processing Log: Keep track of all processed images.
The application now supports saving your settings into named profiles.
- Saving a Profile: Configure your desired settings (folders, model, options) on the main window. Type a name in the text box next to the "Save as Profile" button and click it. The button will be disabled if the name is empty.
- Loading and Deleting Profiles: Click the "Profiles..." button at the top right to open the Profile Manager. From there, you can select a profile to either load its settings or delete it permanently.
The solution is divided into four projects:
ImageProcessor.Core: A .NET library project that contains the core logic for image processing. It orchestrates the command-line tools to perform image enhancement and conversion.ImageProcessor.Api: An ASP.NET Core web API that exposes the image processing functionality as a web service.ImageProcessor.UI: A desktop application built with Avalonia UI that provides a graphical user interface.image-processor-web: A React-based web application that consumes the API.
The application uses a pipeline of command-line tools to process images:
- Upscaling (Optional): If enabled, the source image is first passed to
realesrgan-ncnn-vulkanto be upscaled. - Conversion (Optional): The (potentially upscaled) image is then converted to either
.webpusingcwebp.exeor.avifusingffmpeg.exe. - File Handling: The application manages the creation of output folders and the deletion of intermediate and source files.
The API uses a job-based system to handle processing requests asynchronously.
The API provides endpoints for starting and monitoring processing jobs.
Starts a new image processing job. The request body must be a JSON object with the processing options. The response will contain a jobId that can be used to track the status of the job.
Example JSON Body:
{
"inputFolder": "C:\\path\\to\\your\\images",
"outputFolder": "C:\\path\\to\\output",
"model": "realesrgan-x4plus",
"processSubfolders": true,
"convertToWebP": true,
"convertToAvif": false,
"applyUpscale": true,
"deleteSourceFile": false,
"includeWebPFiles": false,
"includeAvifFiles": false
}Gets the current status of a processing job.
Gets the complete progress history of a processing job.
(Note: The screenshot below is outdated and will be updated soon to reflect the latest UI changes.)
The main window provides several options to customize the image processing workflow.
| Option | Description |
|---|---|
| Use input folder as output folder | If checked, the output files will be saved in the same folder as the input files. This disables the output folder selection. |
| AI Model | Selects the Real-ESRGAN AI model to use for the upscaling process. Different models are trained for specific types of content. |
| Show Preview | A ToggleSwitch to show or hide the image preview panel. |
| Apply 4x Upscale | If checked, the AI-powered upscaling process is applied to the images. If unchecked, the application will only perform format conversion. |
| Convert to .WebP | If checked, the final image will be converted to the .webp format. |
| Convert to .AVIF | If checked, the final image will be converted to the .avif format using ffmpeg. |
| Process Subfolders | If checked, the application will search for images in all subdirectories of the selected input folder. |
| Include .WebP Files | If checked, existing .webp files in the source folder will be included in the processing queue. |
| Include .Avif Files | If checked, existing .avif files in the source folder will be included in the processing queue. |
| Delete Source Files | (Use with caution!) If checked, the original source image will be permanently deleted after it has been successfully processed. |
π‘ Note
Conversion quality settings for WebP and AVIF can be found in the Settings window (click the βοΈ icon).
The settings window allows for more advanced configuration.
| Setting | Description |
|---|---|
| WebP Quality | A slider (1-100) to control the quality of the WebP conversion. Higher values result in better quality and larger file sizes. |
| AVIF Quality | A slider (1-100) to control the quality of the AVIF conversion. Higher values result in better quality and larger file sizes. |
| Real-ESRGAN Command Line Arguments | Allows customization of the command-line arguments passed to the realesrgan-ncnn-vulkan executable for advanced users. |
π‘ Note
For now, all Microsoft Windows prerequisites are included in the release package, available inside the compressed file: [https://github.com/specializeddevel/ia_image_enhancer_csharp/releases]
To build and run this project from source, you will need the .NET 9 SDK.
- Download: Download .NET 9 SDK
For the application to function correctly, you need to either build from source and acquire the files listed below, or use a pre-compiled version.
This is an example of the required folder structure for running ImageProcessor.UI from the packaged release on Windows. The same structure applies to ImageProcessor.Api.
ImageProcessor.UI
ββ models/ # realesrgan models
ββ realesr-animevideov3-x2.bin
ββ ...
ββ cwebp.exe # Compression Windows executable
ββ ffmpeg.exe # Ffmpeg Windows executable
ββ ImageProcessor.UI.exe # Main ImageProcessor User Interface executable.
ββ realesrgan-ncnn-vulkan.exe # AI model Windows executable
If you are running the project from source, make sure the required files follow this structure:
ia_image_enhancer_csharp/
ββ ImageProcessor.UI/
ββ bin/
ββ Debug/
ββ net9.0/
ββ models/ # realesrgan models
ββ realesr-animevideov3-x2.bin
ββ ...
ββ cwebp.exe # Compression Windows executable
ββ ffmpeg.exe # Ffmpeg Windows executable
ββ ImageProcessor.UI.exe # Main ImageProcessor User Interface executable.
ββ realesrgan-ncnn-vulkan.exe # AI model Windows executable
π‘ Note The /bin folder will be generated automatically after the first successful build.
This application relies on external command-line tools. These must be placed in the main application directory.
- Real-ESRGAN (realesrgan-ncnn-vulkan):
- Repository: https://github.com/xinntao/Real-ESRGAN-ncnn-vulkan
- Download: Download the latest release for your platform from the releases page.
β οΈ Important
GPU Requirement: AI upscaling requires a graphics card that supports Vulkan 1.1 or higher.
-
cwebp (WebP Converter):
- Repository: [https://developers.google.com/webp]
- Download: Download the
libwebppackage for your platform from the downloads repository.
-
FFmpeg (AVIF Converter):
- Website: https://ffmpeg.org/
- Download: Download a release build for your platform from the official download page.
π‘ Note
Linux/macOS Permissions: On Linux and macOS, you must grant execution permissions to the binaries.chmod +x ./realesrgan-ncnn-vulkan chmod +x ./cwebp chmod +x ./ffmpeg
You must have a folder named models in the application's root directory. This folder must contain the .bin and .param files for the Real-ESRGAN models you intend to use.
-
Clone the repository:
git clone https://github.com/specializeddevel/ia_image_enhancer_csharp.git cd ia_image_enhancer_csharp -
Add Required Files: Follow the instructions in the Required Files section to download and place the necessary binaries and models.
-
Build the project:
dotnet build
-
Run the application:
-
To run the Desktop UI:
dotnet run --project ImageProcessor.UI
-
To run the Web API:
dotnet run --project ImageProcessor.Api
-
- .NET 9 / C#: The core application logic and UI are built with the latest version of .NET.
- Avalonia UI: A cross-platform UI framework for creating the desktop application.
- ASP.NET Core: Used to create the Web API for headless processing.
- MVVM Pattern: The Model-View-ViewModel pattern is used to structure the UI code, powered by the CommunityToolkit.Mvvm library.
- Swagger / OpenAPI: Used for API documentation and testing in the
ImageProcessor.Apiproject via the Swashbuckle.AspNetCore library.
Contributions are welcome! If you have a feature request, bug report, or pull request, please feel free to open an issue or submit a PR.
We follow a feature-branch workflow with Pull Requests for merging changes into the main branch.
This project is licensed under the MIT License - see the LICENSE.md file for details.
This project uses external, pre-compiled binaries for image processing. These binaries are provided by their respective authors and are subject to their own licenses. Please ensure you comply with their terms of use.
