Skip to content

Commit

Permalink
fix: The output image is flipped when an ImageBitmap is passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
hughfenghen committed Nov 22, 2023
1 parent 08e0049 commit 5ec3f05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/av-cliper/demo/chromakey.demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const ctx = cvs.getContext('2d', {
spill: 0.05,
})
console.time('cost')
// ctx.drawImage(await chromakey(await createImageBitmap(img)), 0, 0, cvs.width, cvs.height)
ctx.drawImage(await chromakey(img), 0, 0, cvs.width, cvs.height)
console.timeEnd('cost')
})()
4 changes: 3 additions & 1 deletion packages/av-cliper/src/chromakey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ export const createChromakey = (
return rs
}

return createImageBitmap(cvs)
return createImageBitmap(cvs, {
imageOrientation: imgSource instanceof ImageBitmap ? 'flipY' : 'none'
})
}
}

0 comments on commit 5ec3f05

Please sign in to comment.