Transforming images to another format

I’m using Sage with bud-imagemin installed. Is it not possible to use it in Blade templates? Is something more required to add to bud config? I have specified:

app.imagemin.sharp.setGenerator(`webp`, {
    options: {
      encodeOptions: {
        quality: 80,
      }
    },
  })

Otherwise, the image never transforms to webp after running build. There’s nothing in the manifest regarding the image asset, and type still remains as jpeg.

Example: <img src="@asset('/images/avatar.jpg?as=webp')" />

Without setting options, it works. So do I need to use encode instead of setGenerator in order to pass in my options?

Sorry to revive this old thread but did you ever figure out how to make it work? Thanks in advance

Hello, I might not know the correct approach to this actually, but maybe help with brainstormin alittle, you mentioned using @asset('/images/avatar.jpg?as=webp'). However, @asset() doesn’t directly handle the transformation for WebP in this manner. You might need to handle this within the build process by ensuring the transformation is baked into the Webpack pipeline. WebP transformations via bud-imagemin happen at build time, but using query parameters like ?as=webp is a Blade helper feature that likely isn’t natively tied to bud-imagemin. I propose you configure Bud’s asset handling to include .webp as an output format during the build.

@i1100a @djmtype let me know of this solves the issue.