Hack to handle images of different dimensions