Resize the image canvas when the widget is resized.