x1 = int(math.floor((canvas_width - old_width) / 2))
y1 = int(math.floor((canvas_height - old_height) / 2))
mode = im.mode
if len(mode) == 1:
    new_background = 255
if len(mode) == 3:
    new_background = 255, 255, 255
if len(mode) == 4:
    new_background = 255, 255, 255, 255
newImage = Image.new(mode, (canvas_width, canvas_height), new_background)
newImage.paste(im, (x1, y1, x1 + old_width, y1 + old_height))
newImage.save(new_image_path)
resize_canvas()
In Python, Python Image Library 1.1.6, how can I expand the canvas without resizing?