Skip to content

Preserve image opacity in GaussianBlur - #896

Merged
kean merged 1 commit into
mainfrom
fix/gaussian-blur-preserve-opacity
Aug 15, 2026
Merged

kean merged 1 commit into
mainfrom
fix/gaussian-blur-preserve-opacity

Conversation

@kean

@kean kean commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Blurring an opaque photo used to produce an image tagged with an alpha channel, which made ImageEncoders.Default encode it as PNG instead of JPEG/HEIC and silently bypass isHEIFPreferred, so cached entries under .storeEncodedImages were multiple times larger than they needed to be. The scratch contexts vImageBoxConvolve_ARGB8888 renders into were always created with .premultipliedLast; they now use .noneSkipLast for opaque sources, keeping the 32-bit layout vImage requires while images with an actual alpha channel keep being blurred as before.

The scratch vImage contexts always used .premultipliedLast, so blurring an opaque photo tagged the output with an alpha channel and ImageEncoders.Default encoded it as PNG instead of JPEG/HEIC.
@kean
kean merged commit 8b53a8b into main Aug 15, 2026
5 checks passed
@kean
kean deleted the fix/gaussian-blur-preserve-opacity branch August 16, 2026 20:20
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