new function that is hopefully more efficient with large images