zalando-stups/skrop

Extend Focal Point cropping filter to allow for minimum width of resulting image

duergner opened this issue · 0 comments

The current implementation of the focal point cropping filter does not care at all about the dimensions of the resulting image. This may lead to the case where the cropped image is just a couple of pixels in width or height which is not a desired outcome.

The filter should be extended to allow for an optional fourth parameter which would set a minimum width of the resulting image. The cropping should than be done in a best effort manner, i.e. the focal point to use for cropping is either the focal point specified via path parameters or the the one which would will allow for the minimum desired dimensions of the resulting image.

The X (and similarly Y) coordinate of the source focal point is min(max(focalPointX,minFocalPointX),maxFocalPointX) where minFocalPointX is the minimum value of X for which the resulting image will still have a width of minWidth; `maxFocalPointX is defined accordingly.