As the error message says, you cannot simply return a PIL image. The typical approach is to construct a Media object from the image and return it. Here’s a fairly recent post dealing with the same issue: Cannot serialize <class 'PIL.Image.Image'> object - #3 by helperfunction
1 Like