Unable to apply mask image
I am unable to apply mask
Here is the mask file
Here is the image that I am trying to apply mask to
This is what I am trying to do
Process the mask file
let processedMask = await sharp(maskBuffer).grayscale().resize(1288, 1288, { fit: 'fill' }).raw().toBuffer({ resolveWithObject: true });
This is how I try to apply the mask
let maskedOverlay = await sharp(overlayPositioned, { raw: { width: 1288, height: 1288, channels: 4 } }).joinChannel(processedMask.data, { raw: processedMask.info }).raw().toBuffer();
I tried also with composite mode dest-in but it still does not apply the mask
let maskedOverlay = await sharp(overlayPositioned, { raw: { width: 1288, height: 1288, channels: 4 } }).composite([{ input: processedMask.data, raw: processedMask.info, blend: 'dest-in' }]).raw().toBuffer();
What I am doing wrong, please help.
The input image appears to already have an alpha channel - are you trying to replace this with the mask? (The mask is currently a 3-channel RGB image - I guess you want this to be single-channel greyscale.)
@kalitk0 Were you able to make any progress with this?
Closing due to inactivity but please feel free to reopen with more details if further help is required.