CN115600164A - Method and device for adding customized watermark, intelligent terminal and storage medium - Google Patents

Method and device for adding customized watermark, intelligent terminal and storage medium Download PDF

Info

Publication number
CN115600164A
CN115600164A CN202211150236.4A CN202211150236A CN115600164A CN 115600164 A CN115600164 A CN 115600164A CN 202211150236 A CN202211150236 A CN 202211150236A CN 115600164 A CN115600164 A CN 115600164A
Authority
CN
China
Prior art keywords
watermark
customized
option
page
target page
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.)
Pending
Application number
CN202211150236.4A
Other languages
Chinese (zh)
Inventor
关瑞
吴闽华
姜坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Zhenyou Communication Technology Co ltd
Original Assignee
Xi'an Zhenyou Communication Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Xi'an Zhenyou Communication Technology Co ltd filed Critical Xi'an Zhenyou Communication Technology Co ltd
Priority to CN202211150236.4A priority Critical patent/CN115600164A/en
Publication of CN115600164A publication Critical patent/CN115600164A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/16Program or content traceability, e.g. by watermarking

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a method and a device for adding customized watermarks, an intelligent terminal and a storage medium, wherein the method comprises the following steps: acquiring a watermark generation option and acquiring a customized watermark; adding the customized watermark to the target page according to the watermark generation option to obtain a display page; monitoring the display page, and if monitoring the DOM change of the display page, adding the customized watermark to the target page again. According to the invention, the customized watermark is added to the target page, so that the personalized customization of the watermark content is realized, the use experience of a user is improved, the pressure of a server is reduced through the quick response of the front end and the back end to the generated watermark, the watermark is prevented from being tampered by monitoring the DOM change of the displayed page, and the safety of the system is improved.

Description

