Image Metadata
Extract detailed metadata information from images, including dimensions, format, EXIF data, and more.
POST
/api/image/metadata
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
file | File | Yes | The image file to extract metadata from. Supported formats: JPEG, PNG, WebP, BMP, TIFF, GIF, HEIC. |
Response
Returns a JSON object containing detailed metadata information about the image.
Example Request
// example.sh
curl -X POST "https://oyyi.xyz/api/image/metadata" -H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "file=@image.jpg"
Example with Python
// get_metadata.py
import requests
import json
url = "https://oyyi.xyz/api/image/metadata"
files = {
'file': open('image.jpg', 'rb')
}
response = requests.post(url, files=files)
# Parse the JSON response
metadata = response.json()
print(json.dumps(metadata, indent=2))
Example with JavaScript
// get_metadata.js
// Using fetch API
const formData = new FormData();
formData.append('file', fileInput.files[0]);
fetch('https://oyyi.xyz/api/image/metadata', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(metadata => {
console.log(metadata);
// Display or process the metadata
})
.catch(error => console.error('Error:', error));
Example Response
// response.json
{
"basic": {
"format": "JPEG",
"mode": "RGB",
"width": 1920,
"height": 1080,
"size_bytes": 2457600,
"size_formatted": "2.34 MB"
},
"exif": {
"make": "Canon",
"model": "Canon EOS 5D Mark IV",
"software": "Adobe Photoshop CC 2020",
"datetime": "2023-05-15T14:30:22",
"exposure_time": "1/125",
"f_number": 5.6,
"iso": 100,
"focal_length": "50mm"
},
"color": {
"color_mode": "RGB",
"bit_depth": 24,
"has_alpha": false,
"is_grayscale": false,
"color_profile": "sRGB IEC61966-2.1"
},
"compression": {
"compression_type": "JPEG",
"quality_estimate": 92
},
"gps": {
"latitude": 37.7749,
"longitude": -122.4194,
"altitude": 0
}
}
Response Structure
Field | Description |
---|---|
basic | Basic image information:
|
exif | EXIF metadata (if available and included):
|
color | Color information:
|
compression | Compression information:
|
gps | GPS information (if available and included):
|
iptc | IPTC metadata (if available and included):
|
xmp | XMP metadata (if available and included):
|
How It Works
The metadata endpoint extracts and analyzes various types of metadata embedded in image files:
- Basic Analysis: The image file is analyzed to determine basic properties like format, dimensions, and file size.
- EXIF Extraction: If present and requested, EXIF metadata is extracted from the image. EXIF data is commonly found in JPEG and TIFF files from digital cameras.
- GPS Parsing: If GPS data is present in the EXIF metadata and requested, it is parsed and converted to standard latitude/longitude format.
- IPTC/XMP Extraction: If present and requested, IPTC and XMP metadata is extracted. These formats are commonly used for copyright, authorship, and other professional metadata.
- Color Analysis: The image's color properties are analyzed, including color mode, bit depth, and color profile information.
- Compression Analysis: For compressed formats like JPEG, information about the compression method and quality is estimated.
The result is a comprehensive JSON object containing all available metadata about the image.
Error Responses
Status Code | Description |
---|---|
400 | Bad request. Missing required parameters, invalid include_* parameters, or invalid file format. |
413 | Payload too large. The file size exceeds the maximum allowed limit. |
500 | Internal server error. Something went wrong on the server. |
Notes
- Not all image formats contain all types of metadata. For example, PNG files typically don't contain EXIF data.
- Some image editing software may strip metadata when saving images. If you don't see expected metadata, check if it was preserved during editing.
- GPS data may be absent or intentionally removed from images for privacy reasons.
- The quality estimate for JPEG images is an approximation and may not match the exact quality setting used when the image was saved.
- The maximum file size allowed is 20MB.
- Setting
include_xmp
to true may significantly increase the response size for images with extensive XMP metadata. - For privacy reasons, consider setting
include_gps
to false if you're processing images from users and don't need location data.
Use Cases
- Analyzing image properties for quality control
- Extracting camera settings for photography applications
- Verifying image dimensions before processing
- Extracting location data for geo-tagging applications
- Retrieving copyright and authorship information
- Analyzing image compression for optimization
- Building image management systems with metadata-based organization
- Verifying image authenticity by examining metadata