Conditionally crop image sides if needed