Implement helper function to manipulate the images