An Android image compression application built using Jetpack Compose and Material3. This project allows users to pick images from their gallery, display the selected image, compress it, and save the compressed version to the Downloads folder. The project follows a modern architecture and clean coding practices, ensuring professional code quality, separation of concerns, and proper state management.
- Image selection using Android's native media picker.
- Image compression functionality with configurable threshold.
- Automatic saving of compressed images to the Downloads folder.
- Dynamic UI updates with Jetpack Compose, including compression state handling.
- Permissions handling, following modern Android scoped storage policies.
- Toast notifications to provide user feedback on compression success or failure.
- Kotlin - Main programming language
- Jetpack Compose - Modern toolkit for building native UI
- Material3 - UI components for an up-to-date design
- Coroutines - Asynchronous programming and background tasks
- Android Scoped Storage - For safe, modern file handling without requiring legacy permissions
- ActivityResultContracts - For handling image picking and permissions in a cleaner, more efficient way
This project is organized to maintain a clean architecture:
MainActivity
: The main entry point of the application.PhotoPickerScreen
: The composable screen that handles image picking, compression, and user interactions.ImageCompressor
: A helper class for compressing images based on a size threshold.FileManager
: Handles file saving, ensuring images are stored in the appropriate location (Downloads folder).PermissionManager
: Manages permission requests (if necessary).ToastManager
: Displays toasts for user feedback on events like success or failure.
-
Clone the repository:
git clone https://github.com/sijan8s3/Image-Compressor.git
-
Open the project in Android Studio.
-
Run the project on an Android device (targeting Android 10 or higher).
-
Use the app to select an image, view it, and compress it.
-
Compressed images will be saved in the Downloads folder with the name format
filename_compressed.extension
.
This project uses Android's Scoped Storage policies, so manual permissions for external storage are no longer required for image picking or saving. If you're targeting Android 9 (API 28) or below, you might need to request storage permissions.
To run the project locally:
- Clone the repository.
- Open the project in Android Studio.
- Ensure you have the necessary SDK (Android 10+).
- Build and run the app on a device or emulator.
- Jetpack Compose: For declarative UI building.
- Material3: For modern UI components and theming.
- Coil: For loading and displaying images efficiently.
- Coroutines: For handling background tasks and operations.
If you'd like to contribute, feel free to open a pull request or report issues. Contributions are always welcome!
Feel free to reach out if you have any questions or suggestions!