Soenneker.Gen.Razor.ImageOptimizer.Webp 11.0.196

Prefix Reserved
dotnet add package Soenneker.Gen.Razor.ImageOptimizer.Webp --version 11.0.196
                    
NuGet\Install-Package Soenneker.Gen.Razor.ImageOptimizer.Webp -Version 11.0.196
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Gen.Razor.ImageOptimizer.Webp" Version="11.0.196">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Gen.Razor.ImageOptimizer.Webp" Version="11.0.196" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Gen.Razor.ImageOptimizer.Webp">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Gen.Razor.ImageOptimizer.Webp --version 11.0.196
                    
#r "nuget: Soenneker.Gen.Razor.ImageOptimizer.Webp, 11.0.196"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Gen.Razor.ImageOptimizer.Webp@11.0.196
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Gen.Razor.ImageOptimizer.Webp&version=11.0.196
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Gen.Razor.ImageOptimizer.Webp&version=11.0.196
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Gen.Razor.ImageOptimizer.Webp

Build-time WebP image optimization for Razor applications using the bundled libvips command-line distributions.

Quick start

Install the package in a Razor or Blazor project:

dotnet add package Soenneker.Gen.Razor.ImageOptimizer.Webp

Build the project. PNG and JPEG files beneath wwwroot produce adjacent .webp files automatically. Source images remain unchanged.

wwwroot/images/photo.jpg
wwwroot/images/photo.webp

Configuration

The defaults work without configuration. Override them in the consuming project when needed:

<PropertyGroup>
  <ImageOptimizerWebpEnabled>true</ImageOptimizerWebpEnabled>
  <ImageOptimizerWebpWwwRootPath>$(ProjectDir)wwwroot</ImageOptimizerWebpWwwRootPath>
  <ImageOptimizerWebpSourceExtensions>png;jpg;jpeg</ImageOptimizerWebpSourceExtensions>
  <ImageOptimizerWebpQuality>80</ImageOptimizerWebpQuality>
  <ImageOptimizerWebpEffort>4</ImageOptimizerWebpEffort>
  <ImageOptimizerWebpLossless>false</ImageOptimizerWebpLossless>
  <ImageOptimizerWebpStripMetadata>true</ImageOptimizerWebpStripMetadata>
  <ImageOptimizerWebpForce>false</ImageOptimizerWebpForce>
  <ImageOptimizerWebpFailOnError>true</ImageOptimizerWebpFailOnError>
</PropertyGroup>
Property Default Description
ImageOptimizerWebpEnabled true Enables generation during builds.
ImageOptimizerWebpWwwRootPath $(ProjectDir)wwwroot Directory scanned recursively for source images.
ImageOptimizerWebpSourceExtensions png;jpg;jpeg Semicolon- or comma-separated source extensions.
ImageOptimizerWebpQuality 80 WebP quality from 1 through 100.
ImageOptimizerWebpEffort 4 Encoder effort from 0 (fastest) through 6 (slowest).
ImageOptimizerWebpLossless false Enables lossless WebP encoding.
ImageOptimizerWebpStripMetadata true Removes image metadata from generated output.
ImageOptimizerWebpForce false Regenerates outputs even when they are up to date.
ImageOptimizerWebpFailOnError true Fails the build when an image cannot be processed.

Set ImageOptimizerWebpOutputPath to write generated files elsewhere. Relative paths are resolved from the project directory, and the directory structure beneath wwwroot is preserved.

<PropertyGroup>
  <ImageOptimizerWebpOutputPath>$(ProjectDir)optimized</ImageOptimizerWebpOutputPath>
</PropertyGroup>

Build behavior

  • Missing wwwroot directories are skipped successfully.
  • Outputs at least as new as their source are skipped unless ImageOptimizerWebpForce is true.
  • Output directories are created automatically.
  • A completed temporary encode replaces the final output, so an encoder failure does not destroy the previous valid asset.
  • Conflicting source names are detected before an output is overwritten. Including webp in ImageOptimizerWebpSourceExtensions is rejected to protect source files.
  • ImageOptimizerWebpFailOnError=false reports an image failure and continues with the remaining inputs. Requested cancellation always stops the task.
  • Design-time and cross-targeting builds do not run the optimizer.
  • Windows x64 and Linux x64 libvips tools are bundled through Soenneker.Libvips.Util.

If Soenneker.Gen.Razor.ImageOptimizer is also installed, remove webp from its ImageOptimizerFormats setting so only this package owns WebP output.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.196 45 11/22/2026
11.0.195 48 11/21/2026
11.0.194 62 11/20/2026
11.0.193 88 11/19/2026
11.0.192 74 11/19/2026
11.0.191 70 11/19/2026
11.0.190 69 11/19/2026
11.0.189 75 11/18/2026
11.0.188 84 11/18/2026
11.0.187 82 11/18/2026
11.0.186 83 11/18/2026
11.0.185 79 11/18/2026
11.0.184 84 11/17/2026
11.0.183 89 11/16/2026
11.0.182 93 11/15/2026
11.0.181 90 11/15/2026
11.0.180 97 11/15/2026
11.0.179 92 11/14/2026
11.0.178 96 11/14/2026
11.0.177 98 11/13/2026
Loading failed

Update dependency Soenneker.Libvips.Util to 11.0.231 (#133)