Skip to content

Handle ICC profiles and default encoders#396

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

Handle ICC profiles and default encoders#396
JimBobSquarePants merged 2 commits intomainfrom
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
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86%. Comparing base (037fa9a) to head (175edfa).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../ImageSharp.Web/Middleware/ImageSharpMiddleware.cs 93% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@         Coverage Diff         @@
##           main   #396   +/-   ##
===================================
  Coverage    86%    86%           
===================================
  Files        83     83           
  Lines      2403   2438   +35     
  Branches    365    365           
===================================
+ Hits       2069   2103   +34     
  Misses      224    224           
- Partials    110    111    +1     
Flag Coverage Δ
unittests 86% <97%> (+<1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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