title: By Using python pil, I want to make image centered with text from url and download. How to do it?
body: <p>I input a text at url, and want to get downloaded image that the text is centered.</p>
  
  <p>for example,
  when I input,
  <a href="http://127.0.0.1:8000/app/hello" rel="nofollow noreferrer">http://127.0.0.1:8000/app/hello</a>, then an image is downloaded.
  That image centers the text 'hello'</p>
  
  <pre><code>def homework(request, name):
  text = name
  img = Image.new('RGB',(256,256),(0,0,0))
  draw = ImageDraw.Draw(img)
  
  font = ImageFont.load_default().font
  draw.text((128,128), text, font = font, fill="black")
  
  with open(img, 'rb') as f:
      response = HttpResponse(f, content_type='image/jpeg')
      response['Content-Disposition'] = 'attachment; filename="textimage"'
      return response
  </code></pre>
  
  <p>By using python pil.</p>
  
  <p>How to do it?</p>