Major changes to imaging/run_trim.py but the subimages seem to be coming out OK and well-scaled. More testing needed but the core tasks are in palce.