Best way to resize / convert images?


I’m working on an Arduino Mopidy client display. The goal is a wall clock that shows the current songs playing. It’s based on an ESP32 with a 64x64 LED display. I’ve got it querying the server using WebSockets and displaying playing track information.

I’d like to show scaled album artwork on the display. I’ve got Mopidy-Local-Images working and can query for images from the database.

But, the ESP32 has very little working memory and minimal processing power. I’d like to have the images converted to 64x64 .png files on the raspberry pi that is hosting my mopidy server.

I’ve thought of using katana, an image proxy, but it has a lot of depends and may be overkill and still not do what I need.

Is there a proxy server that makes sense or would it be easier to modify the Mopidy-Local-Images code to do this? Have others had to deal with this already?



Here is a diff that modifies in mopidy-local-images to have it save a second, 64x64, .png copy of each image and add that image to the library. Scripts can then call for that smaller version if they wish… It does require the PIL library.

Note: I don’t know Python. So I might be breaking some obvious rules. But it seems to work well. This totally makes me want to learn Python.


<       mopidy-local-images/mopidy_local_images/
> from PIL import Image
>                     print(uritools.urijoin(self.base_uri, name))
<                 images.add(self._get_or_create_image_file(None, data))
>                 images = images.union(self._get_or_create_image_file(None, data))
<                     images.add(self._get_or_create_image_file(path))
>                     images = images.union(self._get_or_create_image_file(path))
>         namepng = '%s.tiny.png' % (digest)
>         destpng = os.path.join(self.image_dir,namepng)
<         return uritools.urijoin(self.base_uri, name)
>         # file is written. Can I reload it with the Image class and then resize it?
>         size = (64, 64)
>         im =
>         im.thumbnail(size)
>         # now we want to return the set of both files
>         both = set()
>         both.add(uritools.urijoin(self.base_uri, name))
>         both.add(uritools.urijoin(self.base_uri, namepng))
>         return both