I would tackle this from two directions.
First, find the colour and general opacity of watermark.png. Experiment would find this, and it wouldn't take long.
Next, find the exact shapes of the letters, and the positions, in watermark.png. This is far more tedious. You might have to make many adjustments by hand.
Once you have watermark.png, converting the files is almost trivial. I don't understand your PHP & GD code, but if it is like IM's "-compose Over -composite", the inverse would be something like this (Windows BAT syntax):
Code: Select all
convert ^
toeswm.png ^
( watermark.png ^
( +clone -alpha extract +write mpr:WEX ) ^
-compose Multiply -composite -negate ^
) ^
-gravity center ^
-compose ModulusAdd -composite ^
( mpr:WEX -negate ) ^
-alpha off ^
-compose DivideSrc -composite ^
dewm.png
... where toeswm.png is an image with watermark, and the output dewm.png is the de-watermarked image.