Skip to main content

Media Optimization Engineer 1.4

Media Optimization Engineer (MOE) is a reusable Django/Python package for image optimization, responsive delivery, and 360-degree media processing.

The public package is intentionally application-agnostic. It does not depend on any consuming project's themes, tenants, brands, business models, or private infrastructure.

Core capabilities

Standard images

  • automatic ImageField / FileField integration;
  • immutable originals;
  • AVIF, WebP and JPEG derivatives;
  • responsive width sets;
  • semantic profiles such as avatar, card, hero, and default;
  • focal-point aware crops;
  • dominant color, BlurHash and lightweight placeholders;
  • SHA-256 deduplication;
  • local, S3-compatible and Cloudflare R2 storage;
  • Redis/Celery processing when enabled;
  • CDN-ready derivative URLs;
  • Django template tags for responsive rendering.

360 panoramas

  • equirectangular panorama support;
  • progressive preview;
  • multiresolution pyramids;
  • tiled AVIF/WebP delivery;
  • generic manifests;
  • Pannellum, Marzipano and Three.js adapters;
  • optional cubemap generation.

Install

pip install media-optimization-engine

Optional infrastructure extras:

pip install "media-optimization-engine[all]"

Django setup

# settings.py
INSTALLED_APPS = [
    # ...
    "rest_framework",
    "media_engine",
]

MEDIA_ENGINE_TASK_MODE = "auto"

MEDIA_ENGINE_AUTO_FIELDS = {
    "articles.Article": {
        "cover_image": {
            "profile": "hero",
            "role": "hero",
        },
    },
    "accounts.Profile": {
        "photo": {
            "profile": "avatar",
            "role": "content",
        },
    },
    "organizations.Organization": {
        "logo": {
            "profile": "default",
            "role": "content",
        },
    },
}
# urls.py
from django.urls import include, path

urlpatterns = [
    path("api/v1/", include("media_engine.urls")),
]

Then:

python manage.py migrate
python manage.py media_engine_doctor

Django template rendering

For normal model fields, use the high-level media_image tag:

{% load responsive_media %}

{% media_image article "cover_image"
    alt=article.title
    css_class="article-hero"
    sizes="(max-width: 768px) 100vw, 1200px"
%}

MOE resolves the field's MediaBinding, generates a responsive picture with available AVIF/WebP sources, preserves the image's CSS classes, and falls back to the original field URL only when no processed binding is available.

{% load responsive_media %}

{% media_image organization "logo"
    alt=organization.name
    css_class="site-logo"
    sizes="240px"
%}

Card grid

{% load responsive_media %}

{% for article in articles %}
  <article class="article-card">
    {% media_image article "cover_image"
        alt=article.title
        css_class="article-card__image"
        sizes="(max-width: 640px) 92vw, (max-width: 1100px) 45vw, 360px"
    %}
    <h2>{{ article.title }}</h2>
  </article>
{% endfor %}

Direct binding rendering

Advanced integrations can render a known asset directly:

{% load responsive_media %}

{% responsive_image binding.asset
    profile=binding.profile
    role=binding.role
    alt=object.title
    css_class="media-object"
    picture_class="media-object-picture"
    sizes="100vw"
%}

One optimized URL

For Open Graph metadata, CSS backgrounds, emails, or APIs where picture is not possible:

{% load responsive_media %}

{% media_url organization "logo" preferred_width=512 preferred_format="webp" as optimized_logo %}

<meta property="og:image" content="{{ optimized_logo }}">

For normal page images, prefer media_image over media_url; the browser can make a better final choice from srcset and sizes.

Responsive selection

MOE provides width descriptors and sizes. The browser chooses the final resource using layout width, viewport, DPR, supported formats, and its own network heuristics.

JavaScript is not required for normal responsive images.

Runtime measurement is appropriate only for highly dynamic components whose rendered width cannot be described reliably with sizes, such as resizable editors, canvas-like builders, or asynchronously mounted panels.

Backfill

Historical media can be ingested with maintenance commands:

python manage.py backfill_registered_media
python manage.py audit_media_engine --fail-on-incomplete

New uploads registered in MEDIA_ENGINE_AUTO_FIELDS are handled automatically.

Runtime independence

Embedded Django mode and standalone-node mode are autonomous. Optional control-plane synchronization must never be required for upload, processing, rendering, or derivative delivery.

License

MIT License. Copyright (c) 2026 Achille Kabasele.

Release files for media-optimization-engine 1.4.0

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-optimization-engine 1.4.0
File Size Uploaded
media_optimization_engine-1.4.0.tar.gz 49.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for media-optimization-engine 1.4.0
File Interpreter ABI Platform
media_optimization_engine-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 119.2 kB

Release files / media_optimization_engine-1.4.0.tar.gz

Download URL media_optimization_engine-1.4.0.tar.gz
Size 49.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1deae55286b815b1a418fbfecb0c54454e06fd6109d13aadb9dd22480efd8cc3
BLAKE2b-256 checksum
How to use checksums
0a7f913b8bd9c2ba47f28f440443ef24374b52575265755bdd605adfeea8af45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 26, 2026.

Transparency log

Release files / media_optimization_engine-1.4.0-py3-none-any.whl

Download URL media_optimization_engine-1.4.0-py3-none-any.whl
Size 69.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b6740dc5cfca7051d80d95fc0fb1227e860da3a725700ee84458bcc0e90e106
BLAKE2b-256 checksum
How to use checksums
294c3cb1727024b7b8759796c42c35e1647c1ca7b4b63c75817ed5693782cd1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 26, 2026.

Transparency log

Release history Release notifications | RSS feed

1.4.1

2 release files

This release

1.4.0 This release

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