Content aware image and video resizing