Images taken from https://en.wikipedia.org/wiki/Window_function
In GIMP:

1) Scale image to width=49
2) Select the two plot rectangle (19 x 18) with selection mode "Add"
3) Invert selection and press DEL
4) Select only the right plot and move it at 1 pixel from the left one (cut/paste)
5) Crop at 1 pixel, rectangle must 41x20
6) Fuzzy select the white area and add to selection unselected uggly gray pixels
7) Press delete to make selection all white
8) Fill with black and select with rectangle all spurrious points + DEL
9) Fill with white
10) Add mask from inverted selection

Not all images are converted this way: a thin contour can be seen on them.
