Oyyi

Image Metadata

Extract detailed metadata information from images, including dimensions, format, EXIF data, and more.

POST /api/image/metadata

Request Parameters

ParameterTypeRequiredDescription
fileFileYesThe 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

FieldDescription
basic

Basic image information:

  • format: The image format (JPEG, PNG, etc.)
  • mode: The color mode (RGB, RGBA, etc.)
  • width: The image width in pixels
  • height: The image height in pixels
  • size_bytes: The file size in bytes
  • size_formatted: The file size in a human-readable format
exif

EXIF metadata (if available and included):

  • make: Camera manufacturer
  • model: Camera model
  • software: Software used to create/edit the image
  • datetime: Date and time when the image was taken
  • exposure_time: Exposure time (shutter speed)
  • f_number: F-number (aperture)
  • iso: ISO speed
  • focal_length: Focal length of the lens
  • And other EXIF tags if present
color

Color information:

  • color_mode: The color mode (RGB, CMYK, etc.)
  • bit_depth: The bit depth per channel
  • has_alpha: Whether the image has an alpha channel
  • is_grayscale: Whether the image is grayscale
  • color_profile: The color profile name if available
compression

Compression information:

  • compression_type: The compression algorithm used
  • quality_estimate: Estimated quality level for JPEG images
gps

GPS information (if available and included):

  • latitude: The latitude coordinate
  • longitude: The longitude coordinate
  • altitude: The altitude in meters
iptc

IPTC metadata (if available and included):

  • caption: Image caption/description
  • copyright: Copyright information
  • keywords: Keywords/tags associated with the image
  • creator: Creator/photographer name
  • And other IPTC fields if present
xmp

XMP metadata (if available and included):

  • Various XMP fields depending on the image

How It Works

The metadata endpoint extracts and analyzes various types of metadata embedded in image files:

  1. Basic Analysis: The image file is analyzed to determine basic properties like format, dimensions, and file size.
  2. 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.
  3. GPS Parsing: If GPS data is present in the EXIF metadata and requested, it is parsed and converted to standard latitude/longitude format.
  4. 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.
  5. Color Analysis: The image's color properties are analyzed, including color mode, bit depth, and color profile information.
  6. 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 CodeDescription
400Bad request. Missing required parameters, invalid include_* parameters, or invalid file format.
413Payload too large. The file size exceeds the maximum allowed limit.
500Internal 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