A Java Spring Boot application for extracting EXIF metadata from JPEG images using the Apache Commons Imaging library. This tool provides an easy-to-use REST API for uploading images and retrieving metadata, presenting data in a clear key-value format for easy frontend rendering.
- 📸 Dynamic Metadata Extraction: Extracts detailed EXIF metadata like camera model, date, GPS coordinates, shutter speed, and more.
- ⚙️ Automatic Parsing: Dynamically handles new metadata fields without needing updates.
- 📝 Clean Key-Value Format Rendering: Renders metadata in a readable format for easy integration into any UI.
- 🛠 Robust API: RESTful endpoints for image upload and metadata retrieval.
- 🚦 Error Handling: Comprehensive error handling to ensure seamless user experience.
- Backend: Java 17, Spring Boot 3.3.4
- Dependency: Apache Commons Imaging (for image metadata extraction)
- Build Tool: Maven
- Testing: Postman for API testing
- 🔌Prerequisites
Ensure you have the following installed on your system:
- Java 17 or higher
- Maven 3.8+
- Any IDE (IntelliJ IDEA or Eclipse IntelliJ IDEA recommended)
- 🔌Prerequisites
Ensure you have the following installed on your system:
-
Clone the Repository
git clone https://github.com/hey-its-d2t2/MetaImage.git cd ImageMetadataExtractor
-
Build the Project
mvn clean install
-
Run the Application
mvn spring-boot:run
-
Access the application You can test the application at your localhost by hitting the endpoint at
http://localhost:8080
[Note configure your port inapplication .properties
file asserver.port=8080
] -
Access the API You can test the API using Postman or cURL by hitting the endpoint at
http://localhost:8080/api/metadata/upload
This project uses Apache Commons Imaging to parse EXIF data from JPEG files, which allows us to dynamically access metadata fields and display them in key-value format. The library provides flexible methods for working with image metadata, making it ideal for this kind of application.
-
Upload Image and Extract Metadata
- Endpoint:
/api/metadata/upload
- Method:
POST
- Description: Upload a JPEG image to retrieve EXIF metadata.
- Endpoint:
-
Request:
- Multipart/form-data with the image file.
-
Response:
- application/json with extracted metadata as key-value pairs.
-
Sample Request (using cURL)
curl -X POST http://localhost:8080/api/metadata/upload -F "image=@/path/to/image.jpg"
-
Example JSON Response
{ "metadata": { "Make": "Canon", "Model": "Canon EOS 1200D", "DateTimeOriginal": "2019:09:04 13:27:40", "ExposureTime": "1/60", "FNumber": "4", "ISO": "800", "FocalLength": "55mm", "GPSLatitude": "37.7749", "GPSLongitude": "-122.4194" } }
Errors are returned in a standardized JSON format:
-
404 Not Found: Requested resource does not exist.
-
400 Bad Request: Invalid image format or unsupported file type.
-
500 Internal Server Error: Unexpected errors.
-
Example:
{ "error": "Invalid image format", "message": "Please upload a valid JPEG image." }
Screenshots: The UI provides an intuitive display of the metadata in an easy-to-read format.
In application.properties
, you can set any configuration specifics for logging, server port, etc.
# Example application.properties configurations
server.port=8080
logging.level.org.springframework=INFO
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a branch: git checkout -b feature/your-feature.
- Commit your changes: git commit -m "Add feature".
- Push to the branch: git push origin feature/your-feature.
- Submit a pull request for review.
This project is licensed under the MIT License - see the LICENSE file for details.
- Apache Commons Imaging: For its robust image metadata extraction.
- Spring Boot: Providing a framework to build a scalable backend.
- Community Contributors: Thanks to everyone who has contributed!
All contributions big or small are highly appreciated! Feel free to improve the documentation, fix bugs, or add new features.
Feel free to reach out to Mail or via GitHub issues or discussions.