Method and device for adding customized watermark, intelligent terminal and storage medium
Technical Field
The invention relates to the technical field of information security, in particular to a method and a device for adding customized watermarks, an intelligent terminal and a storage medium.
Background
Today, with the rapid development of informatization, more and more enterprises pay attention to industrial security. For example, when some important documents are printed, a watermark is added to the document, for example, the words of "top secret" and "secret" can make the persons who obtain the document know the importance of the document.
The digital watermark can achieve the functions of file authenticity identification, copyright protection and the like by adding certain information in image, sound and video signals, can provide strong evidence for receiving the attribution of copyright information products, and can monitor the transmission of protected data, authenticity identification, illegal copy control and the like. Therefore, in order to prevent information leakage or infringement of intellectual property rights, we are often put forward a need to add watermarks to pages when developing software systems.
In the prior art, a native code is required to assist in generating the watermark, the application range of the watermark is limited, the performance of a server is influenced by a large amount of calculation, personalized information of the watermark cannot be intelligently given, and the tracing of an infringement source is not facilitated.
Accordingly, there is a need for improvements and developments in the art.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method, an apparatus, an intelligent terminal and a storage medium for adding customized watermarks, aiming at solving the problems that the performance of a server is affected and personalized information cannot be intelligently given to watermarks due to a large number of watermarks generated by a native code in the prior art.
The technical scheme adopted by the invention for solving the technical problem is as follows:
in a first aspect, the present invention provides a method for adding a customized watermark, wherein the method includes:
acquiring a watermark generation option and acquiring a customized watermark; the watermark generation option is used for selecting front-end watermarking or back-end watermarking, and the customized watermark comprises user information or user-defined content;
adding the customized watermark to the target page according to the watermark generation option to obtain a display page;
monitoring the display page, and if monitoring the DOM change of the display page, adding the customized watermark to the target page again.
In an implementation manner, the adding a customized watermark to the target page according to the watermark generation option to obtain a display page includes:
if the watermark generation option is a front-end watermark generation enabling option, adding the customized watermark to the target page through a front-end control to obtain the display page;
and if the watermark generation option is a back-end watermark generation enabling option, adding the customized watermark to the target page through a back-end control to obtain the display page.
In an implementation manner, if the watermark generation option is a front-end watermark generation enabled option, adding the customized watermark to the target page through a front-end control to obtain the display page, includes:
if the watermark generation option is a front end watermark generation enabling option, covering a div box with a fixed position on the target page; wherein the pointer event of the div box is forbidden, and the style attribute is click through;
generating watermarks div in the div box through js circulation, wherein one customized watermark is displayed in each watermark div;
constructing a watermark dom element according to the watermark div;
and adding the watermark dom element to the target page to obtain the display page.
In an implementation manner, if the watermark generation option is a front-end watermark generation enabled option, adding the customized watermark to the target page through a front-end control to obtain the display page, includes:
if the watermark generation option is a front end watermark generation enabling option, covering a div box with a fixed position on the target page;
creating a canvas on the div box;
outputting the customized watermark as a watermark picture on the canvas;
setting watermark parameters through JavaScript, and covering the watermark picture on the target page according to the watermark parameters to obtain the display page; wherein the watermark parameters include: styles are implemented to fill the entire screen, zlndex values, and transparency.
In an implementation manner, if the watermark generation option is a front end watermark generation enabled option, adding the customized watermark to the target page through a front end control to obtain the display page includes:
if the watermark generation option is a front end watermark generation starting option, covering a div box with a fixed position on the target page;
creating a canvas on the div box, and acquiring pixel data of the target page;
drawing the customized watermark on the pixel data in the canvas to obtain watermark pixels;
selecting any one color of R, G and B, converting the color value of the pixel which contains the watermark pixel in the pixel data corresponding to the selected color into an odd number, and converting the color value of the pixel which does not contain the watermark pixel in the pixel data corresponding to the selected color into an even number to obtain replaced pixel data;
and converting the replaced pixel data into a base64 picture, and replacing the target page by the base64 picture to obtain the display page.
In an implementation manner, if the watermark generation option is a back-end watermark generation enabled option, adding the customized watermark to the target page through a back-end control to obtain the display page, where the method includes:
if the watermark generation option is a back-end watermark generation enabling option, a user-defined control is newly built on the target page;
newly building a user-defined watermark effect control; the text of the user-defined watermark effect control is a system version number, and the user-defined watermark effect control does not receive click triggering;
and the user-defined watermark effect control is quoted in the user-defined control to obtain the display page.
In one implementation, the monitoring the display page, and if monitoring a DOM change of the display page, re-adding the customized watermark to the target page includes:
setting a timer;
monitoring DOM change of the display page by using a MutationObserver at each trigger time of the timer; the DOM change comprises increase and decrease of child nodes, change of attributes and change of text content;
and if the DOM change is monitored, adding the customized watermark to the target page again.
In a second aspect, an embodiment of the present invention further provides an apparatus for adding a customized watermark, where the apparatus includes:
the watermark generation option acquisition module is used for acquiring a watermark generation option and acquiring a customized watermark; the watermark generation option is used for selecting front-end watermarking or back-end watermarking, and the customized watermark comprises user information or user-defined content;
the display page acquisition module is used for adding the customized watermark to the target page according to the watermark generation option to obtain a display page;
and the monitoring module is used for monitoring the display page, and if the DOM change of the display page is monitored, the customized watermark is added to the target page again.
In a third aspect, an embodiment of the present invention further provides an intelligent terminal, where the intelligent terminal includes a memory, a processor, and a program that is stored in the memory and is capable of being executed on the processor, and when the processor executes the program that is capable of adding a customized watermark, the steps of the method for adding a customized watermark according to any one of the foregoing are implemented.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a program for adding a customized watermark, and when the program for adding a customized watermark is executed by a processor, the steps of the method for adding a customized watermark according to any one of the above are implemented.
Has the advantages that: compared with the prior art, the invention provides a method for adding customized watermarks, which comprises the steps of firstly obtaining watermark generation options, freely selecting whether a front end or a back end generates a watermark according to the watermark generation options, and then tracking user information and adding a document state through the watermark content by customizing the watermark content. And then, adding the customized watermark to the target page according to the watermark generation option to obtain a display page, and finally monitoring the display page to prevent the watermark from being tampered, so that the safety of the system is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart illustrating a specific implementation of a method for adding a customized watermark according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of adding a custom watermark effect control according to an embodiment of the present invention.
Fig. 3 is a schematic block diagram of a customized watermarking apparatus according to an embodiment of the present invention.
Fig. 4 is a schematic block diagram of an internal structure of an intelligent terminal according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and effects of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
The digital watermark can achieve the functions of file authenticity identification, copyright protection and the like by adding certain information in image, sound and video signals, can provide strong evidence for receiving the attribution of copyright information products, and can monitor the transmission of protected data, authenticity identification, illegal copy control and the like. Therefore, in order to prevent information leakage or infringement of intellectual property rights, we are often put forward a need to add watermarks to pages when developing software systems. In the prior art, a native code is required to be applied to assist in generating the watermark, the application range of the watermark is limited, the performance of a server is influenced by a large amount of calculation, personalized information of the watermark cannot be intelligently given, and the tracing of an infringement source is not facilitated.
Therefore, in order to solve the above problems, this embodiment provides a method for adding a customized watermark, in which the invention first obtains a watermark generation option, and can freely select whether to generate a watermark from a front end or a back end according to the watermark generation option, and then, through customizing the watermark content, can track the user information and add the document state through the watermark content. And then, adding the customized watermark to the target page according to the watermark generation option to obtain a display page, and finally monitoring the display page to prevent the watermark from being tampered, thereby improving the safety of the system.
Exemplary method
The present embodiment provides a method of adding a customized watermark. As shown in fig. 1, the method comprises the steps of:
s100, acquiring a watermark generation option and acquiring a customized watermark; the watermark generation option is used for selecting front-end watermarking or back-end watermarking, and the customized watermark comprises user information or user-defined content;
specifically, a user firstly determines front-end watermarking or back-end watermarking through a watermark generation option, and simultaneously generates a customized watermark for the user. The customized watermark can be generated by automatically acquiring a user name when a user logs in the system to form the customized watermark. The named watermark content can be customized, the watermark can be loaded to the files of the type contained in the system at will, and the normal use of the protected data is not influenced; it will not degrade. The customizable watermark is a document state, such as a draft may be identified by the customizable watermark. If the front end is selected to add watermark processing to the page, the picture and the like, the pressure of the server end can be relieved, and the quick response is realized. The user can also choose to add the watermark at the back end according to the server resource so as to fully meet the personalized requirements of the user.
For example, when a file resource is not bound to a single user, but one resource is viewed by multiple users, a user-specific watermark, such as a job number, a login name, a telephone number, and the like of each user, needs to be added when each user views the file resource, and is mostly used for some confidential documents or pages displaying confidential information, and the watermark is aimed at tracing a responsible person when the document flows out. Therefore, even when the user acquires or spreads the page content in a downloading, screenshot and other modes, the responsible person can be tracked through the user information on the watermark.
S200, adding the customized watermark to the target page according to the watermark generation option to obtain a display page;
specifically, after the user selects the watermark generation option, the customized watermark is added to the target page according to the result selected by the user, wherein the target page can be a document, or a document page such as a picture or a video. And after the customized watermark is added on the target page, the display page with the customized watermark is obtained.
For example, when a user name watermark of a photographer is added to a picture, the generated customized watermark with the user name of the photographer is added to the picture, and the picture with the watermark information, namely the presentation page, is obtained. Therefore, even if the picture is displayed on a public platform, the picture with the watermark information cannot be used for commercial use, and the rights and interests of a photographer are effectively protected.
It should be noted that all the display pages with customized watermarks are disabled by the right button function, so that the right button of the mouse can be prevented from copying pictures.
In an implementation manner, the step S200 in this embodiment includes the following steps:
step S201, if the watermark generation option is a front-end watermark generation starting option, adding the customized watermark to the target page through a front-end control to obtain the display page;
step S202, if the watermark generation option is a back-end watermark generation option, adding the customized watermark to the target page through a back-end control to obtain the display page.
Specifically, when the user selects the front-end watermark generation option, the customized watermark is added to the target page through the front-end control to obtain the display page, and when the user selects the rear-end watermark generation option, the customized watermark is added to the target page through the rear-end control to obtain the display page, wherein the watermark generation option is a single option, that is, only one of the front-end watermark generation option and the rear-end watermark generation option can be selected according to actual needs, but not simultaneously.
In this way, words or other data that can distinguish the identity of the individual can be added to the picture. Thus, the individual can be traced according to the leaked data, and the performance is good. And firstly, the customized watermark is added at the front end, so that server resources are not occupied, the computing power of a client side is completely relied on, and the pressure of the server side is reduced. Secondly, the speed is fast, and the performance is superior to that of the back end no matter what the implementation mode of the front end is. Thirdly, the implementation is simple. And the watermark is added at the back end, so that the computing power of the server can be fully utilized, and the method is suitable for large-scale systems.
In an implementation manner, the step S201 in this embodiment includes the following steps:
step S2011, if the watermark generation option is a front end watermark generation enabling option, covering a div box with a fixed position on the target page; wherein the pointer event of the div box is forbidden, and the style attribute is click through;
step S2012, generating watermarks div in the div box through js circulation, wherein each watermark div displays one customized watermark;
step S2013, a watermark dom element is constructed according to the watermark div;
and step S2014, adding the watermark dom element to the target page to obtain the display page.
Specifically, the embodiment can realize the addition of the customized watermark through the repeated DOM element overlay. Starting from the effect, the effect is to fill repeated identity representing information with low transparency on a page, cover a position: fixed div box on the page, set the box transparency to be low, set Pointer-events: none to realize that the Pointer event of the div box is forbidden, namely when the div box is clicked, the corresponding event is not triggered, and meanwhile, the style realizes click through, so that the lower layer element of the div box can respond to the click event. And generating small watermarks div in the div box through js circulation, wherein each watermark div shows one content to be displayed. Thus, a watermark dom element is obtained, and then the watermark dom element is added to the target page to obtain the display page.
For example, the number of the employee's pay is added to a pay sheet page, and a plurality of pay watermarks are required to be arranged in a certain order. Covering a position fixed div box on the payroll page, setting low transparency for the box to be able to see through the content of the payroll, and then pointing-events: none; the style realizes click through, small watermarks div are generated in a div box through js circulation, a staff pay number is displayed in each small watermark div, a watermark dom element is obtained, and the watermark dom element is added to a pay sheet page to obtain a display page with staff pay number watermarks.
In an implementation manner, the step S201 in this embodiment includes the following steps:
step S2015, if the watermark generation option is a front end watermark generation enabled option, covering a div box with a fixed position on the target page;
step S2016, creating a canvas on the div box;
step S2017, outputting the customized watermark on the canvas as a watermark picture;
step S2018, setting watermark parameters through JavaScript, and covering the watermark picture on the target page according to the watermark parameters to obtain the display page; wherein the watermark parameters include: styles are implemented to fill the entire screen, zlndex values, and transparency.
In particular, the present implementation may also add customized watermarks by canvas output background maps. Covering a fixed positioning box on a page, then creating a canvas, drawing a watermark area, converting a target page by a toDataURL () method in the canvas to obtain the dataURL encoded by base64, wherein the toDataURL () method is a method for converting picture encoding in the canvas, can convert a picture into png in a base64 encoding format, and then returns Data URL Data. Thus, the customized watermark is output as a base64 picture by a toDataURL method, the base64 picture is set as a background picture of the box, and the customized watermark is output by a background-repeat: repeat; the pattern achieves the effect of filling the entire screen. After the page is loaded, a page element div is created through javascript, a text node is created in the div element, and watermark content is displayed. And setting a div element style, setting a higher value for the zIndex of the div element style, and setting transparency to realize the watermark effect floating on the page. Where zIndex is a special attribute in the div element. Because the display is a two-dimensional plane, the displayed pattern has an x-axis and a y-axis to represent the position attribute. To represent the concept of three-dimensional stereo, such as the order of the superposition of the upper and lower layers of display elements, a zIndex attribute was introduced to represent the z-axis difference. Representing the up-down stereoscopic relationship of an element in the stacking order. If zIndex is set to a higher value, this layer of elements will float above the lower layer elements of zIndex. Meanwhile, the transparency is set to ensure that the upper layer elements can not completely shield the lower layer elements.
For example, it is desirable to add watermarks with special purpose-limited typeface to the identification photographs. Firstly, a fixed-position div box is covered on a page, then a canvas is created, a watermark area is drawn, and the customized watermark is added in the watermark area. Outputting the customized watermark limited to special use as a picture by a ToDataURL method, setting the picture as a background picture of a box, and outputting the customized watermark limited to special use by a background-repeat: repeat; the pattern achieves the effect of filling the entire screen. And after the certificate photo is loaded, creating a page element div through javascript, creating a text node in the div element, and displaying watermark content. And setting a div element style, setting a higher value for the zIndex of the div element style, and setting transparency to realize a 'special purpose limited' customized watermark effect floating on a page so as to prevent the certificate photo from being falsely used.
In an implementation manner, the step S201 in this embodiment includes the following steps:
step M2011, if the watermark generation option is a front end watermark generation starting option, covering a div box with a fixed position on the target page;
step M2012, creating a canvas on the div box, and acquiring pixel data of the target page;
step M2013, drawing the customized watermark on the pixel data in the canvas to obtain watermark pixels;
step M2014, selecting any one color of R, G and B, converting the color value of the pixel data corresponding to the selected color, which contains the watermark pixel, into an odd number, and converting the color value of the pixel data corresponding to the selected color, which does not contain the watermark pixel, into an even number to obtain replacement pixel data;
and step M2015, converting the pixel data into a base64 picture according to the replacement pixel data, and replacing the target page with the base64 picture to obtain the display page.
In particular, for picture resources, the explicit watermark may destroy the integrity of the picture, and in some cases, we want to preserve the original pattern of the picture, and then the hidden watermark may be added. The color values of RGB are stored in the pixel information of the picture, small changes of RGB component values cannot be distinguished by naked eyes, the picture identification cannot be influenced, and the RGB of the picture can be slightly changed by a special rule. The method comprises the steps of obtaining pixel data of a picture through canvas, firstly drawing a watermark in the canvas, obtaining the pixel data of the watermark, obtaining the pixel data of the original picture through the canvas, selecting one of R, G and B such as G, traversing pixels of the original picture, converting G of pixels with information corresponding to the watermark pixels into odd numbers, converting pixels without information corresponding to the watermark pixels into even numbers, converting the pixels into base64 after processing, and replacing the base64 on a page, wherein the invisible watermark is added, the picture is normally without the watermark, but the watermark can be seen after decryption processing according to a corresponding rule (the corresponding decryption rule is that the corresponding G in the pixel data of the traversed picture, the rgba is set to 0, the odd numbers are set to 255,0, and the even numbers are set to 0,0 and 0).
In an implementation manner, the step S202 in this embodiment includes the following steps:
step S2021, if the watermark generation option is a back end watermark generation enabling option, newly building a custom control on the target page;
step S2022, newly building a user-defined watermark effect control; the text of the user-defined watermark effect control is a system version number, and the user-defined watermark effect control does not accept click triggering;
step S2023, the user-defined watermark effect control is quoted in the user-defined control, and the display page is obtained.
Specifically, if the watermark generation option is a back-end watermark generation enabling option, a back-end watermark generation method needs to be enabled. Firstly, a new custom control is placed on a page, and then the custom watermark effect control is quoted in the custom control, so that a display page is obtained. When the processing capacity of the server meets the requirement, the security can be better ensured by realizing the watermark through the back end.
For example, add a custom control TextBox to Grid; and adding a custom watermark effect control, such as TextBlock, to the TextBox. Binding the text of the TextBlock as a system version number obtained by a program from a system, and then keeping the IsHitTestVisible of the TextBlock = 'False', so that the user can not click the text in the text by the IsHitTestVisible attribute; add style property of TextBlock as shown in fig. 2. And finally, referencing a TextBlock custom watermark effect control in the TextBox control to obtain a display page.
And step S300, monitoring the display page, and if monitoring the DOM change of the display page, adding the customized watermark to the target page again.
In an implementation manner, the step S300 in this embodiment includes the following steps:
step S301, setting a timer;
step S302, at each trigger time of the timer, monitoring DOM change of the display page by using a MutationObserver; the DOM change comprises increase and decrease of child nodes, change of attributes and change of text content;
and step S303, if the DOM is monitored to be changed, the customized watermark is added to the target page again.
In particular, a timer is set, the watermark elements are checked every few seconds as being absent, whether they have been modified or not, and the method of overlaying the watermark is performed again if a change has occurred.
For example, using the MutationObserver, the MutationObserver api is used to monitor DOM changes, any changes to the DOM, such as the increase or decrease of children nodes, changes to attributes, and changes to text content, may be notified. And if the DOM change is monitored, the customized watermark is newly arranged on the target page.
Exemplary devices
As shown in fig. 3, the present embodiment further provides an apparatus for adding a customized watermark, including:
a watermark generation option obtaining module 10, configured to obtain a watermark generation option and obtain a customized watermark; the watermark generation option is used for selecting front-end watermark adding or back-end watermark adding, and the customized watermark comprises user information or user-defined content;
a display page obtaining module 20, configured to add the customized watermark to the target page according to the watermark generation option to obtain a display page;
and the monitoring module 30 is configured to monitor the display page, and if the DOM change of the display page is monitored, add the customized watermark to the target page again.
In an implementation manner, the display page obtaining module 20 according to this embodiment includes:
a first obtaining unit, configured to add the customized watermark to the target page through a front-end control if the watermark generation option is a front-end watermark generation enabling option, to obtain the display page;
and the second obtaining unit is used for adding the customized watermark to the target page through a back-end control to obtain the display page if the watermark generating option is a back-end watermark generating option.
In an implementation manner, in this embodiment, the first obtaining unit includes:
a box covering subunit, configured to cover a div box with a fixed position on the target page if the watermark generation option is a front end watermark generation enabling option; the pointer event of the div box is forbidden, and the style attribute is click-through;
a watermark div generating subunit, configured to generate a watermark div in the div box through js loop, where one customized watermark is displayed in each watermark div;
a watermark dom element constructing subunit, configured to construct a watermark dom element according to the watermark div;
and the display page acquisition subunit is used for adding the watermark dom element to the target page to obtain the display page.
In an implementation manner, in this embodiment, the first obtaining unit includes:
a box covering subunit, configured to cover a div box with a fixed position on the target page if the watermark generation option is a front end watermark generation enabling option;
a canvas creation subunit for creating a canvas on the div box;
a watermark picture generating subunit, configured to output the customized watermark as a watermark picture on the canvas;
the display page acquiring subunit is used for setting a watermark parameter through JavaScript and covering the watermark picture on the target page according to the watermark parameter to obtain the display page; wherein the watermark parameters include: styles are implemented to fill the entire screen, zlndex values, and transparency.
In an implementation manner, in this embodiment, the first obtaining unit includes:
a box covering subunit, configured to cover a div box with a fixed position on the target page if the watermark generation option is a front end watermark generation enabling option;
a pixel data obtaining subunit, configured to create a canvas on the div box, and obtain pixel data of the target page;
a watermark pixel obtaining subunit, configured to draw the customized watermark on the pixel data in the canvas to obtain a watermark pixel;
a replaced pixel data acquisition subunit, configured to select any one of R, G, and B colors, convert the color value of the watermark pixel included in the pixel data corresponding to the selected color into an odd number, and convert the color value of the watermark pixel not included in the pixel data corresponding to the selected color into an even number, to obtain replaced pixel data;
and the display page acquisition subunit is used for converting the pixel data into a base64 picture according to the replacement pixel data, and replacing the target page with the base64 picture to obtain the display page.
In an implementation manner, in this embodiment, the second obtaining unit includes:
a custom control creating subunit, configured to create a custom control on the target page if the watermark generation option is a back-end watermark generation enabling option;
a custom watermark effect control creating subunit, which is used for creating a custom watermark effect control; the text of the user-defined watermark effect control is a system version number, and the user-defined watermark effect control does not accept click triggering;
and the display page obtaining subunit is used for referencing the custom watermark effect control in the custom control to obtain the display page.
In one implementation manner, the listening module 30 in this embodiment includes:
a timer subunit for setting a timer;
a monitoring subunit, configured to monitor, at each trigger time of the timer, a DOM variation of the display page using a MutationObserver; the DOM change comprises increase and decrease of child nodes, change of attributes and change of text content;
and the customized watermark adding subunit is used for adding the customized watermark to the target page again if the DOM change is monitored.
Based on the above embodiment, the present invention further provides an intelligent terminal, and a schematic block diagram thereof may be as shown in fig. 4. The intelligent terminal comprises a processor, a memory, a network interface, a display screen and a temperature sensor which are connected through a system bus. Wherein, the processor of the intelligent terminal is used for providing calculation and control capability. The memory of the intelligent terminal comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the intelligent terminal is used for being connected and communicated with an external terminal through a network. The computer program when executed by a processor implements a method of adding a customized watermark. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the intelligent terminal is arranged inside the intelligent terminal in advance and used for detecting the operating temperature of internal equipment.
It will be understood by those skilled in the art that the block diagram of fig. 4 is only a block diagram of a portion of the structure associated with the solution of the present invention, and does not constitute a limitation to the intelligent terminal to which the solution of the present invention is applied, and a specific intelligent terminal may include more or less components than those shown in the figure, or may combine some components, or have a different arrangement of components.
In one embodiment, an intelligent terminal is provided, where the intelligent terminal includes a memory, a processor, and a customized watermarking program stored in the memory and executable on the processor, and the processor executes the customized watermarking program to implement the following operation instructions:
acquiring a watermark generation option and acquiring a customized watermark; the watermark generation option is used for selecting front-end watermarking or back-end watermarking, and the customized watermark comprises user information or user-defined content;
adding the customized watermark to the target page according to the watermark generation option to obtain a display page;
monitoring the display page, and if monitoring the DOM change of the display page, adding the customized watermark to the target page again.
Those of ordinary skill in the art will appreciate that the various illustrative components and steps of implementation described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, operational databases, or other media used in embodiments provided herein may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual operation data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct bused dynamic RAM (DRDRAM), and bused dynamic RAM (RDRAM), among others.
In summary, the present invention discloses a method, an apparatus, an intelligent terminal and a storage medium for adding customized watermark, wherein the method comprises: acquiring a watermark generation option and acquiring a customized watermark; adding the customized watermark to the target page according to the watermark generation option to obtain a display page; and monitoring the display page, and if the DOM change of the display page is monitored, adding the customized watermark to the target page again. According to the invention, the customized watermark is added to the target page, so that the personalized customization of the watermark content is realized, the use experience of a user is improved, the pressure of a server is reduced through the quick response of the front end and the back end to the generated watermark, the watermark is prevented from being tampered by monitoring the DOM change of the displayed page, and the safety of the system is improved.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method of adding a customized watermark, the method comprising:
acquiring a watermark generation option and acquiring a customized watermark; the watermark generation option is used for selecting front-end watermark adding or back-end watermark adding, and the customized watermark comprises user information or user-defined content;
adding the customized watermark to the target page according to the watermark generation option to obtain a display page;
and monitoring the display page, and if the DOM change of the display page is monitored, adding the customized watermark to the target page again.
2. The method for adding customized watermark according to claim 1, wherein the adding customized watermark to the target page according to the watermark generation option to obtain a display page comprises:
if the watermark generation option is a front-end watermark generation starting option, adding the customized watermark to the target page through a front-end control to obtain the display page;
and if the watermark generation option is a back-end watermark generation enabling option, adding the customized watermark to the target page through a back-end control to obtain the display page.
3. The method for adding a customized watermark according to claim 2, wherein if the watermark generation option is a front-end watermark generation enabling option, adding the customized watermark to the target page through a front-end control to obtain the display page, includes:
if the watermark generation option is a front end watermark generation starting option, covering a div box with a fixed position on the target page; wherein the pointer event of the div box is forbidden, and the style attribute is click through;
generating watermarks div in the div box through js circulation, wherein one customized watermark is displayed in each watermark div;
constructing a watermark dom element according to the watermark div;
and adding the watermark dom element to the target page to obtain the display page.
4. The method for adding the customized watermark according to claim 2, wherein if the watermark generation option is a front-end watermark generation enabling option, adding the customized watermark to the target page through a front-end control to obtain the display page, includes:
if the watermark generation option is a front end watermark generation enabling option, covering a div box with a fixed position on the target page;
creating a canvas on the div box;
outputting the customized watermark as a watermark picture on the canvas;
setting watermark parameters through JavaScript, and covering the watermark picture on the target page according to the watermark parameters to obtain the display page; wherein the watermark parameters include: styles are implemented to fill the entire screen, zlndex values, and transparency.
5. The method for adding the customized watermark according to claim 2, wherein if the watermark generation option is a front-end watermark generation enabling option, adding the customized watermark to the target page through a front-end control to obtain the display page, includes:
if the watermark generation option is a front end watermark generation enabling option, covering a div box with a fixed position on the target page;
creating a canvas on the div box and acquiring pixel data of the target page;
drawing the customized watermark on the pixel data in the canvas to obtain watermark pixels;
selecting any one color of R, G and B, converting the color value of the pixel containing the watermark pixel in the pixel data corresponding to the selected color into an odd number, and converting the color value of the pixel not containing the watermark pixel in the pixel data corresponding to the selected color into an even number to obtain replaced pixel data;
and converting the replaced pixel data into a base64 picture, and replacing the target page with the base64 picture to obtain the display page.
6. The method for adding the customized watermark according to claim 2, wherein if the watermark generation option is a back-end watermark generation enabling option, adding the customized watermark to the target page through a back-end control to obtain the display page, includes:
if the watermark generation option is a back-end watermark generation enabling option, newly building a custom control on the target page;
newly building a user-defined watermark effect control; the text of the user-defined watermark effect control is a system version number, and the user-defined watermark effect control does not accept touch gestures;
and quoting the user-defined watermark effect control in the user-defined control to obtain the display page.
7. The method for adding customized watermark according to claim 1, wherein the monitoring the presentation page, and if the DOM of the presentation page is monitored to be changed, the adding the customized watermark to the target page again comprises:
setting a timer;
monitoring DOM change of the display page by using a MutationObserver at each trigger time of the timer; the DOM change comprises increase and decrease of child nodes, change of attributes and change of text content;
and if the DOM is monitored to be changed, the customized watermark is added to the target page again.
8. An apparatus for adding a customized watermark, the apparatus comprising:
the watermark generation option acquisition module is used for acquiring a watermark generation option and acquiring a customized watermark; the watermark generation option is used for selecting front-end watermark adding or back-end watermark adding, and the customized watermark comprises user information or user-defined content;
the display page acquisition module is used for adding the customized watermark to the target page according to the watermark generation option to obtain a display page;
and the monitoring module is used for monitoring the display page, and if the DOM change of the display page is monitored, the customized watermark is added to the target page again.
9. An intelligent terminal, characterized in that the intelligent terminal comprises a memory, a processor and a customized watermarking program stored in the memory and operable on the processor, and the processor, when executing the customized watermarking program, implements the steps of the customized watermarking method according to any one of claims 1 to 7.
10. A computer-readable storage medium, wherein a program for adding a customized watermark is stored on the computer-readable storage medium, and when the program for adding a customized watermark is executed by a processor, the steps of the method for adding a customized watermark according to any one of claims 1 to 7 are implemented.
CN202211150236.4A 2022-09-21 2022-09-21 Method and device for adding customized watermark, intelligent terminal and storage medium Pending CN115600164A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211150236.4A CN115600164A (en) 2022-09-21 2022-09-21 Method and device for adding customized watermark, intelligent terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211150236.4A CN115600164A (en) 2022-09-21 2022-09-21 Method and device for adding customized watermark, intelligent terminal and storage medium

