Skip to content

fix(blit): preserve source colors over transparency#1409

Open
ishaanlabs-gg wants to merge 1 commit into
jimp-dev:mainfrom
ishaanlabs-gg:fix-blit-transparent-alpha
Open

fix(blit): preserve source colors over transparency#1409
ishaanlabs-gg wants to merge 1 commit into
jimp-dev:mainfrom
ishaanlabs-gg:fix-blit-transparent-alpha

Conversation

@ishaanlabs-gg

@ishaanlabs-gg ishaanlabs-gg commented Jul 1, 2026

Copy link
Copy Markdown

Summary

Fixes #1072.

Verification

  • git diff --check
  • node -e "const src={r:255,g:255,b:255,a:128}, dst={r:0,g:0,b:0,a:0}; const sa=src.a/255, da=dst.a/255, oa=sa+da*(1-sa); const c=(s,d)=>(s*sa+d*da*(1-sa))/oa; const actual=[c(src.r,dst.r),c(src.g,dst.g),c(src.b,dst.b),oa*255]; const expected=[255,255,255,128]; if (JSON.stringify(actual)!==JSON.stringify(expected)) { console.error({actual, expected}); process.exit(1); } console.log('alpha compositing regression math ok');"

I attempted pnpm --filter @jimp/plugin-blit test -- --watch=false, but the local dependency link could not complete on this machine because the external SSD ran out of free space (ERR_PNPM_ENOSPC).

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.

Blitting uses wrong alpha compositing (generates borders)

1 participant