Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Removes a larger (uniform colored) watermark from a small font text image. |
last modified: July 08, 2024
USAGE: unwatermark [-c close] [-d dilate] infile outfile -c close close morphology disk kernel size to extract watermark from image; float>0; default=3 -d dilate dilate morphology disk kernel size on watermark mask image; float>0; default=1.5 -s save save intermediate images: watermark (w), mask (m) or both (b) as PNG format named after input. PURPOSE: To remove a larger (uniform colored) watermark from a small font text image. DESCRIPTION: UNWATERMARK removes a larger (uniform colored) watermark from a small font text image. ARGUMENTS: -c close ... CLOSE morphology disk kernel size to extract watermark from the image. Values are floats>0. The default=3. The kernel diameter should be larger than the smaller font text and much smaller than the larger uniform colored watermark text. (diameter = 2*radius = 2*3*close (approx.); diameter for close=3 is 2*3*3=18) -d dilate ... DILATE morphology disk kernel size on watermark mask image. Values are floats>=0. The default=1.5 -s save ... SAVE intermediate images; choices are: watermark (w), mask (m) or both (b) as PNG format named after input. Default is no save images. REQUIREMENTS: Requires IM 7 in order to get the median color of just the watermark in the image. REFERENCE: Christoph Rackwitz's Python Code at: https://stackoverflow.com/questions/78130983/opencv-remove-watermark/78672690#78672690 CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
Example 1 |
Original Image |
![]() |
Arguments: -s watermark |
Result: ![]() |
Watermark: ![]() |
Example 2 |
Original Image |
![]() |
Arguments: -s watermark |
Result: ![]() |
Watermark: ![]() |
Example 3 |
Original Image |
![]() |
Arguments: -s watermark |
Result: ![]() |
Watermark: ![]() |
What the script does is as follows:
|