Can we remove the watermarks using ImageMagick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Akkisai
Posts: 4
Joined: 2011-07-08T04:39:37-07:00
Authentication code: 8675308

Can we remove the watermarks using ImageMagick

Post by Akkisai »

Technical Team,

Issue: Need to remove the watermark(text) diagnally right placed on a .tiff image which consists of text, Both the image text and the watermark text are in the same color(Black).

Critical issues:
1. The watermark text is placed diagnally right on the background of image(.tiff) file.
2. The image file is a scanned format of Document.
3. It is observed that when each pixel values are read from the image, there is no diff between the RGBA values for Text on Image and watermark text.

Can we overcome the issue using Imagemagick tool.

Please sugest the ways to resolve the issue.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Can we remove the watermarks using ImageMagick

Post by anthony »

It would be likely impossible to determine if a pixel in the watermark area should be on (for underlying text) or not. Especially without shading (greyscale) effects in the scan.

However if you like to post a small cut-down sample of the problem, people on the forum can give it a go, and make suggestions. Without a sample we'd be simply guessing!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Can we remove the watermarks using ImageMagick

Post by glennrp »

4. Removing such a watermark would almost certainly be a copyright violation, if you didn't create the image yourself in the first place, and the person placing the watermark had the right to do so.
Akkisai
Posts: 4
Joined: 2011-07-08T04:39:37-07:00
Authentication code: 8675308

Re: Can we remove the watermarks using ImageMagick

Post by Akkisai »

anthony wrote:It would be likely impossible to determine if a pixel in the watermark area should be on (for underlying text) or not. Especially without shading (greyscale) effects in the scan.

However if you like to post a small cut-down sample of the problem, people on the forum can give it a go, and make suggestions. Without a sample we'd be simply guessing!
1.The sample image is given in the below link.
http://www.flickr.com/photos/65102804@N ... otostream/
The background text "Not" in the image is the watermark which is to be removed.


2.There is no copyright issue involved.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Can we remove the watermarks using ImageMagick

Post by glennrp »

Since the watermark lines are very thin with respect to the main text,
noise reduction should do it, although the main text will be damaged somewhat:

Code: Select all

convert -noise 4x4 input.jpg output.jpg
unless there is fine print elsewhere on the document; that will disappear along
with the watermark!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can we remove the watermarks using ImageMagick

Post by fmw42 »

morphologic close might be a better way to go -- seems to remove the thin lines without too much distortion of the main text.

convert 5929918592_946af57ae2.jpg -morphology close diamond 5929918592_946af57ae2_close.jpg

see http://www.imagemagick.org/Usage/morphology/
Akkisai
Posts: 4
Joined: 2011-07-08T04:39:37-07:00
Authentication code: 8675308

Re: Can we remove the watermarks using ImageMagick

Post by Akkisai »

Thankyou so much.

The "morphologic close diaomand" command worked for my image(WaterMark disapeared).

But the problem is the remaing text in the image had disturbed a bit.
Can we limit this disturbance to a limited area,so that the disturbance is limited to the text under which the watermark is removed (or) can we sharpen the remaining text after the watermark is removed.

The WaterMark in the image is placed diagnally left to right in the middle of the image file.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Can we remove the watermarks using ImageMagick

Post by Bonzo »

You could probably use -region something like this ( change the dimensions in region to reflect the area you want to modify ):

Code: Select all

convert 5929918592_946af57ae2.jpg -region 160x180+35+30 -morphology close diamond 5929918592_946af57ae2_close.jpg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Can we remove the watermarks using ImageMagick

Post by anthony »

Alturnative is to enlarge the 'closed' text ('erode' the white background), and use it as a mask of the original image.
But you may be left with small pixels from the watermark attached to edges the letters.

basically it comes down to 'how disturbed' you want it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Akkisai
Posts: 4
Joined: 2011-07-08T04:39:37-07:00
Authentication code: 8675308

Re: Can we remove the watermarks using ImageMagick

Post by Akkisai »

Can we get the region shown in the below image(Red marked) using the -region option with convert command.
http://www.flickr.com/photos/65102804@N07/5939977114/

How to combine the below two into one command line argument.
1.convert GoodMorning.png -region 360x380+300+320 GoodMorning_level.bmp
2.convert GoodMorning_level.bmp -gravity center -region 1060x1580+300+320 GoodMorning_level.bmp


Thanks & Regards,
Akkisai
Post Reply