added nearest_sample=False option while triming