title: Removing transparent watermark from an image - python
body: <p>I am trying to remove a transparent watermark from an image.</p>
  <p>Here is my sample image:</p>
  <p><a href="https://i.stack.imgur.com/0f5zZm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0f5zZm.jpg" alt="" /></a></p>
  <p>I would like to remove the text &quot;Watermark&quot; from the image. As you can see, the text is transparent. So I would like to replace that text to the original background.</p>
  <p>Something like this would be my desired output:</p>
  <p><a href="https://i.stack.imgur.com/gWNFRm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gWNFRm.jpg" alt="" /></a></p>
  <p>I tried some examples (I am currently using cv2, if other libraries can solve the problem please also recommend), but none of them where near from succeeding. I know the way to go would be to have a mask (like in <a href="https://stackoverflow.com/questions/55811122/remove-logo-watermark-given-locations-from-an-image-using-python-opencv-deep-lea/55811304#55811304">this</a> post), but they all already have masked images, but I don't.</p>
  <p>Here is what I tried to do to have a mask, I turned down the saturation to black and white, and created an image &quot;imagemask.jpg&quot;, then tried going through the pixels with a <code>for</code> loop:</p>
  <pre><code>mask = cv2.imread('imagemask.jpg')
  new = []
  rows, cols, _ = mask.shape
  for i in range(rows):
      new.append([])
      #print(i)
      for j in range(cols):
          k = img[i, j]
          #print(k)
          if all(x in range(110, 130) for x in k):
              new[-1].append((255, 255, 255))
          else:
              new[-1].append((0, 0, 0))
  
  cv2.imwrite('finalmask.jpg', np.array(new))
  </code></pre>
  <p>Then after that wanted to use the code for the mask, but I realized the &quot;finalmask.jpg&quot; is a complete mess... so I didn't try using the code for the mask.</p>
  <p>Is this actually possible? I have been trying for around 3 hours but receiving no luck...</p>