change algorithm to select preview size