Publications (1)

Publication Number Publication Date
CN115600164A true CN115600164A (en) 2023-01-13

Family

ID=84845346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211150236.4A Pending CN115600164A (en) 2022-09-21 2022-09-21 Method and device for adding customized watermark, intelligent terminal and storage medium

Country Status (1)

Country Link
CN (1) CN115600164A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115984082A (en) * 2023-03-21 2023-04-18 杭州虎符网络有限公司 Dark watermark adding and extracting method, device, storage medium and terminal
CN116957893A (en) * 2023-06-26 2023-10-27 海易科技(北京)有限公司 Watermark generation method, watermark generation device, electronic device and computer readable medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115984082A (en) * 2023-03-21 2023-04-18 杭州虎符网络有限公司 Dark watermark adding and extracting method, device, storage medium and terminal
CN116957893A (en) * 2023-06-26 2023-10-27 海易科技(北京)有限公司 Watermark generation method, watermark generation device, electronic device and computer readable medium
CN116957893B (en) * 2023-06-26 2024-04-16 海易科技(北京)有限公司 Watermark generation method, watermark generation device, electronic device and computer readable medium

Similar Documents

Publication Publication Date Title
CN115600164A (en) Method and device for adding customized watermark, intelligent terminal and storage medium
Kwok et al. Deepfake: a social construction of technology perspective
EP3164805B1 (en) Method and system for selective document redaction
US9323937B2 (en) Methods and systems for establishing and enforcing document visibility rights with an electronic signature service
US9282215B2 (en) Security mark with copyable and non-copyable elements
AU2016231592B2 (en) 3-d printing protected by digital rights management
CN110489943B (en) Page watermark tamper-proofing method and system
US8671342B2 (en) Desired font rendering
US20130194301A1 (en) System and method for securely transmiting sensitive information
US20130007602A1 (en) Fixed layout electronic publications
US8952989B2 (en) Viewer unit, server unit, display control method, digital comic editing method and non-transitory computer-readable medium
EP2774110A1 (en) Systems and methods for dynamic digital product synthesis, commerce, and distribution
US9961230B2 (en) Method and system for applying a watermark to a document
CN111507352B (en) Image processing method and device, computer equipment and storage medium
JP2007081452A (en) Image processing method, image processing apparatus, program code, and storage medium
US8719169B2 (en) Digital media personalization
KR102131895B1 (en) Method and program for tracking replicated webtoon
CN108256360B (en) Sensitive information display method and terminal
JP2004280816A (en) Creation method and system of document with copy protection
US7428076B2 (en) Smart copying for variable cost, editable printouts
CN111062194A (en) Document processing method and device, computer equipment and readable storage medium
US20130069953A1 (en) User Interface Feature Generation
CN114896531B (en) Image processing method and device, electronic equipment and storage medium
JP2005165777A (en) Information processor, information processing method, and program
CN111611038B (en) Method for inserting view objects in electronic book reading page and computing device

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