# Convert images to webp and resize

**URL:** <https://forum.getkirby.com/t/convert-images-to-webp-and-resize/23645>\
**Category:** Questions\
**Tags:** v3\
**Created:** [October 11, 2021, 4:20pm UTC](https://forum.getkirby.com/t/convert-images-to-webp-and-resize/23645 "2021-10-11T16:20:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivomynttinen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ivomynttinen/32/445_2.png) [@ivomynttinen](https://forum.getkirby.com/u/ivomynttinen)\
**Post date:** [October 11, 2021, 4:20pm UTC](https://forum.getkirby.com/t/convert-images-to-webp-and-resize/23645/1 "2021-10-11T16:20:30Z")

</div>

Hey there,

I just upgraded an old site to 3.6.3-beta3 and was attempting to implement the new webp support for a bunch of images.

Here’s how I implemented it:

```auto
<picture>
    <source media="(min-width: 1400px)" srcset="<?= $cover->thumb(['width' => 997, 'format' => 'webp'])->url() ?> 1x, <?= $cover->thumb(['width' => 1994, 'format' => 'webp'])->url() ?> 2x" type="image/webp">
    <source media="(min-width: 1400px)" srcset="<?= $cover->thumb(['width' => 997, 'format' => 'jpg'])->url() ?> 1x, <?= $cover->thumb(['width' => 1994, 'format' => 'jpg'])->url() ?> 2x">

    <source media="(min-width: 540px)" srcset="<?= $cover->thumb(['width' => 670, 'format' => 'webp'])->url() ?> 1x, <?= $cover->thumb(['width' => 1340, 'format' => 'webp'])->url() ?> 2x" type="image/webp">
    <source media="(min-width: 540px)" srcset="<?= $cover->thumb(['width' => 670, 'format' => 'jpg'])->url() ?> 1x, <?= $cover->thumb(['width' => 1340, 'format' => 'jpg'])->url() ?> 2x">

    <source srcset="<?= $cover->thumb(['width' => 480, 'format' => 'webp'])->url() ?> 1x, <?= $cover->thumb(['width' => 997, 'format' => 'webp'])->url() ?> 2x" type="image/webp">
    <source srcset="<?= $cover->thumb(['width' => 480, 'format' => 'jpg'])->url() ?> 1x, <?= $cover->thumb(['width' => 997, 'format' => 'jpg'])->url() ?> 2x">

    <img src="<?= $cover->thumb(['width' => 480, 'format' => 'jpg'])->url() ?>" width="1994" height="840" alt="<?= $page->title()->html() ?>" loading="lazy">
</picture>

```

Which correctly generates the desired markup. However, the images the thumb() function is supposed to generate (resize and convert to webp) are not created. I can actually open the path (looks like `http://localhost:8888/media/pages/blog/test/0f314849e6-1632816042/test997x.webp`), but the image that is delivered is just the originally uploaded jpg with a webp extension (so it neither resizes nor does it truly create a webp, it just changes the file extension).

I verified that I have GD and imagemagick installed and enabled.

Any ideas why this is happening?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 11, 2021, 4:49pm UTC](https://forum.getkirby.com/t/convert-images-to-webp-and-resize/23645/2 "2021-10-11T16:49:30Z")

</div>

> [@ivomynttinen](#):
>
> I verified that I have GD and imagemagick installed and enabled.

Which driver is actually used by Kirby (have you set `im` in config)

Which PHP version with which versions of GD/Imagemagick are you using?

---

<div class="post-metadata">

**Author:** ![ivomynttinen](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ivomynttinen/32/445_2.png) [@ivomynttinen](https://forum.getkirby.com/u/ivomynttinen)\
**Post date:** [October 11, 2021, 4:54pm UTC](https://forum.getkirby.com/t/convert-images-to-webp-and-resize/23645/3 "2021-10-11T16:54:56Z")

</div>

Well thanks, that was an easy one. I didn’t knew I had to implicit tell Kirby to use imagemagick through the config.

Works perfectly now.
