python - Send PIL Image from Django View to Browser for Download via HttpResponse -


i'm trying send pil image django view browser automatic download. code below seems work many:

 response = httpresponse(content_type='image/jpg')  pil_imagetosend.save(response, "jpeg")  response['content-disposition'] = 'attachment; filename="name.jpg"'  return response 

i call django view through ajax, , when print callback looks jpeg image, no download triggered. missing download automatically trigger?


Comments

Popular posts from this blog

html - How to custom Bootstrap grid height? -

javascript - pass values from mssql to views in node -

image - python get coordinates (pixels) of corresponding points from clicks -