ImageMagick thumbs additional function

Yep, so, thanks to this topic

I understand I have to use this

$file->thumb(['width' => 400, 'own' => true]) to use my own method.

with these lines inside the component :

<?php
Kirby::plugin('my/thumbs', [
    'components' => [
        'thumb' => function (Kirby\Cms\App $kirby, string $src, string $dst, array $options) {
            if (isset($options['own']) === true) {
                return myThumbGenerator($src, $dst, $options);
            }
            
            $core = require $kirby->root('kirby') . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'components.php';
            return $core ['thumb']($kirby, $src, $dst, $options);
        }
    ],
]);

But still don’t understand how to insert this function :

function oilPaintImage($imagePath, $radius)
{
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->oilPaintImage($radius);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}