NodeJS Canvas | Clip region not accurate - Random whitespaces along edges

旧巷老猫 提交于 2020-05-16 02:22:55

问题


I'm facing a problem with the Canvas clip function.

I got the coordinates of the border of the first star on the following picture, but when I clip along the coordinates and then erase the rest I am left with some whitespaces around the star. Some edges like the bottom right ones work fine, but the others don't.

I checked the coordinates by hand via Gimp and they're perfectly aligned along the border (clip border is running on the white pixels touching the outter black border)

Coordinates Array

The result looks like this. I just can't understand why some edges don't contain any whitespaces but others do. This totally confuses me on how to use the clip function.

What am I doing wrong? Do i need to work diagonally instead of always left/right up/down?

来源:https://stackoverflow.com/questions/61123327/nodejs-canvas-clip-region-not-accurate-random-whitespaces-along-edges

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!