Repository navigation
Conversation
applyExportEffects skipped the automatic white background when the shape was circle, assuming the fill would repaint the masked corners. It would not: the fill goes behind the already-masked image, so only the area outside the circle is filled. Without it, JPEG drops the alpha channel and the transparent corners turn black (imerljak#103). Opaque formats now always get a background — fillColor if given, #fff otherwise — regardless of shape; PNG and WebP keep transparent corners unless a fillColor is set.
Owner
|
Already covered by #106. |
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.
Problem
Exporting a
shape="circle"crop as JPEG produces black corners. Fixes #103.Root cause
applyExportEffectsskipped the automatic white background when the shape wascircle, assuming the fill would repaint the masked corners. It would not:withBackgroundpaints the fill behind the already-masked image (fillRectthendrawImage), so only the area outside the circle is filled. Without it, JPEG drops the alpha channel and the transparent corners turn black.Fix
Opaque formats now always get a background —
fillColorif given,#fffotherwise — regardless of shape, by dropping the&& shape === 'rect'condition. PNG/WebP keep transparent corners unlessfillColoris set, and since the fill is applied after the mask, the circle stays intact.Testing
#ffffill applied after the clip (mask runs first), while a circular PNG keeps its transparent corners with no default fill.tests/ssr/ssr-import.test.ts(spawnSync npm ENOENT), fails identically on a clean checkout in this Windows environment and is unrelated to the change.tsc --noEmit, eslint and prettier clean on the touched files.