title: Is there a way to outline text with a dark line in PIL?
body: <p>I'm using python/PIL to write text on a set of <code>PNG</code> images. I was able to get the font I wanted, but I'd like to now outline the text in black.</p>
  
  <p><strong>This is what I have:</strong> as you can see, if the background is white it is difficult to read. </p>
  
  <p><a href="https://i.stack.imgur.com/uiZ5J.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uiZ5J.png" alt="enter image description here"></a></p>
  
  <p><strong>This is the goal:</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/b5Kkh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b5Kkh.png" alt="enter image description here"></a></p>
  
  <p>Is there a way to accomplish this with PIL? If not, I am open to hearing other suggestions, but no promises because I've already begun a large project in python using PIL.</p>
  
  <p><strong>The section of code that deals with drawing on the images:</strong></p>
  
  <pre><code>for i in range(0,max_frame_int + 1):
      writeimg = Image.open("frameinstance" + str(i) + ".png")
      newimg = Image.new("RGB", writeimg.size)
      newimg.paste(writeimg)
      width_image = newimg.size[0]
      height_image = newimg.size[1]
      draw = ImageDraw.Draw(newimg)
      # font = ImageFont.truetype(&lt;font-file&gt;, &lt;font-size&gt;)
      for font_size in range(50, 0, -1):
          font = ImageFont.truetype("impact.ttf", font_size)
          if font.getsize(meme_text)[0] &lt;= width_image:
              break
      else:
          print('no fonts fit!')
  
      # draw.text((x, y),"Sample Text",(r,g,b))
      draw.text((int(0.05*width_image), int(0.7*height_image)),meme_text,(255,255,255),font=font)
      newimg.save("newimg" + str(i) +".png")
  </code></pre>