Implement image resizing in the agent.