diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py
index 498392879da271a9ed481054d5ad5de23db49dd6..89068b6219beeeb0479657f6ae95046744080a7e 100644
--- a/flatland/utils/graphics_pil.py
+++ b/flatland/utils/graphics_pil.py
@@ -83,15 +83,12 @@ class PILGL(GraphicsLayer):
         self.background_grid = np.zeros(shape=(self.width, self.height))
         for x in range(self.width):
             for y in range(self.height):
-                distance = None
+                distance = int(np.ceil(np.sqrt(self.width**2.0 + self.height**2.0)))
                 for rc in dTargets:
                     r = rc[1]
                     c = rc[0]
                     d = int(np.floor(np.sqrt((x - r) ** 2 + (y - c) ** 2)))
-                    if distance is None:
-                        distance = d
-                    else:
-                        distance = min(d, distance)
+                    distance = min(d, distance)
                 self.background_grid[x][y] = distance
 
     def rgb_s2i(self, sRGB):