tweaked image resizing