Rough image resizing logic