square_image: Fix image resize bug.

Sometimes an image would get resized incorrectly because the script would run before the image was loaded.