added a function to crop images