imgly/background-removal-js

no way to generate proper mask

mtrabelsi opened this issue · 1 comments

The docs looks incorrect about TS types, in the nodejs example you are getting mask from:

const mask= await segmentForeground(imagePath, config);

in other examples or in the docs, you are hinting that you can set it in the config:

      output: {
        quality: 1,
        format: 'image/webp', //image/jpeg, image/webp
        type: 'mask'//  'foreground' | 'background' | 'mask'
      }

which is incorrect and does not work, I checked the code you are not reading from type config to get the mask.

now if I use segmentForeground() - which seems the only way that "works" in your examples, I get this which is not a typical mask, why its blueish-purple color?

image

Thanks for pointing this out.

The mask is currently a rgba image with each channel habe the same mask data. You can just use any channel and use is as alphamask for another image.

How would you like the mask to be provided?