Automatic focal points for images - Maurits van Rees
Channel: Plone
Date: 09/12/2021

This is the tastiest presentation of the Plone conference! A customer of Zest has images of delicious cakes, bread, cookies. But a cropped version of such an image often does not show the yummy cake, but a blurred cup of tea in the background. Solution: automatic focal point detection.

We could use a smart imaging service like Thumbor. But the latest alpha release with Python 3 support is one and a half years old. The part that actually detects the focal points is opencv, with help from numpy. Can we call this directly instead? Yes we can. Can we do this from within Plone? Yes, but we need a patch.

In this talk, to refresh our memories, we will first look at what the various scale modes/directions do in Plone. Since the 'down' direction or 'contain' mode is the only one that actually does image cropping, we will focus on that. We will go through the code of the focal point detection, and show the result. Lastly, we will look at an idea to make image handling in Plone more pluggable, using a transform chain.

https://2021.ploneconf.org/schedule/automatic-focal-points-for-images