Handle ICC profiles and default encoders by JimBobSquarePants · Pull Request #396 · SixLabors/ImageSharp.Web · GitHub
Skip to content

Handle ICC profiles and default encoders#396

Merged
JimBobSquarePants merged 2 commits into
mainfrom
js/smart-encoder-options
Apr 6, 2026
Merged

Handle ICC profiles and default encoders#396
JimBobSquarePants merged 2 commits into
mainfrom
js/smart-encoder-options

Conversation

@JimBobSquarePants

Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

This pull request introduces improved handling of ICC color profiles and default encoder settings for web image processing in ImageSharp.Web. It adds new sample images and UI for testing ICC profile handling, and updates the middleware to better manage color profile conversion and compression settings for JPEG, PNG, and WebP formats.

ICC Profile Handling and Sample Updates:

  • Added a new section to the sample app UI (Index.cshtml) to demonstrate ICC profile handling, including new test images and scenarios for both JPEG and WebP output formats.
  • Added a new sample image issue_2723.jpg to wwwroot for use in ICC profile testing.

Middleware and Configuration Enhancements:

  • Updated ImageSharpMiddleware to set ColorProfileHandling dynamically: if using the default configuration, color profiles are converted to avoid color loss in JPEGs; otherwise, profiles are compacted to remove unnecessary metadata.
  • Modified ImageSharpMiddlewareOptions to use a custom default Configuration with optimized encoder settings for JPEG (quality 75, progressive, YCbCr), PNG (best compression, adaptive filter), and WebP (quality 75, best quality method). [1] [2] [3]
  • Added imports for specific format encoders in ImageSharpMiddlewareOptions.cs to support the new configuration.

@codecov

codecov Bot commented Apr 6, 2026

Copy link
Copy Markdown

@JimBobSquarePants JimBobSquarePants merged commit 338c719 into main Apr 6, 2026
10 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/smart-encoder-options branch April 6, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant