Skip to content

Imaging: Upgrade ImageSharp to v4 (keep v2 as a supported option)#23334

Draft
AndyButland wants to merge 1 commit into
v19/devfrom
v19/task/update-image-sharp-dependency
Draft

Imaging: Upgrade ImageSharp to v4 (keep v2 as a supported option)#23334
AndyButland wants to merge 1 commit into
v19/devfrom
v19/task/update-image-sharp-dependency

Conversation

@AndyButland

@AndyButland AndyButland commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description

Upgrades the default imaging package (Umbraco.Cms.Imaging.ImageSharp) from ImageSharp 3 to ImageSharp 4, keeping Umbraco.Cms.Imaging.ImageSharp2 (ImageSharp 2) as a supported option. The dedicated ImageSharp 3 package is not retained.

Licensing context. ImageSharp 4 adds a build-time licence check for projects that reference it directly (the Split License terms are unchanged from v3 — only enforcement is new). Because this is a public, open-source repository we cannot commit a licence key, so both package references use ExcludeAssets="build". The licence check ships in the package's MSBuild build/ assets, so excluding them means the CMS builds with no sixlabors.lic for CI, contributors and forks, while the compile/runtime assets flow normally and the library is unaffected.

  • Umbraco sites consume ImageSharp transitively and need no licence.
  • Only a project adding its own direct PackageReference to SixLabors.ImageSharp[.Web] is subject to the check.
  • Umbraco holds a free Six Labors Community/OSS licence for compliance, kept out of the source tree.

Changes

  • Directory.Packages.props: SixLabors.ImageSharp and SixLabors.ImageSharp.Web4.0.0.
  • Umbraco.Cms.Imaging.ImageSharp.csproj: ExcludeAssets="build" on both references.
  • UmbracoBuilderExtensions.cs: one namespace fix — v4 moved the DI/pipeline extensions (AddImageSharp, AddProvider, AddProcessor, ClearProviders, UseImageSharp) from SixLabors.ImageSharp.Web.DependencyInjection to the root SixLabors.ImageSharp.Web namespace.
  • Updated the two imaging CLAUDE.md files (v4 references, licensing/build notes).

The Umbraco.Cms.Imaging.ImageSharp2 project and the Umbraco.Cms meta-package reference are unchanged.

Testing

Solution should build and CI checks pass; existing ImageSharp unit tests (ImageSharpImageUrlGeneratorTests, CropWebProcessorTests) cover URL generation and crop maths.

Cropped images should continue to be served at the expected dimensions on a running site.

@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant