Fix: Set quality and strip metadata in client-side image resize#76029
Merged
adamsilverstein merged 2 commits intotrunkfrom Mar 2, 2026
Merged
Fix: Set quality and strip metadata in client-side image resize#76029adamsilverstein merged 2 commits intotrunkfrom
adamsilverstein merged 2 commits intotrunkfrom
Conversation
Client-side generated thumbnails via resizeImage() were larger than server-side ones because SaveOptions had no quality parameter and no metadata stripping. This adds quality (default 0.82) and keep='icc' to match WordPress core's Imagick behavior for sub-sizes. Also adds keep='icc' to convertImageFormat() for consistent metadata handling during format conversion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
The vipsResizeImage wrapper in vips-worker.ts was not forwarding the quality parameter to the underlying resizeImage function, causing a TypeScript build error.
|
Size Change: +98 B (0%) Total Size: 6.87 MB
ℹ️ View Unchanged
|
swissspidy
approved these changes
Mar 1, 2026
gziolo
pushed a commit
that referenced
this pull request
Mar 3, 2026
* Fix: Set quality and strip metadata in client-side image resize Client-side generated thumbnails via resizeImage() were larger than server-side ones because SaveOptions had no quality parameter and no metadata stripping. This adds quality (default 0.82) and keep='icc' to match WordPress core's Imagick behavior for sub-sizes. Also adds keep='icc' to convertImageFormat() for consistent metadata handling during format conversion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix: Pass quality param through vips resize wrapper The vipsResizeImage wrapper in vips-worker.ts was not forwarding the quality parameter to the underlying resizeImage function, causing a TypeScript build error. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
gutenbergplugin
pushed a commit
that referenced
this pull request
Mar 3, 2026
* Fix: Set quality and strip metadata in client-side image resize Client-side generated thumbnails via resizeImage() were larger than server-side ones because SaveOptions had no quality parameter and no metadata stripping. This adds quality (default 0.82) and keep='icc' to match WordPress core's Imagick behavior for sub-sizes. Also adds keep='icc' to convertImageFormat() for consistent metadata handling during format conversion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix: Pass quality param through vips resize wrapper The vipsResizeImage wrapper in vips-worker.ts was not forwarding the quality parameter to the underlying resizeImage function, causing a TypeScript build error. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: bfa090b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #76030
Match existing core server processing behavior by stripping (most) exif data from image sub sizes.
qualityparameter (default 0.82) toresizeImage()in@wordpress/vips, matching WordPress core's Imagick quality for sub-sizeskeep: 'icc'toSaveOptionsin bothresizeImage()andconvertImageFormat()to strip non-essential metadata (EXIF, XMP, IPTC) while preserving ICC color profiles, matching WordPress core's behaviorvipsResizeImagewrapper in@wordpress/upload-mediaThis reduces client-side generated thumbnail file sizes to be comparable with server-side ones (e.g. ~25KB vs previously ~34KB).
Samples
Stripping the meta data is most important for the smallest images where it represents a disproportionate amount of the data. Note thumbnail file size.
Server
Before PR
After PR
Testing instructions