Wagtail SB ImageSerializer
Wagtail package to render images with rendition in a single API Field.

Wagtail package to render images with rendition in a single API Field.
β¨ FeaturesΒΆ
Standardized Serialization: Built for simple integration with Wagtail headless setups or general DRF endpoints.
Easy Configuration: Quickly define social media image renditions.
Modern Stack: Built for modern Python (3.11+) and up to date Django/Wagtail versions.
π RequirementsΒΆ
Python 3.11 or higher
Wagtail 5.2 or higher
Django 4.2 or higher
π¦ InstallationΒΆ
Using pipΒΆ
pip install wagtail-sb-imageserializerUsing uvΒΆ
uv add wagtail-sb-imageserializerπ UsageΒΆ
Add wagtail.api.v2, rest_framework and wagtail_sb_imageserializer to your INSTALLED_APPS settings:
INSTALLED_APPS = [
# ...
"wagtail.api.v2",
"rest_framework",
"wagtail_sb_imageserializer",
# ...
]In your model specify the ImageSerializerField as serializer for the APIField related to the image field and add the renditions parameter with the renditions you want to render.
from wagtail.models import Page
from wagtail.api import APIField
from wagtail_sb_imageserializer.fields import ImageSerializerField
class SamplePage(Page):
image = ImageSerializerField()
api_fields = [
APIField(
"image",
serializer=ImageSerializerField(
renditions={
"lazy": "fill-50x50",
"mobile": "fill-128x128",
"tablet": "fill-256x256",
"desktop": "fill-512x512",
}
),
),
]π οΈ DevelopmentΒΆ
Check out our Contribution Guide for details on setting up your development environment, running tests, and submitting pull requests.
The project uses uv for dependency management, ruff for linting, and tox
for multi-environment testing.
π ChangelogΒΆ
See the CHANGELOG.md for a history of changes.
π₯ ContributorsΒΆ
See our list of contributors.
π LicenseΒΆ
This project is licensed under the Apache License 2.0. See the LICENSE file for details.