'How to remove a watermark in python that is the same color as text

recently I've been trying to remove a watermark from a generated jpg. https://gyazo.com/7f29652d18923e7325c43592b2f15afa

The main issue that I'm having is that when I try to replace a specific hex color in my numpy array it ends up destroying the whole format of the image.

image = PIL.Image.open("78abdfcc-8a45-4186-970d-4eaf8b02e41b.jpg")
image_array = np.array(image)
new_array = []
count = 0
for num in image_array:
    new_array.append([])
    for i in num:
        if list(range(120,160)) in i:
            i = [0,0,255]
        new_array[count].append(i)
        
    count += 1

From the result output you can see that the dimensions are the same. The only thing that changes is the colors, which I'm intending to change the color of the watermark. Does anyone have a different idea for removing watermarks using python? Thanks for the help!

(I have checked out this thread https://github.com/LJSthu/Python-Remove-Watermark and I was unable to use the code in a working manner)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source