Skip to content

Commit

Permalink
Composite: don't write to null pixels (#1226)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoerd108 authored May 11, 2023
1 parent 16ee71c commit aec79d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/core/src/composite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ export default function composite(src, x, y, options = {}, cb) {
y + sy,
constants.EDGE_CROP
);

if (dstIdx === -1) {
// Skip target pixels outside of dst
return;
}

const blended = blendmode(
{
r: this.bitmap.data[idx + 0] / 255,
Expand Down
Binary file modified packages/jimp/test/images/cops-composited.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit aec79d0

Please sign in to comment.