AVIF Image generator BIN?

Hello!

I try to convert to AVIF format, but I don’t think it is working.
When I use IM driver images are not converted at all.
Apparently I should direct to the right bin to make it work. How do I know where that is?

Also the quality doesn’t seem to work with GB. Do I declare it wrong?

Thanks!

return [
  'thumbs' => [
    'driver'    => 'im',

    'srcsets' => [
      'default' => [
        'quality'   => 50,
        1, 300, 500, 1000, 2000
      ],
      'avif' => [
        'quality'   => 2,
        '1w'  => ['width' => 1, 'format' => 'avif'],
        '300w'  => ['width' => 300, 'format' => 'avif'],
        '500w' => ['width' => 500, 'format' => 'avif'],
        '1000w' => ['width' => 1000, 'format' => 'avif'],
        '2000w' => ['width' => 2000, 'format' => 'avif'],
      ],
      'webp' => [
        'quality'   => 10,
        '1w'  => ['width' => 1, 'format' => 'webp'],
        '300w'  => ['width' => 300, 'format' => 'webp'],
        '500w' => ['width' => 500, 'format' => 'webp'],
        '1000w' => ['width' => 1000, 'format' => 'webp'],
        '2000w' => ['width' => 2000, 'format' => 'webp'],
      ]
    ],
    'presets' => [
      'default' => ['width' => 2000, 'quality' => 30],
      's' => ['width' => 600, 'quality' => 30],
      'xs' => ['width' => 1, 'height' => 1, 'quality' => 30]
    ]
  ],

If you pull up a terminal (mac or linux) and enter:

which convert

This will show you the bin path to IM.

For me, this is /opt/homebrew/bin/convert becuase I installed IM via Homebrew.

You can do the same on your hosting if your host allows SSH connections. If your host does not allow ssh connections, you might still be able to as alot of hosts have a terminal application within the hosting control panel. Failing that, look in their help guides or ask them what the path is.

Quality needs to go within each w array

'1w'  => ['width' => 1, 'format' => 'webp', 'quality' => 10],

This works! Thanks.

I got this from my hosting:

If you connect via SSH you can find what you are looking for. However, as far as we know there is no Bin subdirectory, but you can create one in the root of your domain if you wish.

Just to be sure: I have installed Kirby basic installation. In config.php I add:

'driver'    => 'im',

I didn’t install IM on the server or anywhere else.
The IM is not installed by my hosting party.

I only have to add a path to the bin in config.php
And then it should work. Or am I missing a step?

Thanks!

If ImageMagick is not installed on your server, you cannot use it

That sounds obvious.
Is there a step by step guide that explains how to activate ImageMagick for Kirby somewhere?
I feel like I am guessing in the dark now. And I don’t want to waste anyones time either.

You need root access on the server to install ImageMagick, this is usually not possible on shared hosting. So you would have to contact your provider if they will install it or move to a hosting provider that has it installed.

This has nothing to do with Kirby directly. Only if you have the software installed on your server, you can enable it in Kirby’s config.