CN110889795A - Method for automatically removing image watermark - Google Patents
Method for automatically removing image watermark Download PDFInfo
- Publication number
- CN110889795A CN110889795A CN201811032184.4A CN201811032184A CN110889795A CN 110889795 A CN110889795 A CN 110889795A CN 201811032184 A CN201811032184 A CN 201811032184A CN 110889795 A CN110889795 A CN 110889795A
- Authority
- CN
- China
- Prior art keywords
- picture
- pictures
- watermark
- color
- method comprises
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/0021—Image watermarking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2201/00—General purpose image data processing
- G06T2201/005—Image watermarking
- G06T2201/0203—Image watermarking whereby the image with embedded watermark is reverted to the original condition before embedding, e.g. lossless, distortion-free or invertible watermarking
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Editing Of Facsimile Originals (AREA)
Abstract
The invention relates to the technical field of Web application and development, in particular to a method for automatically removing a picture watermark. The method comprises the following steps: 1. loading and reading all pictures to be processed; 2. screening and filtering pictures; 3. loading the picture into an image buffer area and replacing the picture watermark; 4. and outputting and storing the picture after replacing the watermark. The invention solves the problems of automation of image watermark removal, the need of a third-party tool for removing the watermark, complex operation, poor effect and low efficiency, and can be widely applied to WEB application and development.
Description
Technical Field
The invention relates to the technical field of Web application and development, in particular to a method for automatically removing a picture watermark.
Background
Watermarking is a means of protection of digital information. The watermark is to add some digital information to data multimedia (such as image, sound, video signal, etc.) to achieve the functions of file authenticity identification, copyright protection, etc. The embedded watermark information is hidden in the host file, and the observability and the integrity of the original file are not influenced.
Images such as JPG, PNG, etc. that we commonly see are displayed in units of pixels. In the ARGB image representation method, each pixel point has four ARGB channels, A represents transparency and has a value range of 0-255, R represents red in three primary colors and has a value range of 0-255, G represents green in the three primary colors and has a value range of 0-255, B represents blue in the three primary colors and has a value range of 0-255. Only 4 8-bit binaries, i.e. one int type, are needed to store these data. Each color has a specific ARGB value, and the removal of the watermark is realized by changing the ARGB value in a specific range in a picture into white with four channel values of 255.
It is difficult to remove the watermark in the picture under normal conditions, and need with the help of third party's instrument, complex operation, and the effect is poor, and is inefficient. The invention automatically identifies the image watermark through the program and carries out processing and replacement, solves the problems of automation of removing the image watermark and the problems of complex operation, poor effect and low efficiency of removing the image watermark by a third-party tool, and can be widely applied to the WEB application and development process.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a method for automatically removing the image watermark; the problem of remove the automation of picture watermark to and remove the watermark and need with the help of third party's instrument, complex operation, effect are poor, inefficiency is solved.
The technical scheme for solving the technical problems is as follows:
the method comprises the following steps:
loading and reading all pictures to be processed;
step two, screening and filtering pictures;
loading the picture into an image buffer area and replacing the picture watermark;
and step four, outputting and storing the picture after replacing the watermark.
In the method for automatically removing the image watermark, in the first step, all the images to be processed are loaded and read, a plurality of images can be directly selected for reading, and the images can also be read through the image storage catalog, and are converted into image objects after being read and stored in the set.
And in the second step, filtering pictures, circulating the picture set in the first step, filtering non-JPG and PNG format pictures, respectively reading the watermark color and the background color for storage, and storing the filtered pictures in a new set.
And in the third step, the picture set in the second step is circulated, the pictures are loaded into the image buffer area, double-layer circulation is carried out according to the width and the height of the pictures, the color of each pixel is acquired one by one, whether the color value is the watermark color or not is judged, if yes, the color of the current pixel is set to be the background color of the current picture, and otherwise, the processing is not carried out.
In the fourth step, after the watermark in the third step is replaced, the data in the picture buffer area is read again, and is converted into a picture object, and the picture is output and stored.
The invention solves the problems of automation of image watermark removal, the need of a third-party tool for removing the watermark, complex operation, poor effect and low efficiency, and can be widely applied to WEB application and development processes.
Drawings
The invention is further described below with reference to the accompanying drawings:
FIG. 1 is a flow chart of the method of the present invention.
Detailed Description
As shown in fig. 1, the present invention specifically comprises the following steps:
loading and reading all pictures to be processed;
step two, screening and filtering pictures;
loading the picture into an image buffer area and replacing the picture watermark;
and step four, outputting and storing the picture after replacing the watermark.
In the first step, all pictures to be processed are loaded and read, a plurality of pictures can be directly selected for reading, or the pictures can be read through the picture storage directory, and the pictures are converted into picture objects after being read and stored in the collection.
public static voidload images (File f) { if (f = null) { if (f.isdirection ()) { File [ ] fileArray = f.listfiles () ], if (fileArray | = null) { for (int i = 0; i < fileArray.length; i + +// recursively calling loadImages (fileArray [ i ]) ], } } } else { Stringname = f.getName (); if (name. sWith. ("png") | name. sWith. ("jpg")))) { fileList
And in the second step, filtering pictures, circulating the picture set in the first step, filtering non-JPG and PNG format pictures, respectively reading the watermark color and the background color for storage, and storing the filtered pictures in a new set.
private static void replaceFolderImages(String dir) { FiledirFile = new File(dir); File[]files = dirFile.listFiles(newFileFilter() { public boolean accept(File file) { String name =file.getName(); if (name.endsWith("png") || name.endsWith("jpg")) {return true; } return false; } }); for(File img : files) { replaceColor(img.getAbsolutePath(),img.getAbsolutePath()); } }
And in the third step, the picture set in the second step is circulated, the pictures are loaded into the image buffer area, double-layer circulation is carried out according to the width and the height of the pictures, the color of each pixel is acquired one by one, whether the color value is the watermark color or not is judged, if yes, the color of the current pixel is set to be the background color of the current picture, and otherwise, the processing is not carried out.
// Color wColor = new Color (255, 255, 255)// white
Color wColor = new Color (238, 243, 249)// light gray
for (int i = 0; i<bi.getWidth(); i++) {
for (int j = 0; j<bi.getHeight(); j++) {
//System.out.println(bi.getRGB(i, j));
int color = bi.getRGB(i, j);
Color oriColor = new Color(color);
int red = oriColor.getRed();
int greed = oriColor.getGreen();
int blue = oriColor.getBlue();
// pink colour
if (greed<190 || blue<190) {
} else {
V/remove pink watermark (pink is replaced by white)
// if (red == 255&&greed>180&&blue>180) {
// bi.setRGB(i, j, wColor.getRGB());
// }
// remove the gray watermark (gray is replaced by white)
// if (red == 229&&greed == 229&&blue == 229) {
// bi.setRGB(i, j, wColor.getRGB());
// }
// remove the light gray watermark (gray replaced with white or light gray)
if (red>170&&greed>170&&blue>170) {
bi.setRGB(i, j, wColor.getRGB());
}
}
}
}
In the fourth step, after the watermark in the third step is replaced, the data in the picture buffer area is read again, and is converted into a picture object, and the picture is output and stored.
String type = file.substring(file.lastIndexOf(".") + 1, file.length()); Iterator<ImageWriter>it = ImageIO.getImageWritersByFormatName(type); ImageWriter writer = it.next(); File f = new File(dstFile);f.getParentFile().mkdirs(); ImageOutputStream ios =ImageIO.createImageOutputStream(f); writer.setOutput(ios); writer.write(bi); bi.flush(); ios.flush(); ios.close()。
Claims (5)
1. A method for automatically removing a picture watermark is characterized in that: the method comprises the following steps:
loading and reading all pictures to be processed;
step two, screening and filtering pictures;
loading the picture into an image buffer area and replacing the picture watermark;
and step four, outputting and storing the picture after replacing the watermark.
2. The method of claim 1, wherein the method comprises: in the first step, all pictures to be processed are loaded and read, a plurality of pictures can be directly selected for reading, or the pictures can be read through the picture storage directory, and the pictures are converted into picture objects after being read and stored in the collection.
3. The method of claim 1, wherein the method comprises: and in the second step, filtering pictures, circulating the picture set in the first step, filtering non-JPG and PNG format pictures, respectively reading the watermark color and the background color for storage, and storing the filtered pictures in a new set.
4. The method of claim 1, wherein the method comprises: and in the third step, the picture set in the second step is circulated, the pictures are loaded into the image buffer area, double-layer circulation is carried out according to the width and the height of the pictures, the color of each pixel is acquired one by one, whether the color value is the watermark color or not is judged, if yes, the color of the current pixel is set to be the background color of the current picture, and otherwise, the processing is not carried out.
5. The method of claim 1, wherein the method comprises: in the fourth step, after the watermark in the third step is replaced, the data in the picture buffer area is read again, and is converted into a picture object, and the picture is output and stored.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811032184.4A CN110889795A (en) | 2018-09-07 | 2018-09-07 | Method for automatically removing image watermark |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811032184.4A CN110889795A (en) | 2018-09-07 | 2018-09-07 | Method for automatically removing image watermark |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110889795A true CN110889795A (en) | 2020-03-17 |
Family
ID=69744271
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811032184.4A Withdrawn CN110889795A (en) | 2018-09-07 | 2018-09-07 | Method for automatically removing image watermark |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110889795A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112131539A (en) * | 2020-09-28 | 2020-12-25 | 北京达佳互联信息技术有限公司 | Watermark information adding method and device |
-
2018
- 2018-09-07 CN CN201811032184.4A patent/CN110889795A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112131539A (en) * | 2020-09-28 | 2020-12-25 | 北京达佳互联信息技术有限公司 | Watermark information adding method and device |
CN112131539B (en) * | 2020-09-28 | 2024-05-14 | 北京达佳互联信息技术有限公司 | Watermark information adding method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101520901B (en) | Image processing apparatus and image processing method | |
US6909806B2 (en) | Image background replacement method | |
US20100034469A1 (en) | Method of fast searching and recognition of a digital image representative of at least one graphical pattern in a bank of digital images | |
EP1566763B1 (en) | Watermarking of limited colour images | |
JP2005229620A (en) | System and method for generating high compression image data file having multiple foreground planes | |
EP0901102A2 (en) | Watermark embedding method and system | |
JP2003228712A (en) | Method for identifying text-like pixel from image | |
CN107273838A (en) | Traffic lights capture the processing method and processing device of picture | |
CN112419214A (en) | Method and device for generating labeled image, readable storage medium and terminal equipment | |
CN110889795A (en) | Method for automatically removing image watermark | |
JP2004334852A (en) | Image processing by pixel types | |
US6577320B1 (en) | Method and apparatus for processing multiple types of pixel component representations including processes of premultiplication, postmultiplication, and colorkeying/chromakeying | |
US7715650B2 (en) | Method and apparatus for digital processing of images | |
JP4441300B2 (en) | Image processing apparatus, image processing method, image processing program, and recording medium storing the program | |
US6850624B1 (en) | Data embedding apparatus, data extracting apparatus, and method therefor, and recording medium having such methods recorded thereon | |
US7551322B2 (en) | Image edge filtering | |
CN113947529B (en) | Image enhancement method, model training method, component identification method and related equipment | |
CN116167910A (en) | Text editing method, text editing device, computer equipment and computer readable storage medium | |
JP2003087562A (en) | Image processor and image processing method | |
US20050134601A1 (en) | Method and system to combine a digital graphics object and a digital picture | |
JP2006229280A (en) | Image processing apparatus and method, and program and recording medium | |
CN110119380B (en) | Storage and reading method and device for scalable vector graphics file | |
US7903124B2 (en) | Individual channel filtering of palettized image formats | |
JP2002236921A (en) | Document image recognition method, document image recognition device and recording medium | |
CN114022353B (en) | Method and device for fusing space-time image texture and image color |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20200317 |