Skip to main content

Media Analyzer

Media Analyzer is a Python library designed to analyze media files, providing insights into their content and metadata. It supports various functionalities, including image classification, captioning, optical character recognition (OCR), and facial recognition.

Features

  • GPS: Gather GPS coordinates from exif, and reverse geocode to get the country, province and city.
  • Exif: Extract exif data/metadata from photos, videos, gifs, etc.
  • Weather: Get weather info at the time the photo/video was taken.
    • temperature
    • dewpoint
    • relative humidity
    • precipitation
    • wind gust
    • pressure
    • sun hours
    • condition
  • Quality Detection: Detect objectively measurable quality of images:
    • Sharpness
    • Noise
    • Exposure
    • Dynamic range
    • Color clipping (white/black levels)
    • A composite score is generated, so photos can be ranked by quality.
  • Image Classification: Identify objects, scene type, activities, animals, and events present in images.
  • Image Captioning: Generate descriptive captions for images using models like BLIP or LLM-based captioners.
  • Embedding: Generate clip embeddings for images and text. Can be used to cluster images or search semantically through images.
  • Optical Character Recognition (OCR): Extract text from images to identify documents, receipts, menus, and more.
  • LLM: Get detailed image summary, more indepth than just a caption, using an LLM. Can also be used to generate a summary of a document shown in a photo or video.
  • Facial Recognition: Detect faces in images and provide details such as age, sex, bounding box, and facial landmarks. Includes an embedding of the face, which can be used for clustering.
  • Datetime Taken: Photo and video files are messy and have unreliable datetime tags. This packages uses six different methods with varying priority to get the datetime a photo is taken, including the timezone if possible.
  • Data Url: Generate data url for tiny preload thumbnail.
  • Special type detection: Detect slow motion, night sight, motion photos, and more.
  • Color Analysis: Get prominent colors from an image, with theme colors based off the colors.

Installation

To install Media Analyzer, use pip:

pip install media-analyzer

Requirements

You must have the following in PATH.

Examples

Example output of the main analyze function can be viewed at example_output.json. Further example code is available at /examples.

Usage

Here's a basic example of how to use Media Analyzer:

from media_analyzer import MediaAnalyzer
from pathlib import Path

analyzer = MediaAnalyzer()
media_file = Path("image.jpg")
result = analyzer.photo(media_file)

print(result)

Disable analysis modules

The analysis is done based on modules, the following modules are available and enabled by default ( click the links to see the possible modules).

File-based Modules

Visual Modules

Modules can be turned off by changing the config provided to the MediaAnalyzer class:

from media_analyzer import MediaAnalyzer, AnalyzerSettings, FileModule, VisualModule
from pathlib import Path

config = AnalyzerSettings(
    enabled_file_modules={FileModule.EXIF},  # Only do exif data analysis on file
    enabled_visual_modules={VisualModule.CAPTION},  # Only do caption module as visual module
)
analyzer = MediaAnalyzer(config=config)
media_file = Path(__file__).parents[1] / "tests/assets/tent.jpg"
result = analyzer.photo(media_file)

Configuration

The AnalyzerSettings class allows you to customize various aspects of the analysis:

media_languages: List of languages for OCR to consider.
theme_color_variant: The color variant used for the generated theme.
captions_provider: The provider for image captioning (e.g., 'BLIP', 'LLM').
llm_provider: The provider for the large language model (LLM), which can be used for summaries and captions.
enable_text_summary: Enable or disable text summarization.
enable_document_summary: Enable or disable document summarization.
document_detection_threshold: Confidence threshold for document detection.
face_detection_threshold: Confidence threshold for face detection.
enabled_file_modules: List of file modules to enable (e.g., exif data, gps, weather detection).
enabled_visual_modules: List of visual modules to enable (e.g., 'classification', 'captioning', 'ocr', 'facial_recognition').

Full docs can be found at https://ruurdbijlsma.github.io/media-analyzer.

Attribution

How to publish a release

  • Merge to main
  • Create tag git tag 0.3.1
  • Push tag git push --tags
  • Wait for GitHub action.

Release files for media-analyzer 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for media-analyzer 0.4.1
File Size Uploaded
media_analyzer-0.4.1.tar.gz 169.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for media-analyzer 0.4.1
File Interpreter ABI Platform
media_analyzer-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 235.2 kB

Release files / media_analyzer-0.4.1.tar.gz

Download URL media_analyzer-0.4.1.tar.gz
Size 169.4 kB
Tags Source
SHA-256 checksum
How to use checksums
68dad234cf93b4c254a391a19e5938c500bf951991d3066b47a2c33170fd9a30
BLAKE2b-256 checksum
How to use checksums
38e7c06d1846ab8bf70e9844cd489244295e1f77cca0333bd1e3ab46122baae7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2025.

Transparency log

Release files / media_analyzer-0.4.1-py3-none-any.whl

Download URL media_analyzer-0.4.1-py3-none-any.whl
Size 65.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de9a41b75b753bd89ae3db6924c9304b7f7cfa19ca3d5cab666023579bff4c35
BLAKE2b-256 checksum
How to use checksums
d025c3989dd8009f73badf217925f3ed86866596414d23e62ba7aecbcbfc21ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

1 release file

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page