Making sure image resizing does not produce empty (black) canvas