In this example, we want to create a navigation image for every single item in an area of the content tree. Each of those items use a variety of templates, with images saved in different shapes and sizes. We need a uniform square 200 x 200 px image, that reflects the main subject of the image being used.
To do this, we hook into the publish:itemProcessed event and check to see if our 'Smart Cropped Image' field is populated. If not, then we check a few different defined fields for images. Once found, we send the image to the Microsoft Vision API, together with a set of parameters [200px width, 200px height and smart cropped].
The API is clever enough to pick out the main subect of the image. Apply a crop the matches the proportions of the parameters provided, then resizes the resulting image to match. Using this approach, we end up with a smart 200px square image to send to Sitecore Search, for use as a navigation image.