| Crates.io | droidpi |
| lib.rs | droidpi |
| version | 0.1.2 |
| created_at | 2025-11-22 21:55:35.439063+00 |
| updated_at | 2026-01-07 02:42:53.74952+00 |
| description | A command-line tool for resizing images to multiple screen densities for Flutter and native Android projects. Automates icon generation for improved mobile performance. |
| homepage | https://github.com/davidgaspardev/droidpi |
| repository | https://github.com/davidgaspardev/droidpi |
| max_upload_size | |
| id | 1945787 |
| size | 101,958 |
DroiDPI is a command-line tool for resizing images to different screen densities commonly used in mobile application development. It simplifies the process of generating multiple sizes of icons for Flutter and native Android projects, helping to improve performance on various devices.
Install DroiDPI using Cargo:
cargo install droidpi
Or install a specific version:
cargo install droidpi@0.1.2
Create my_icon.png for Flutter:
.../my_icon.png (mdpi baseline)
.../1.5x/my_icon.png (hdpi)
.../2.0x/my_icon.png (xhdpi)
.../3.0x/my_icon.png (xxhdpi)
.../4.0x/my_icon.png (xxxhdpi)
Create my_icon.png for Android (default: mipmap directories):
.../mipmap-mdpi/my_icon.png
.../mipmap-hdpi/my_icon.png
.../mipmap-xhdpi/my_icon.png
.../mipmap-xxhdpi/my_icon.png
.../mipmap-xxxhdpi/my_icon.png
With --use-drawable flag:
Creates images in drawable directories instead:
.../drawable-mdpi/my_icon.png
.../drawable-hdpi/my_icon.png
.../drawable-xhdpi/my_icon.png
.../drawable-xxhdpi/my_icon.png
.../drawable-xxxhdpi/my_icon.png
To resize an image using DroiDPI, use the following command:
droidpi --src <image_path> --outdir <directory_path> --name <image_name> --platform <flutter|android> [--use-drawable]
--src <image_path>: The path to the input image file (.png, .jpg, or .jpeg).--outdir <directory_path>: The base directory where the resized images will be stored. The different densities will be created as subdirectories within this base directory, according to the selected platform.--name <image_name>: The desired name for the resized images. The resized images will be saved with this name.--platform <platform>: The target platform for which the images will be generated. Supported values: flutter or android.--use-drawable: (Android only, optional) If present, output images to drawable-*dpi directories instead of mipmap-*dpi.# For Flutter projects
droidpi --src logo.png --outdir ./assets --name logo --platform flutter
# For native Android projects (default: mipmap)
droidpi --src icon.png --outdir ./res --name ic_launcher --platform android
# For native Android projects (using drawable directories)
droidpi --src icon.png --outdir ./res --name ic_launcher --platform android --use-drawable
I'm a mobile developer, and I always have to deal with performance on more humble devices. To collaborate with performance, I need to resize my icons in five different sizes (mdpi, hdpi, xhdpi, xxhdpi, and xxxhdpi).
It's always been a pain, but it's important, and that's why I want to create this!
For always enjoying low-level development, came the idea of combining business with pleasure: develop a binary that optimizes my work.
Contributions are welcome! Please feel free to submit a Pull Request.
Clone the repository:
git clone https://github.com/davidgaspardev/droidpi.git
cd droidpi
Build the project:
cargo build
Run tests:
cargo test
Run the CLI locally:
cargo run -- --src <image_path> --outdir <directory_path> --name <image_name> --platform <platform>
This project uses automated releases via GitHub Actions. See .github/RELEASE.md for detailed instructions on publishing new versions.
This project is licensed under the MIT License - see the LICENSE-MIT file for details.
David Gaspar - davidgaspar.dev@gmail.com