A watermark adding method and apparatus
By configuring the watermark object in the initial style file of the page and loading it using the target watermark file, the problems of complex watermark addition and poor concealment in the existing technology are solved, achieving efficient and concealed watermark loading, and improving page performance and data security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2020-12-03
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies involve complex loading processes, high resource consumption, and significant performance overhead when adding watermarks to pages. They also have poor concealment, are easily modified or deleted, and have poor compatibility.
By pre-configuring the watermark object in the initial style file of the target page based on the watermark configuration information, generating the page style file, and adding the watermark using the target watermark file, the creation and drawing export of the dynamic canvas are avoided, and the watermark object is directly loaded as a style element.
The watermark loading process has been simplified, page performance overhead has been reduced, the concealment and reliability of the watermark have been improved, and page loading efficiency and data security have been enhanced.
Smart Images

Figure CN114612279B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, specifically to a watermarking method and apparatus. Background Technology
[0002] Watermarking is an important means of protecting digital information. Existing watermarking technologies mainly fall into two categories: adding visible watermarks to data that needs protection, and adding hidden watermarks to data that needs protection. Adding visible watermarks to data that needs protection can serve as a warning and prevent the spread of screenshots, thus preventing information leakage. Adding hidden watermarks (such as transparent watermarks or invisible watermarks) to data that needs protection can protect the data without compromising its aesthetic and usability value.
[0003] Current technologies for adding watermarks to web pages often utilize Canvas technology. When the page loads, a canvas must first be created on the webpage. Then, the watermark information is drawn onto the created canvas. Finally, the appropriate object is called to export image data in a specified format as the webpage background image, which is then tiled and displayed. This loading process is complex, resource-intensive, and has high page performance overhead, resulting in low loading efficiency. Furthermore, the watermark image and data generated by the Canvas can be easily viewed using debugging tools, allowing for modification or deletion of the watermark information. This approach lacks concealment and compatibility. Therefore, a more efficient and reliable solution is needed. Summary of the Invention
[0004] To address the problems of existing technologies, this application provides a watermarking method and apparatus. The technical solution is as follows:
[0005] This application provides a method for adding a watermark, the method comprising:
[0006] The server receives a page style file of the target page, the page style file including the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information.
[0007] The page style file is parsed to obtain the target style data;
[0008] Extract watermark file requirement information from the target style data;
[0009] A file retrieval request is sent to the server, the file retrieval request carrying the watermark file requirement information, so that the server can determine the target watermark file from the watermark file library based on the watermark file requirement information;
[0010] Receive the target watermark file sent by the server;
[0011] Watermarks are added to target elements on the target page based on the target watermark file and the watermark object data in the target style data.
[0012] This application provides another method for adding watermarks, the method comprising:
[0013] The page style file of the target page is sent to the client so that the client can parse the page style file to obtain the target style data and extract watermark file requirement information from the target style data; wherein, the page style file includes the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information.
[0014] Receive a file access request sent by the client, the file access request carrying the watermark file requirement information;
[0015] The target watermark file is determined from the watermark file library based on the watermark file requirement information.
[0016] The target watermark file is sent to the client so that the client can add a watermark to the target element on the target page based on the target watermark file and the watermark object data in the target style data.
[0017] Another aspect of this application provides a watermark adding device, the device comprising:
[0018] The style file receiving module is used to receive the page style file of the target page sent by the server. The page style file includes the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information.
[0019] The data parsing module is used to parse the page style file to obtain the target style data;
[0020] The requirement information extraction module is used to extract watermark file requirement information from the target style data;
[0021] The request sending module is used to send a file request to the server. The file request carries the watermark file requirement information, so that the server can determine the target watermark file from the watermark file library based on the watermark file requirement information.
[0022] A watermark file receiving module is used to receive the target watermark file sent by the server;
[0023] The watermarking module is used to add watermarks to target elements on the target page based on the target watermark file and the watermark object data in the target style data.
[0024] This application also provides another watermarking device, the device comprising:
[0025] The style file sending module is used to send the page style file of the target page to the client, so that the client can parse the page style file to obtain the target style data and extract watermark file requirement information from the target style data; wherein, the page style file includes the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information.
[0026] The request receiving module is used to receive file request sent by the client, the file request carrying the watermark file requirement information;
[0027] The watermark file determination module is used to determine the target watermark file from the watermark file library based on the watermark file requirement information;
[0028] The watermark file sending module is used to send the target watermark file to the client, so that the client can add watermarks to the target elements on the target page based on the target watermark file and the watermark object data in the target style data.
[0029] The watermarking method and apparatus provided in this application have the following technical advantages:
[0030] This application utilizes a page style file and a target watermark file obtained by configuring the target element with a watermark object in the initial style file of the target page based on pre-configured watermark information. The watermark is then added to the target element on the target page. The loading process is simple and efficient, which helps reduce the performance overhead of the page. Furthermore, the watermark object is stored in the page style file, which has strong concealment and helps improve the reliability of the watermark.
[0031] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0032] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a schematic diagram of an application environment provided in an embodiment of this application;
[0034] Figure 2 This is a flowchart illustrating a watermark addition method provided in an embodiment of this application;
[0035] Figure 3 This is a flowchart illustrating another watermark addition method provided in an embodiment of this application;
[0036] Figure 4 This is a flowchart illustrating another watermark addition method provided in an embodiment of this application;
[0037] Figure 5 This is a flowchart illustrating another watermark addition method provided in an embodiment of this application;
[0038] Figure 6 This is a schematic diagram of a page with a configured watermark object provided in an embodiment of this application;
[0039] Figure 7 This is a schematic diagram of a watermark adding device provided in an embodiment of this application;
[0040] Figure 8 This is a schematic diagram of another watermark adding device provided in an embodiment of this application;
[0041] Figure 9 This is a hardware structure block diagram of a server for implementing a watermark addition method, provided in an embodiment of this application. Detailed Implementation
[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout.
[0043] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0044] Please see Figure 1 , Figure 1 This is a schematic diagram of an application environment provided in this application, such as... Figure 1 As shown, the application environment may include client 01 and server 02.
[0045] In the embodiments of this specification, client 01 can be used to load a page containing a watermark, thereby displaying the target page containing watermark information of the target element. Specifically, client 01 can parse the page style file of the target page and send a file access request to server 02 to obtain the target watermark file, and then add the watermark to the target element in the target page based on the parsed data and the target watermark file. Optionally, client 01 may include physical devices such as smartphones, tablets, laptops, desktop computers, digital assistants, smart speakers, smart wearable devices, in-vehicle terminals, servers, etc., and may also include software running on the physical device, such as applications, but is not limited thereto.
[0046] In the embodiments of this specification, server 02 can be used to send the page style file of the target page to client 01, and to determine the target watermark file from the watermark file library based on the watermark file requirement information carried in the file call request sent by client 01, and send it to the client to cooperate with client 01 to load and display the page containing the watermark. In some embodiments, server 02 can also be used to pre-configure the watermark object for the target element in the initial style file of the target page based on the watermark configuration information to obtain the page style file of the target page. Optionally, server 02 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0047] In practical applications, server 02 can send a page style file of the target page to client 01. This page style file can include watermark objects of the target elements in the target page, and the page style file can be obtained by server 02 in advance by configuring the watermark objects of the target elements in the initial style file of the target page based on watermark configuration information. Then, client 01 parses the page style file to obtain target style data and extracts watermark file requirement information from the target style data. Next, client 01 can send a file call request to server 02, which carries the watermark file requirement information. Server 02 can determine the target watermark file from the watermark file library based on the watermark file requirement information and send it to client 01. Thus, client 01 can add watermarks to the target elements in the target page based on the target watermark file and the watermark object data in the target style data, thereby displaying the target page containing the watermark information of the target elements.
[0048] In the embodiments described in this specification, the client 01 and server 02 can be connected directly or indirectly through wired or wireless communication, and this application does not impose any restrictions on this.
[0049] In addition, it should be noted that, Figure 1 This is merely a schematic diagram of an application environment provided by an embodiment of this application, and this application is not limited thereto.
[0050] Figure 2This is a flowchart illustrating a watermarking method provided in an embodiment of this application. This specification provides the operational steps of the method described in the embodiments or flowchart, but based on conventional or non-inventive methods, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or server product execution, the method can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment) as shown in the embodiments or accompanying drawings. Specifically, as... Figure 2 As shown, the method may include:
[0051] S201: The server sends the page style file of the target page to the client.
[0052] In the embodiments of this specification, the target page mentioned above may include a web page to be loaded. A page may include multiple elements, and the elements may include, but are not limited to, data of the type of table, text, and image on the page, or the entire page. In practical applications, the page style file of a page may include the CSS style file (Cascading Style Sheets) of the web page. Specifically, the page style file may include the style information of each element in the page, such as the element's color, layout information, etc. In the embodiments of this specification, the page style file may include the watermark object of the target element in the target page, and the page style file may be obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information.
[0053] In the embodiments of this specification, before the server sends the page style file of the target page to the client, the above method may further include:
[0054] 1) In response to the page load instruction of the target page, the client sends a page load request to the server;
[0055] Specifically, the aforementioned page loading instruction can be issued when the user clicks on the target page, and the aforementioned page loading request can carry style file requirement information (such as the path information of CSS style files).
[0056] In the actual page loading process, when a user clicks on the target page, the HTML file of the target page can be parsed. When a CSS style file is encountered, the client can send a request to the server to obtain the required page style file, and then parse the page style file to achieve page rendering and display.
[0057] 2) Based on the style file requirement information, the server determines the page style file for the target page.
[0058] Please refer to Figure 3 In the embodiments of this specification, since the page style file can be obtained by the server pre-configuring the target element with a watermark object in the initial style file of the target page based on the watermark configuration information, the above method may further include:
[0059] S301: The server obtains watermark configuration information and the initial style file for the target page.
[0060] In one embodiment, the aforementioned watermark configuration information may include the page's UI design information (User Interface Design), specifically including the elements on the target page that require watermark objects to be configured, and the style information of each watermark object; the initial style file of the target page may include a style file that does not contain watermark information, or a style file that has already added some watermark information and needs to add or update watermark information according to the watermark configuration information. In practical applications, the watermark objects can be configured at the same time as the initial style file of the target page is generated, or the watermark objects can be configured on the target elements as needed after the initial style file is generated. This application is not limited to this and can flexibly and conveniently configure watermark objects.
[0061] S303: The server determines the target watermark file from the watermark file library based on the watermark configuration information described above.
[0062] In the embodiments of this specification, the watermark configuration information mentioned above may include watermark file information (such as the path of the watermark file to be used, or the file name of the watermark file, etc.), and the target watermark file can be determined from the watermark file library based on the watermark file information.
[0063] In the embodiments of this specification, a watermark file may include at least one watermark data, and each watermark data may include a watermark identifier and corresponding watermark graphic information. Specifically, each watermark file in the aforementioned watermark file library may be a font file, and each font file may include at least one watermark data. In one embodiment, the watermark identifier of the aforementioned watermark data may be a Unicode code or a character. Subsequently, when configuring watermark objects on target elements in a target page using the watermark data, the content configuration of the watermark object can be performed using the watermark identifier, without directly importing graphic or text data. This improves page loading efficiency during use while also enhancing concealment, making it difficult to easily obtain watermark graphic information and delete or modify the watermark data using page debugging tools. This improves the reliability of watermark addition and enhances the security of the page data that needs protection. In the embodiments of this specification, when the aforementioned watermark file is a font file, the aforementioned watermark file library may include a font file library stored on a server, which stores multiple font files.
[0064] S305: Based on the watermark configuration information and the target watermark file mentioned above, the server configures the watermark object for the target element in the target page in the initial style file, thereby obtaining the page style file for the target page.
[0065] In the embodiments described in this specification, the target watermark file may include at least one watermark data, please refer to... Figure 4 Based on the aforementioned watermark configuration information and the target watermark file, the initial style file configures the watermark object for the target element on the target page, resulting in a page style file for the target page that may include:
[0066] S401: The server determines the target watermark data from the target watermark file based on the watermark configuration information described above.
[0067] In the embodiments of this specification, the required watermark data can be determined from the target watermark file based on the above watermark configuration information. The target watermark data may include one or more watermark data, and each watermark data can be reused when configuring the watermark object. This application is not limited thereto.
[0068] By determining the target watermark data from the target watermark file based on the watermark configuration information mentioned above, the required watermark data can be flexibly selected, improving the flexibility and diversity of watermark generation.
[0069] S403: Based on the target watermark data, the server creates an initial watermark object for the target element in the target page in the aforementioned initial style file.
[0070] In the embodiments described in this specification, the initial watermark object may include a pseudo-object. In one specific embodiment, the pseudo-object may include a before pseudo-object.
[0071] Please refer to Figure 5 In the embodiments of this specification, since each watermark data includes a watermark identifier and corresponding watermark graphic information, the above-mentioned creation of an initial watermark object for the target element in the target page in the above-mentioned initial style file based on the target watermark data includes:
[0072] S501: The server extracts the target watermark identifier from the target watermark data;
[0073] S503: The server creates an initial watermark object for the target element in the target page based on the target watermark identifier mentioned above.
[0074] In the embodiments of this specification, each watermark data includes a watermark identifier and corresponding watermark graphic information. The content attributes of the initial watermark object can be configured using the aforementioned target watermark identifier to complete the creation of the initial watermark object. For example, watermark data 1 includes the watermark identifier "A" and the corresponding watermark graphic "zhangsan", and watermark data 2 includes the watermark identifier "B" and the corresponding watermark graphic "wangwu". If it is necessary to use three watermark data 1 and three watermark data 2 to create an initial watermark object for a target element (such as a data table on a page), the content attribute of the initial watermark object can be configured as "AAABBB", and the watermark graphics can be arranged according to the order of the identifiers in the content attributes.
[0075] By extracting the target watermark identifier from the target watermark data, and then creating an initial watermark object for the target element on the target page based on the target watermark identifier, it is convenient and flexible to configure the watermark object without directly importing graphic or text data. This improves page loading efficiency and concealment during use. When the page is rendered, the watermark identifier is replaced with the corresponding watermark graphic, but the watermark graphic information cannot be easily obtained through page debugging tools to delete or modify the watermark data. Only the watermark identifier information can be seen, which helps to improve the reliability of watermark addition and enhance the security of the page data that needs to be protected.
[0076] In the embodiments of this specification, the process of configuring the target element in the target page with a watermark object based on the watermark configuration information and the target watermark file, and obtaining the page style file of the target page in the initial style file, may further include:
[0077] Configure the location information of the target watermark file in this initial style file.
[0078] Specifically, the location information mentioned above may include the URL (uniform resource locator) of the target watermark file. By configuring the location information of the target watermark file in this initial style file, the information can be extracted during subsequent page loads to retrieve the target watermark file from the server for data rendering.
[0079] In one embodiment, when the watermark file is a font file, before creating an initial watermark object for the target element in the initial style file based on the target watermark data, the method may further include:
[0080] Extract the font name and location information from the target watermark file, and create the target custom font in the initial style file based on the font name and location information.
[0081] At this point, based on the target watermark data, creating an initial watermark object for the target element on the target page in the aforementioned initial style file may also include:
[0082] Extract the font name of the target custom font and configure the font attributes in the initial watermark object based on the font name.
[0083] In the embodiments of this specification, the font name of the target custom font is consistent with the font name extracted from the target watermark file. By creating the target custom font using the target watermark file and configuring the font attributes in the initial watermark object based on the font name, the watermark data in the font file can be directly used to create the initial watermark object for the target element in the target page. The font file loads quickly, and configuring the watermark object using the font file helps to improve webpage performance and increase the efficiency of page loading during use.
[0084] S405: The server obtains the location information of the target element and configures the layout information of the initial watermark object based on the location information.
[0085] In the embodiments of this specification, in order to achieve the watermark effect, it is necessary to obtain the position information of the target element, and configure the layout information of the initial watermark object based on the position information so that the initial watermark object is positioned above the target element and covers the target element; the aforementioned position information may include, but is not limited to, the center point coordinates of the target element and the boundary position of the target element.
[0086] By obtaining the location information of the target element and configuring the layout information of the initial watermark object based on the location information, the watermark object can be configured reasonably and accurately for the target element, improving the accuracy of watermark object positioning, and can be flexibly adapted and adjusted when the style is updated.
[0087] S407: Based on the watermark configuration information mentioned above, the server configures the style attribute information of the initial watermark object to obtain the page style file of the target page.
[0088] In the embodiments described in this specification: the server may configure the style attribute information of the initial watermark object based on the watermark configuration information described above, including but not limited to at least any one of the following 1) to 5):
[0089] 1) Based on the watermark size information in the watermark configuration information above, the server configures the watermark size information for the initial watermark object.
[0090] In the above embodiment, the content attribute of the initial watermark object has been configured as "AAABBB", which is equivalent to an initial watermark object composed of 6 watermark graphics. Based on the watermark attribute information (size, spacing, transparency, color, operation requirements, etc.) in the watermark configuration information, the style attribute information of the initial watermark object can be configured.
[0091] 2) Based on the watermark spacing information in the watermark configuration information above, the server configures the watermark spacing information for the initial watermark object.
[0092] 3) Based on the watermark transparency information in the watermark configuration information above, the server configures the watermark transparency information for the initial watermark object.
[0093] 4) Based on the watermark color information in the watermark configuration information above, the server configures the watermark color information for the initial watermark object.
[0094] 5) Based on the operation requirement information in the watermark configuration information above, the server sets the penetration attribute of the initial watermark object to be penetrable.
[0095] In some embodiments, since the initial watermark object is located above the target element and mainly serves as a warning or information security protection, in order not to affect the user's related operations on the lower layer data (such as the target element itself), the penetration attribute of the initial watermark object can be set to be penetrable. In a specific embodiment, the "penetrable" property can be achieved by setting the value of the pointer-events property to "none".
[0096] By configuring the layout information of the initial watermark object based on the location information, and configuring the style attribute information of the initial watermark object based on the above watermark configuration information, the watermark object configuration of the target element is completed. This is equivalent to updating the initial style file of the target page, resulting in the page style file of the target page. At this time, the page style file includes the generated watermark information, which is conducive to flexibly and efficiently realizing diverse watermark configurations.
[0097] In one specific embodiment, the target page is a query results display page, including the title "Query Results" and a data table below it. The data table is used as the target element for configuring the watermark object. The initial watermark object content attribute of this data table has already been configured using six watermark identifiers: "AAABBB". The watermark graphic corresponding to watermark identifier "A" is "zhangsan", and the watermark graphic corresponding to watermark identifier "B" is "wangwu". Layout and style attribute information have also been configured. The client parses the page style file, and the result of adding and displaying the watermark to the data table can be found in [link to relevant documentation]. Figure 6 The specific data values in the table are not displayed and are replaced with "xxx".
[0098] In the embodiments described in this specification, the server can pre-generate multiple watermark files and store them in a watermark file library for watermark object configuration and watermark addition during page loading. The process of generating a watermark file may include:
[0099] 1) The server obtains at least one watermark style requirement;
[0100] 2) The server generates corresponding watermark data based on the watermark style requirements for each watermark;
[0101] 3) The server generates a watermark file based on the watermark data corresponding to at least one of the above watermark style requirements.
[0102] In some embodiments, a corresponding watermark identifier can be generated for each watermark data, so that the target element can be configured with a watermark object in a flexible and convenient manner using the watermark identifier in the initial style file of the target page. After the watermark file is generated, the watermark file can be stored in the watermark file library for retrieval.
[0103] By pre-generating and storing multiple watermark files, the watermark files can be called up flexibly and quickly when configuring watermark objects and adding watermarks during page loading. This allows for flexible reuse without the need for repeated writing, saving time and manpower. Furthermore, the watermark files or watermark file library can be flexibly updated according to the watermark style requirements of actual applications, improving the diversity of watermark addition.
[0104] S203: The client parses the page style file to obtain the target style data.
[0105] In the embodiments of this specification, the process of the client parsing the page style file to obtain the target style data can be understood as the process of the browser loading the page and parsing the style file. Referring to the above-described process of generating the page style file, since the page style file is pre-configured based on the watermark configuration information, the target element is configured with a watermark object in the initial style file of the target page. The page style file is a style file that includes the watermark object of the target element in the target page. The watermark object can be understood as a kind of style information of the target element. At this time, the target style data obtained by the client after parsing the page style file can contain the watermark object data of the target element.
[0106] S205: The client extracts the watermark file requirement information from the target style data mentioned above.
[0107] In the embodiments of this specification, the watermark data corresponding to the target watermark file has been used in advance to configure the target element in the initial style file of the target page with a watermark object, thereby obtaining the page style file of the target page. In practical applications, the client parses the generated page style file and obtains the target style data, which may include watermark file requirement information. The watermark file requirement information may include the location information of the target watermark file (the URL of the target watermark file), thereby enabling the server to determine the target watermark file from the watermark file library.
[0108] S207: The client sends a file access request to the server.
[0109] In the embodiments described in this specification, the file access request may carry the aforementioned watermark file request information (the location information of the target watermark file, such as the URL of the target watermark file).
[0110] S209: The server determines the target watermark file from the watermark file library based on the watermark file requirement information.
[0111] By utilizing the location information of the target watermark file obtained through parsing, the target watermark file can be quickly and accurately identified from the aforementioned watermark file library, thereby improving the efficiency and reliability of watermark addition.
[0112] S211: The server sends the aforementioned target watermark file to the client.
[0113] S213: The client adds a watermark to the target element on the target page based on the target watermark file and the watermark object data in the target style data.
[0114] In the embodiments of this specification, the watermark object data mentioned above is the watermark object data of the target element. The target style data obtained by the client after parsing the page style file contains the watermark object data of the target element. The process of the client adding a watermark to the target element in the target page can be understood as the page rendering process. Since the watermark object is configured for the target element in the initial style file of the target page based on the watermark configuration information in advance, the target watermark data determined in the target watermark file is used to create an initial watermark object for the target element. The client adding a watermark to the target element in the target page based on the target watermark file and the watermark object data in the target style data may include: the client extracting the target watermark data from the target watermark file and adding a watermark to the target element based on the target watermark data and the watermark object data. Watermarking is added to the target elements on the target page using a page style file pre-configured with a watermark object for the target element. The watermark object is treated as a style element, and watermarking is added during the regular page style loading process. This process is simple and efficient, eliminating the need for dynamic canvas creation and drawing export, reducing resource consumption and improving webpage performance. Please refer to the relevant descriptions in S501 to S503. When configuring a watermark object for the target element, an initial watermark object is created for the target element on the target page based on the target watermark identifier. During page rendering, the watermark identifier is replaced with the corresponding watermark graphic. However, the watermark graphic information cannot be easily obtained through page debugging tools to delete or modify the watermark data; only the watermark identifier information can be seen. This helps improve the reliability of watermarking and enhances the security of the page data that needs protection.
[0115] In the embodiments of this specification, the watermark object data in the target style data described above may include watermark identification information, and the method may further include:
[0116] 1) The client responds to the page debugging command of the target page and generates page debugging information including the watermark identification information corresponding to the target element;
[0117] Specifically, the watermark identifier information corresponding to the target element can be the target watermark identifier used when creating the initial watermark object for the target element on the target page.
[0118] 2) The client displays the page debugging information that includes the watermark identifier information corresponding to the target element.
[0119] By pre-extracting the target watermark identifier from the target watermark data, and then creating an initial watermark object for the target element on the target page based on the aforementioned target watermark identifier, when the client responds to the page debugging command of the target page, page debugging information including the watermark identifier information corresponding to the target element can be generated. There is no need to directly import graphic data or text data, which helps to improve concealment. When the page is rendered, the watermark identifier will be replaced with the corresponding watermark graphic, but the watermark graphic information cannot be easily obtained through page debugging tools to delete or modify the watermark data. Only the watermark identifier information can be seen, which helps to improve the reliability of watermark addition and enhance the security of the page data that needs to be protected.
[0120] As can be seen from the technical solutions provided in the embodiments of this specification above, the embodiments of this specification utilize a page style file obtained by configuring the target element with a watermark object in the initial style file of the target page based on pre-defined watermark configuration information. Watermarks are then added to the target elements on the target page, treating the watermark object as a style element. This watermark addition is achieved during the regular page style loading process, which is simple and efficient, eliminating the need for dynamic canvas creation and drawing export, reducing resource consumption, and improving webpage performance. The target watermark file can be a font file, allowing for flexible and fast loading. By extracting the target watermark identifier from the target watermark data and then creating an initial watermark object for the target element on the target page based on the aforementioned target watermark identifier, watermarking can be implemented flexibly and conveniently. Object configuration eliminates the need to directly import graphic or text data. This improves page loading efficiency and enhances concealment. During page rendering, the watermark identifier is replaced with the corresponding watermark graphic, but the watermark graphic information cannot be easily obtained through page debugging tools to delete or modify the watermark data. Only the watermark identifier information is visible, thus improving the reliability of watermark addition and enhancing the security of page data that needs protection. By configuring the layout information of the initial watermark object based on this location information, and configuring the style attribute information of the initial watermark object based on the above watermark configuration information, the watermark object configuration of the target element is completed, resulting in the page style file of the target page. This allows for flexible and efficient implementation of diverse watermark configurations.
[0121] This application also provides a watermark adding device, such as... Figure 7 As shown, the device may include:
[0122] The style file receiving module 710 is used to receive the page style file of the target page sent by the server. The page style file includes the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information.
[0123] The data parsing module 720 is used to parse the page style file to obtain the target style data;
[0124] The requirement information extraction module 730 is used to extract watermark file requirement information from the target style data;
[0125] The request sending module 740 is used to send a file request to the server. The file request carries the watermark file requirement information so that the server can determine the target watermark file from the watermark file library based on the watermark file requirement information.
[0126] The watermark file receiving module 750 is used to receive the target watermark file sent by the server;
[0127] The watermark adding module 760 is used to add watermarks to target elements in the target page based on the target watermark file and the watermark object data in the target style data.
[0128] In the embodiments described in this specification, the above-mentioned apparatus may further include:
[0129] The page load request sending module is used to send a page load request to the server in response to the page load instruction of the target page before receiving the page style file of the target page sent by the server. The page load request carries style file requirement information, so that the server can determine the page style file of the target page based on the style file requirement information.
[0130] In one embodiment, the watermark object data in the target style data includes watermark identification information, and the above-mentioned device may further include:
[0131] The debugging information generation module is used to generate page debugging information, including watermark identification information corresponding to the target element, in response to the page debugging command of the target page.
[0132] The debugging information display module is used to display page debugging information, including the watermark identification information corresponding to the target element.
[0133] This application also provides another watermark adding device, such as... Figure 8 As shown, the device may include:
[0134] The style file sending module 810 is used to send the page style file of the target page to the client, so that the client can parse the page style file to obtain the target style data and extract watermark file requirement information from the target style data; wherein, the page style file includes the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information;
[0135] The request receiving module 820 is used to receive a file request sent by the client, the file request carrying the watermark file requirement information;
[0136] The watermark file determination module 830 is used to determine the target watermark file from the watermark file library based on the watermark file requirement information;
[0137] The watermark file sending module 840 is used to send the target watermark file to the client, so that the client can add watermarks to the target elements in the target page based on the target watermark file and the watermark object data in the target style data.
[0138] In the embodiments described in this specification, the above-mentioned apparatus may further include:
[0139] The information acquisition module is used to acquire the watermark configuration information and the initial style file of the target page;
[0140] The file determination module is used to determine the target watermark file from the watermark file library based on the watermark configuration information;
[0141] The watermark object configuration module is used to configure the watermark object on the target element in the target page in the initial style file based on the watermark configuration information and the target watermark file, so as to obtain the page style file of the target page.
[0142] In one specific embodiment, the target watermark file mentioned above includes at least one watermark data, and the watermark object configuration module mentioned above may include:
[0143] A watermark data determination unit is used to determine target watermark data from the target watermark file based on the watermark configuration information.
[0144] An initial watermark object creation unit is used to create an initial watermark object for a target element in the target page in the initial style file based on the target watermark data.
[0145] A layout information configuration unit is used to obtain the position information of the target element and configure the layout information of the initial watermark object based on the position information.
[0146] The attribute information configuration unit is used to configure the style attribute information of the initial watermark object based on the watermark configuration information to obtain the page style file of the target page.
[0147] In one specific embodiment, the attribute information configuration unit described above may include at least one of the following:
[0148] A watermark size configuration unit is used to configure watermark size information for the initial watermark object based on the watermark size information in the watermark configuration information.
[0149] A watermark spacing configuration unit is used to configure watermark spacing information for the initial watermark object based on the watermark spacing information in the watermark configuration information.
[0150] A watermark transparency configuration unit is used to configure watermark transparency information for the initial watermark object based on the watermark transparency information in the watermark configuration information.
[0151] A watermark color configuration unit is used to configure watermark color information for the initial watermark object based on the watermark color information in the watermark configuration information.
[0152] The watermark penetration configuration unit is used to set the penetration attribute of the initial watermark object to be penetrable based on the operation requirement information in the watermark configuration information.
[0153] In one specific embodiment, the above-described initial watermark object creation unit may include:
[0154] An identifier extraction unit is used to extract the target watermark identifier from the target watermark data;
[0155] An object creation unit is used to create an initial watermark object for a target element in the target page based on the target watermark identifier.
[0156] The apparatus and method embodiments described herein are based on the same application concept.
[0157] This application provides a computer device including a processor and a memory. The memory stores at least one instruction or at least one program, which is loaded and executed by the processor to implement the watermarking method provided in the above method embodiments.
[0158] Memory can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. Memory can primarily include a program storage area and a data storage area. The program storage area can store the operating system, application programs required for the functions, etc.; the data storage area can store data created based on the use of the device, etc. Furthermore, memory can include high-speed random access memory, and can also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory can also include a memory controller to provide the processor with access to the memory.
[0159] The methods and embodiments provided in this application can be executed on mobile terminals, computer terminals, servers, or similar computing devices. That is, the aforementioned computer devices may include mobile terminals, computer terminals, servers, or similar computing devices. The server may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal may be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. Taking running on a server as an example... Figure 9 This is a hardware structure block diagram of a server used to implement the above-described watermarking method, provided in an embodiment of this application. Figure 9 As shown, the server 900 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 910 (CPUs 910 may include, but are not limited to, microprocessors MCUs or programmable logic devices FPGAs), a memory 930 for storing data, and one or more storage media 920 (e.g., one or more mass storage devices) for storing application programs 923 or data 922. The memory 930 and storage media 920 may be temporary or persistent storage. The program stored in the storage media 920 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 910 may be configured to communicate with the storage media 920 and execute a series of instruction operations in the storage media 920 on the server 900. The server 900 may also include one or more power supplies 960, one or more wired or wireless network interfaces 950, one or more input / output interfaces 940, and / or one or more operating systems 921, such as Windows Server.TM Mac OSX TM Unix TM Linux TM FreeBSD TM etc.
[0160] The processor 910 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0161] The input / output interface 940 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 900. In one example, the input / output interface 940 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 940 may be a radio frequency (RF) module for wireless communication with the Internet.
[0162] Operating system 921 may include system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, to implement various basic business functions and handle hardware-based tasks.
[0163] Those skilled in the art will understand that Figure 9 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 900 may also include... Figure 9 The more or fewer components shown, or having the same Figure 9 The different configurations shown.
[0164] Embodiments of this application also provide a computer-readable storage medium, which can be disposed in a server to store at least one instruction or at least one program related to implementing a watermarking method in the method embodiments. The at least one instruction or the at least one program is loaded and executed by the processor to implement the watermarking method provided in the above method embodiments.
[0165] Optionally, in this embodiment, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0166] Embodiments of this application also provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described above.
[0167] As can be seen from the embodiments of the watermarking method, apparatus, device, storage medium, or computer program provided in this application, this application utilizes a page style file obtained by configuring the target element with a watermark object in the initial style file of the target page based on pre-defined watermark configuration information. Watermarks are then added to the target elements on the target page, treating the watermark object as a style element. Watermarking is implemented during the regular page style loading process, which is simple and efficient, eliminating the need for dynamic canvas creation and drawing export, reducing resource consumption, and improving webpage performance. The target watermark file can be a font file, allowing for flexible and fast loading. By extracting the target watermark identifier from the target watermark data and then creating an initial watermark object for the target element on the target page based on the aforementioned target watermark identifier, flexibility is improved. This method allows for convenient watermark object configuration without directly importing graphic or text data. It improves page loading efficiency and enhances concealment. During page rendering, the watermark identifier is replaced with the corresponding watermark graphic, but the watermark graphic information cannot be easily obtained through page debugging tools to delete or modify the watermark data; only the watermark identifier information is visible. This improves the reliability of watermark addition and enhances the security of the page data to be protected. By configuring the layout information of the initial watermark object based on its location information, and configuring its style attributes based on the aforementioned watermark configuration information, the watermark object configuration of the target element is completed, resulting in the page style file for the target page. This allows for flexible and efficient implementation of diverse watermark configurations.
[0168] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, specific embodiments have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0169] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0170] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0171] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for adding a watermark, characterized in that, The method includes: The server receives a page style file of the target page, the page style file including the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information. The page style file is parsed to obtain the target style data; Extract watermark file requirement information from the target style data; the watermark file requirement information package Includes the location information of the target watermark file; A file retrieval request is sent to the server, the file retrieval request carrying the watermark file requirement information, so that the server can determine the target watermark file from the watermark file library based on the watermark file requirement information; Receive the target watermark file sent by the server; Watermarks are added to target elements on the target page based on the target watermark file and the watermark object data in the target style data.
2. The method according to claim 1, characterized in that, The method further includes: Before receiving the page style file of the target page sent by the server, in response to the page load instruction of the target page, a page load request is sent to the server, the page load request carrying style file requirement information; so that the server can determine the page style file of the target page based on the style file requirement information.
3. The method according to claim 1, characterized in that, The watermark object data in the target style data includes watermark identification information, and the method further includes: In response to a page debugging command on the target page, page debugging information including watermark identification information corresponding to the target element is generated; Display the page debugging information that includes the watermark identifier information corresponding to the target element.
4. A method for adding a watermark, characterized in that, The method includes: The page style file of the target page is sent to the client so that the client can parse the page style file to obtain target style data and extract watermark file requirement information from the target style data. The watermark file requirement information includes the location information of the target watermark file. The page style file includes the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information. Receive a file access request sent by the client, the file access request carrying the watermark file requirement information; The target watermark file is determined from the watermark file library based on the watermark file requirement information; The target watermark file is sent to the client so that the client can add a watermark to the target element on the target page based on the target watermark file and the watermark object data in the target style data.
5. The method according to claim 4, characterized in that, The method further includes: Obtain the watermark configuration information and the initial style file of the target page; The target watermark file is determined from the watermark file library based on the watermark configuration information; Based on the watermark configuration information and the target watermark file, the target elements in the target page are configured with watermark objects in the initial style file to obtain the page style file of the target page.
6. The method according to claim 5, characterized in that, The target watermark file includes at least one watermark data. The step of configuring watermark objects for target elements in the target page within the initial style file, based on the watermark configuration information and the target watermark file, to obtain the page style file of the target page includes: Based on the watermark configuration information, the target watermark data is determined from the target watermark file; Based on the target watermark data, an initial watermark object is created for the target element in the target page in the initial style file; Obtain the position information of the target element, and configure the layout information of the initial watermark object based on the position information; Based on the watermark configuration information, the style attribute information of the initial watermark object is configured to obtain the page style file of the target page.
7. The method according to claim 6, characterized in that, The configuration of style attribute information for the initial watermark object based on the watermark configuration information includes at least one of the following: Based on the watermark size information in the watermark configuration information, configure the watermark size information for the initial watermark object; Based on the watermark spacing information in the watermark configuration information, configure the watermark spacing information for the initial watermark object; Based on the watermark transparency information in the watermark configuration information, configure the watermark transparency information for the initial watermark object; Based on the watermark color information in the watermark configuration information, configure the watermark color information for the initial watermark object; Based on the operation requirement information in the watermark configuration information, the penetration attribute of the initial watermark object is set to be penetrable.
8. The method according to claim 6, characterized in that, The step of creating an initial watermark object for the target element in the target page based on the target watermark data includes: Extract the target watermark identifier from the target watermark data; An initial watermark object is created for the target element in the target page based on the target watermark identifier.
9. A watermark adding device, characterized in that, The device includes: The style file receiving module is used to receive the page style file of the target page sent by the server. The page style file includes the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information. The data parsing module is used to parse the page style file to obtain the target style data; The requirement information extraction module is used to extract watermark file requirement information from the target style data; the watermark file requirement information includes the location information of the target watermark file. The request sending module is used to send a file request to the server. The file request carries the watermark file requirement information, so that the server can determine the target watermark file from the watermark file library based on the watermark file requirement information. A watermark file receiving module is used to receive the target watermark file sent by the server; The watermarking module is used to add watermarks to target elements on the target page based on the target watermark file and the watermark object data in the target style data.
10. The apparatus according to claim 9, characterized in that, The device further includes: The page load request sending module is used to send a page load request to the server in response to the page load instruction of the target page before receiving the page style file of the target page sent by the server. The page load request carries style file requirement information, so that the server can determine the page style file of the target page based on the style file requirement information.
11. The apparatus according to claim 9, characterized in that, The watermark object data in the target style data includes watermark identification information, and the device further includes: The debugging information generation module is used to generate page debugging information, including watermark identification information corresponding to the target element, in response to the page debugging command of the target page. The debugging information display module is used to display page debugging information, including the watermark identification information corresponding to the target element.
12. A watermark adding device, characterized in that, The device includes: The style file sending module is used to send the page style file of the target page to the client, so that the client can parse the page style file to obtain the target style data, and extract watermark file requirement information from the target style data. The watermark file requirement information includes the location information of the target watermark file. The page style file includes the watermark object of the target element in the target page, and the page style file is obtained by configuring the watermark object of the target element in the initial style file of the target page in advance based on the watermark configuration information. The request receiving module is used to receive file request sent by the client, the file request carrying the watermark file requirement information; The watermark file determination module is used to determine the target watermark file from the watermark file library based on the watermark file requirement information; The watermark file sending module is used to send the target watermark file to the client, so that the client can add watermarks to the target elements on the target page based on the target watermark file and the watermark object data in the target style data.
13. The apparatus according to claim 12, characterized in that, The device further includes: The information acquisition module is used to acquire the watermark configuration information and the initial style file of the target page; The file determination module is used to determine the target watermark file from the watermark file library based on the watermark configuration information; The watermark object configuration module is used to configure the watermark object on the target element in the target page in the initial style file based on the watermark configuration information and the target watermark file, so as to obtain the page style file of the target page.
14. The apparatus according to claim 13, characterized in that, The target watermark file includes at least one watermark data, and the watermark object configuration module includes: A watermark data determination unit is used to determine target watermark data from the target watermark file based on the watermark configuration information. An initial watermark object creation unit is used to create an initial watermark object for a target element in the target page in the initial style file based on the target watermark data. A layout information configuration unit is used to obtain the position information of the target element and configure the layout information of the initial watermark object based on the position information. The attribute information configuration unit is used to configure the style attribute information of the initial watermark object based on the watermark configuration information to obtain the page style file of the target page.
15. The apparatus according to claim 14, characterized in that, The attribute information configuration unit includes at least one of the following: A watermark size configuration unit is used to configure watermark size information for the initial watermark object based on the watermark size information in the watermark configuration information. A watermark spacing configuration unit is used to configure watermark spacing information for the initial watermark object based on the watermark spacing information in the watermark configuration information. A watermark transparency configuration unit is used to configure watermark transparency information for the initial watermark object based on the watermark transparency information in the watermark configuration information. A watermark color configuration unit is used to configure watermark color information for the initial watermark object based on the watermark color information in the watermark configuration information. The watermark penetration configuration unit is used to set the penetration attribute of the initial watermark object to be penetrable based on the operation requirement information in the watermark configuration information.
16. The apparatus according to claim 14, characterized in that, The initial watermark object creation unit includes: An identifier extraction unit is used to extract the target watermark identifier from the target watermark data; An object creation unit is used to create an initial watermark object for a target element in the target page based on the target watermark identifier.
17. A non-volatile computer-readable storage medium storing computer program instructions thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 8.
18. A computer program product, characterized in that, Includes computer instructions, which, when executed by a processor, cause the computer to perform the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Video watermark adding method, device and equipment and storage medium
CN110198492A
Method and device for generating watermark in webpage, client and server
CN110276175A