utility function to crop scans in the batch mode