What you can do is.
Step 1. Install sorl-thumbnail and add it to settings.py
pip install sorl-thumbnail
./manage.py migrate
Step 2. Install sorl-thumbnail-serializer-field
pip install sorl-thumbnail-serializer-field
Add it to settings.py. Sample usage as stated in documentation (https://github.com/dessibelle/sorl-thumbnail-serializer-field)
class TestModelSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = TestModel
# A thumbnail image, sorl options and read-only
thumbnail = HyperlinkedSorlImageField(
'128x128',
options={"crop": "center"},
source='image',
read_only=True
)
# A larger version of the image, allows writing
image = HyperlinkedSorlImageField('1024')
Django 3.0 compatibility has not been updated yet for sorl-thumbnail. So in case of django 3.0 at the present time.
pip install -e git+git://github.com/jazzband/sorl-thumbnail@4fe1854#egg=sorl-thumbnail