👈 back to home

Vinit Kumar

How To Get WebP Support in Django/DjangoCMS

February 16, 2022

WebP is an exciting new image format that saves on the bandwidth because of lower size and is also supported by all major browsers. The issue is that you need to configure your server for it to work.

It can be done in following steps:

  • Install the system dependency in your docker image or your server.
  • Install the latest version of library required to support it.

How Install the dependency on docker

Add libwepb-dev to your list of package installs like below

FROM divio/base:2.2-py3.9-slim-buster

RUN apt-get update
RUN apt-get install gcc libxml2-dev libxslt1-dev libmagic1 libpq-dev gettext libwebp-dev -y

Update the python dependency that support it.

Now, in your requirements.txt or requirements.in file, add this:


The latest version of pillow is the recommended version to install and support many formats including WebP.

So setup these packages in your app and you should be able to save that bandwidth and up on your web performance scores in no time.

As a Software Engineer with a passion for creating and problem-solving, I am constantly seeking new challenges and opportunities to push the boundaries of what computers can do. I am an avid admirer of good literature, music, art, and coffee. Explore my website to learn more about my skills, experience, and values as a programmer. Here, you can also find links to my resume and code repositories .

© 2022, Vinit Kumar