Image protection method, device, apparatus and storage medium

By receiving watermark-free image data on the client side and converting it into bitmap data, and then using a canvas to draw a watermark to generate a watermarked image, the problem of users obtaining images through network packet capture is solved, thus achieving secure protection of image data and resource conservation.

CN122155920APending Publication Date: 2026-06-05BEIJING QIHOOD TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING QIHOOD TECHNOLOGY CO LTD
Filing Date
2024-12-05
Publication Date
2026-06-05

Smart Images

  • Figure CN122155920A_ABST
    Figure CN122155920A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data protection, and discloses an image protection method, device, equipment and storage medium, which comprises the following steps: in response to a picture display request sent by a server, receiving non-watermarked picture data; performing format conversion on the non-watermarked picture data to generate bitmap data; obtaining watermark data, performing image drawing on a canvas based on the watermark data and the bitmap data to generate pixel data of a picture containing the watermark; and rendering the pixel data of the picture containing the watermark into a corresponding picture containing the watermark and displaying the picture. The application can effectively prevent non-watermarked picture data from being acquired through a network packet capture tool, thereby achieving effective protection of image data and effectively improving the security of picture data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data protection technology, and in particular to image protection methods, apparatus, devices and storage media. Background Technology

[0002] AI technology is increasingly used in image processing, such as high-definition image enlargement, intelligent image removal, intelligent background removal, and AI painting. The processed images typically need to be presented to users on web pages. If payment is required upon download, a watermark needs to be added to the image to prevent users from obtaining the original image without paying. Currently, one approach is to add a watermark to the image on the server side, and then the front end directly displays the watermarked image. If the user pays to download, the watermark-free image is retrieved from the server. The problem with this solution is that it requires adding the watermark on the server and storing both watermarked and unwatermarked images separately, wasting server and storage resources. Furthermore, when multiple watermark styles are used, even more images need to be generated and stored. Another approach is for the server to return the base64 data of the watermark-free image, which the front end loads using an Image object, draws onto a canvas, and adds the watermark. The problem with this solution is that users can obtain the image by capturing the base64 data of the loaded image using network packet sniffing tools.

[0003] Therefore, how to effectively prevent watermark-free image data from being obtained through network packet capture tools and improve image data security is an urgent problem that needs to be solved.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of this application is to provide an image protection method, apparatus, device, and storage medium, which aims to solve the technical problem that the image display process requires the triggering of network data loading, allowing users to obtain images through network packet capture tools, resulting in poor image data security.

[0006] To achieve the above objectives, this application proposes an image protection method, the method comprising:

[0007] In response to an image display request sent by the server, receive watermark-free image data;

[0008] The watermark-free image data is converted to a new format to generate bitmap data;

[0009] Obtain watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image;

[0010] The pixel data of the watermarked image is rendered into a corresponding watermarked image and displayed.

[0011] In one embodiment, the step of acquiring watermark data, which involves drawing an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image, includes:

[0012] Obtain watermark data, and determine the target watermark and watermark attributes based on the watermark data;

[0013] Based on the target watermark, the watermark attributes, and the bitmap data, an image is drawn on a canvas to generate pixel data of a watermarked image.

[0014] In one embodiment, the step of generating pixel data of a watermarked image by drawing an image on a canvas based on the target watermark, the watermark attributes, and the bitmap data includes:

[0015] The target watermark and the bitmap data are drawn on a canvas to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0016] Pixel data of the watermarked image is generated based on the watermark attributes, the pixel data of the target watermark, and the pixel data of the watermark-free image.

[0017] In one embodiment, the step of drawing images of the target watermark and the bitmap data on a canvas to obtain pixel data of the target watermark and pixel data of the watermark-free image includes:

[0018] Set the first canvas layer and the second canvas layer;

[0019] Create a first blank canvas and a second blank canvas in the first canvas layer and the second canvas layer, respectively.

[0020] The target watermark is drawn on the first blank canvas to obtain the watermark canvas;

[0021] The bitmap data is drawn on the second blank canvas to obtain a watermark-free image canvas.

[0022] Pixel values ​​are extracted from the watermarked canvas and the watermark-free image canvas respectively to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0023] In one embodiment, generating pixel data of the watermarked image based on the watermark attribute, the pixel data of the target watermark, and the pixel data of the watermark-free image includes:

[0024] The watermark transparency, watermark size, watermark position, and watermark rotation angle are determined based on the watermark attributes.

[0025] The pixel data of the target watermark is adjusted based on the watermark transparency, the watermark size, and the watermark rotation angle to obtain the adjusted pixel data of the target watermark.

[0026] The pixel data of the adjusted target watermark is superimposed on the pixel data of the watermark-free image according to the watermark position to generate the pixel data of the watermarked image.

[0027] In one embodiment, the step of generating pixel data of a watermarked image by drawing an image on a canvas based on the target watermark, the watermark attributes, and the bitmap data further includes:

[0028] Based on the target watermark and the bitmap data, an image is drawn on a canvas to generate mixed pixel data;

[0029] The mixed pixel data is adjusted according to the watermark attributes to generate pixel data of a watermarked image.

[0030] In one embodiment, the step of drawing an image on a canvas based on the target watermark and the bitmap data to generate mixed pixel data includes:

[0031] Set up a canvas layer and create a blank canvas on that canvas layer;

[0032] The bitmap data is drawn on the blank canvas to obtain a watermark-free image area on the canvas.

[0033] The target watermark is drawn on the watermark-free image area of ​​the canvas to obtain a watermarked image canvas.

[0034] Pixel values ​​are extracted from the watermarked image canvas to obtain mixed pixel data.

[0035] In one embodiment, adjusting the mixed pixel data according to the watermark attributes to generate pixel data of the watermarked image includes:

[0036] The watermark transparency, watermark size, watermark position, and watermark rotation angle are determined based on the watermark attributes.

[0037] The RGBA values ​​of each pixel in the mixed pixel data are adjusted according to the watermark transparency to obtain the mixed pixel data with adjusted transparency.

[0038] The watermark pixel data in the mixed pixel data after transparency adjustment is adjusted according to the watermark size, watermark position and watermark rotation angle to obtain the pixel data of the watermarked image.

[0039] In one embodiment, the step of converting the format of the watermark-free image data to generate bitmap data includes:

[0040] The watermark-free image data is converted to a new format to generate an image data object;

[0041] The image data object is format-converted to generate bitmap data.

[0042] In one embodiment, the step of converting the format of the watermark-free image data to generate an image data object includes:

[0043] The watermark-free image data is decrypted to obtain the decrypted watermark-free image data.

[0044] The decrypted watermark-free image data is decoded into a byte stream data;

[0045] The byte stream data is encapsulated into an image data object.

[0046] Furthermore, to achieve the above objectives, this application also proposes an image protection device, which includes:

[0047] The receiving module is used to respond to image display requests sent by the server and receive watermark-free image data;

[0048] The conversion module is used to convert the format of the watermark-free image data to generate bitmap data;

[0049] The drawing module is used to acquire watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image.

[0050] The rendering module is used to render the pixel data of the watermarked image into a corresponding watermarked image and display it.

[0051] In one embodiment, the drawing module is further configured to acquire watermark data and determine the target watermark and watermark attributes based on the watermark data;

[0052] Based on the target watermark, the watermark attributes, and the bitmap data, an image is drawn on a canvas to generate pixel data of a watermarked image.

[0053] In one embodiment, the drawing module is further configured to draw images of the target watermark and the bitmap data on a canvas to obtain pixel data of the target watermark and pixel data of the watermark-free image.

[0054] Pixel data of the watermarked image is generated based on the watermark attributes, the pixel data of the target watermark, and the pixel data of the watermark-free image.

[0055] In one embodiment, the drawing module is further configured to set a first canvas layer and a second canvas layer;

[0056] Create a first blank canvas and a second blank canvas in the first canvas layer and the second canvas layer, respectively.

[0057] The target watermark is drawn on the first blank canvas to obtain the watermark canvas;

[0058] The bitmap data is drawn on the second blank canvas to obtain a watermark-free image canvas.

[0059] Pixel values ​​are extracted from the watermarked canvas and the watermark-free image canvas respectively to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0060] In one embodiment, the drawing module is further configured to determine the watermark transparency, watermark size, watermark position, and watermark rotation angle based on the watermark attributes.

[0061] The pixel data of the target watermark is adjusted based on the watermark transparency, the watermark size, and the watermark rotation angle to obtain the adjusted pixel data of the target watermark.

[0062] The pixel data of the adjusted target watermark is superimposed on the pixel data of the watermark-free image according to the watermark position to generate the pixel data of the watermarked image.

[0063] In one embodiment, the drawing module is further configured to draw an image on a canvas based on the target watermark and the bitmap data, generating mixed pixel data;

[0064] The mixed pixel data is adjusted according to the watermark attributes to generate pixel data of a watermarked image.

[0065] In one embodiment, the drawing module is further configured to set a canvas layer and create a blank canvas on the canvas layer;

[0066] The bitmap data is drawn on the blank canvas to obtain a watermark-free image area on the canvas.

[0067] The target watermark is drawn on the watermark-free image area of ​​the canvas to obtain a watermarked image canvas.

[0068] Pixel values ​​are extracted from the watermarked image canvas to obtain mixed pixel data.

[0069] In one embodiment, the drawing module is further configured to determine the watermark transparency, watermark size, watermark position, and watermark rotation angle based on the watermark attributes.

[0070] The RGBA values ​​of each pixel in the mixed pixel data are adjusted according to the watermark transparency to obtain the mixed pixel data with adjusted transparency.

[0071] The watermark pixel data in the mixed pixel data after transparency adjustment is adjusted according to the watermark size, watermark position and watermark rotation angle to obtain the pixel data of the watermarked image.

[0072] In addition, to achieve the above objectives, this application also proposes an image protection device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the image protection method as described above.

[0073] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the image protection method described above.

[0074] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the image protection method described above.

[0075] This application provides an image protection method. The method involves first responding to an image display request sent by a server by receiving watermark-free image data; converting the format of the watermark-free image data to generate bitmap data; obtaining watermark data; drawing an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image; and rendering the pixel data of the watermarked image into a corresponding watermarked image and displaying it. This method effectively prevents watermark-free image data from being obtained through network packet sniffing tools, thereby achieving effective protection of image data and significantly improving image data security.

[0076] In summary, this application, by receiving watermark-free image data after sending an image display request on the server side, eliminates the need for server-side watermarking, thus reducing server processing load. It then converts the watermark-free image data into bitmap data, facilitating pixel-level manipulation and processing, effectively improving canvas rendering efficiency. Based on the watermark and bitmap data, it generates pixel data for a watermarked image on the canvas, renders it as the corresponding watermarked image, and displays it. This process does not trigger network data loading, preventing users from obtaining the image through network packet capture tools. Even if the image data is obtained, it cannot be restored to its original form due to its pixel-based nature. This effectively protects the image data, overcoming the technical shortcomings of traditional image display methods that require network data loading, allowing users to obtain images through network packet capture tools and resulting in poor image data security. It effectively prevents watermark-free image data from being obtained through network packet capture tools, thus achieving effective image data protection and significantly improving image data security. Attached Figure Description

[0077] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0078] To more clearly illustrate the technical solutions 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, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0079] Figure 1 This is a flowchart illustrating an embodiment of the image protection method of this application.

[0080] Figure 2 A simplified flowchart illustrating an embodiment of the image protection method of this application;

[0081] Figure 3 This is a flowchart illustrating Embodiment 2 of the image protection method of this application;

[0082] Figure 4 This is a schematic diagram of the module structure of the image protection device according to an embodiment of this application;

[0083] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the image protection method of this application embodiment.

[0084] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0085] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0086] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0087] The main solution of this application embodiment is as follows: in response to an image display request sent by the server, receive watermark-free image data; convert the format of the watermark-free image data to generate bitmap data; obtain watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image; render the pixel data of the watermarked image into a corresponding watermarked image and display it.

[0088] AI technology is increasingly used in image processing, such as high-definition image enlargement, intelligent image removal, intelligent background removal, and AI painting. The processed images typically need to be presented to users on web pages. If payment is required upon download, a watermark needs to be added to the image to prevent users from obtaining the original image without paying. Currently, one approach is to add a watermark to the image on the server side, and then the front end directly displays the watermarked image. If the user pays to download, the watermark-free image is retrieved from the server. The problem with this solution is that it requires adding the watermark on the server and storing both watermarked and unwatermarked images separately, wasting server and storage resources. Furthermore, when multiple watermark styles are used, even more images need to be generated and stored. Another approach is for the server to return the base64 data of the watermark-free image, which the front end loads using an Image object, draws onto a canvas, and adds the watermark. The problem with this solution is that users can obtain the image by capturing the base64 data of the loaded image using network packet sniffing tools. Therefore, how to effectively prevent watermark-free image data from being obtained through network packet capture tools and improve image data security is an urgent problem that needs to be solved.

[0089] This application receives watermark-free image data after the server sends an image display request. This eliminates the need for server-side watermarking, reducing server processing load. The watermark-free image data is then converted into bitmap data for pixel-level manipulation and processing, significantly improving canvas rendering efficiency. Based on the watermark and bitmap data, pixel data for a watermarked image is generated on the canvas, rendered, and displayed. This process avoids network data loading, preventing users from obtaining the image via network packet sniffing tools. Even if image data is obtained, it cannot be reconstructed from the original image due to its pixel-level nature. This effectively protects image data and overcomes the technical flaw of requiring network data loading during image display, which allows users to obtain images via network packet sniffing tools, leading to poor image data security. It effectively prevents watermark-free image data from being obtained through network packet sniffing tools, thus achieving effective image data protection and significantly improving image data security.

[0090] Based on this, embodiments of this application provide an image protection method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the image protection method of this application.

[0091] In this embodiment, the image protection method includes steps S10 to S40:

[0092] Step S10: In response to the image display request sent by the server, receive watermark-free image data.

[0093] It should be noted that the execution subject in this embodiment is the client. A client is a device that can perform image processing and display, such as a personal computer, smartphone, or tablet computer. This embodiment does not impose any specific limitations on it.

[0094] As you can understand, an image display request refers to a request sent by the server to the client requesting that a specific image with a watermark be displayed on the webpage. After receiving this request, the client will receive the watermark-free image data transmitted by the server.

[0095] Specifically, after receiving the image display request sent by the server, the client communicates with the server through the network interface and receives the watermark-free image data transmitted by the server. This data can be the original file format of the image, such as JPEG or PNG, or it can be a compressed format, such as a base64 encoded string. In this embodiment, the watermark-free image data is a compressed format, which is a base64 encoded string, that is, a string composed of 64 characters representing an image.

[0096] It's worth noting that before transmitting the watermark-free image data to the client, the server compresses the original image data, converting the binary image data into a base64 encoded string to reduce the amount of data transmitted and improve efficiency. Furthermore, to prevent users from directly accessing the base64 encoded string sent by the server, the base64 encoded string is encrypted before being transmitted to the client—this is the watermark-free image data.

[0097] Step S20: Convert the format of the watermark-free image data to generate bitmap data.

[0098] It's important to note that bitmap data, or image data in bitmap format, is image data composed of a matrix of pixels, with each pixel containing color information. Format conversion involves decoding the received base64 encoded string and converting it into bitmap data, facilitating pixel-level operations and processing, and effectively improving drawing efficiency on the canvas.

[0099] It is understandable that decoding the received base64 encoded string and converting it into bitmap data usually involves a decoding algorithm to restore the encoded string to the original binary image data, and then parsing the color value of each pixel according to the image format (such as RGB, RGBA, etc.) to finally form bitmap data. This embodiment does not impose specific limitations on this.

[0100] In one feasible implementation, step S20 may include: converting the format of the watermark-free image data to generate an image data object; and converting the format of the image data object to generate bitmap data.

[0101] It's important to note that an image data object, also known as a blob object, is a JavaScript object used in browsers to represent binary data. In this embodiment, the image data object is an object containing raw binary image data. Converting the base64-encoded string into an object containing raw binary image data facilitates further processing and manipulation on the client side. For example, the FileReader API in JavaScript can be used to read the image data object and convert it into bitmap data.

[0102] Understandably, blob objects are more efficient at processing binary data. Converting a base64 encoded string into an object containing the original binary image data, i.e., a blob object, can effectively improve data processing efficiency. Furthermore, converting the blob object into bitmap format data, i.e. bitmap data, can improve image rendering performance and reduce latency when drawing on the canvas.

[0103] In one feasible implementation, the step of converting the format of the watermark-free image data to generate an image data object includes: decrypting the watermark-free image data to obtain decrypted watermark-free image data; decoding the decrypted watermark-free image data into byte stream data; and encapsulating the byte stream data into an image data object.

[0104] It should be noted that, to prevent users from directly accessing the base64 data of images transmitted from the server, the watermark-free image data transmitted by the server is encrypted. Therefore, before converting the format of the watermark-free image data, a decryption operation is required. The decryption process restores the encrypted base64 encoded string to the unencrypted base64 encoded string, which is the decrypted watermark-free image data.

[0105] Understandably, the unencrypted base64 encoded string is converted into byte stream data using a decoding algorithm. This byte stream data is image data in binary form, which can be recognized and processed by browsers or client software. Encapsulating the byte stream data into an image data object allows for further image processing on the client side, such as resizing, cropping, or adding watermarks.

[0106] It is worth noting that in this embodiment, the creation and processing of image data objects can be implemented through JavaScript programming, utilizing the browser's API to convert base64 encoded strings into image data objects. This process not only ensures data security but also improves the flexibility and efficiency of image processing.

[0107] Step S30: Obtain watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of the watermarked image.

[0108] It should be noted that a watermark is a graphic or textual information used to identify or protect the copyright of a digital image. In this embodiment, the watermark data may include a target watermark and watermark attributes. The target watermark refers to the watermark image or text that needs to be embedded in the image, while the watermark attributes include parameters such as the watermark's position, transparency, and size. This embodiment does not impose specific limitations on these parameters.

[0109] Understandably, image drawing is performed on a canvas, specifically the HTML5 Canvas element. The Canvas's drawing APIs are used to combine watermark data with bitmap data, generating image pixel data containing the watermark. The key to this step is ensuring that the watermark embedding does not affect the quality of the original image, while also guaranteeing the watermark's visibility and resistance to tampering.

[0110] It's worth noting that once an image is drawn onto a Canvas, the original image cannot be retrieved by copying and pasting or saving it from a webpage. If you attempt to read the Canvas content using JavaScript (e.g., using toDataURL), browser security policies will block this behavior, especially when cross-domain resources are involved. Furthermore, because the data in the Canvas is stored as pixel groups, even if a user obtains the Canvas content, they cannot easily reconstruct the original bitmap data, effectively protecting the security of image data and preventing unauthorized access and use.

[0111] Step S40: Render the pixel data of the watermarked image into a corresponding watermarked image and display it.

[0112] It should be noted that the rendering process involves converting pixel data into image file formats, such as JPEG or PNG, for display on the user interface. This can be achieved using the graphics rendering engine of a browser or client software, which converts pixel data into a visual image and displays it on a webpage.

[0113] Understandably, during the rendering process, the image's display size and quality can be adjusted as needed to adapt to different display devices and network conditions. Furthermore, the rendering process may include image compression to reduce file size, speed up network transmission, and maintain acceptable image quality. Ultimately, displaying the watermarked image on the webpage effectively protects the user from directly accessing the original image, significantly improving image data security.

[0114] like Figure 2 As shown, Figure 2 This is a simplified flowchart for image display. It receives encrypted, watermark-free image base64 data from the server, decrypts it, converts the base64 image data into a blob object, then converts the blob object into bitmap data, and finally uses Canvas to display the webpage image based on the watermark data and bitmap data.

[0115] This embodiment provides an image protection method. In response to an image display request sent by a server, the method receives watermark-free image data; converts the format of the watermark-free image data to generate bitmap data; acquires watermark data; and, based on the watermark data and the bitmap data, performs image drawing on a canvas to generate pixel data of a watermarked image; finally, renders the pixel data of the watermarked image into a corresponding watermarked image and displays it. This method effectively prevents watermark-free image data from being obtained through network packet capture tools, thereby achieving effective protection of image data and significantly improving image data security.

[0116] In summary, this embodiment, by receiving watermark-free image data after the server sends an image display request, eliminates the need for server-side watermarking, thus reducing server processing load. The watermark-free image data is then converted into bitmap data for pixel-level manipulation and processing, effectively improving canvas rendering efficiency. Based on the watermark and bitmap data, pixel data for a watermarked image is generated on the canvas, rendered, and displayed. This process avoids triggering network data loading, preventing users from obtaining the image via network packet capture tools. Even if image data is obtained, it cannot be reconstructed from the original image due to its pixel-level nature. This effectively protects the image data, overcoming the technical shortcomings of traditional image display methods that require network data loading, allowing users to obtain images via network packet capture tools and resulting in poor image data security. This embodiment effectively prevents watermark-free image data from being obtained through network packet capture tools, thus achieving effective image data protection and significantly improving image data security.

[0117] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 Step S30 further includes steps S301-S302:

[0118] Step S301: Obtain watermark data and determine the target watermark and watermark attributes based on the watermark data.

[0119] It should be noted that watermark data can be obtained in various ways, such as reading pre-defined watermark information from a database or dynamically generating watermarks based on user requests. The target watermark refers to a pre-defined pattern, text, or a combination of both, and can also be dynamically generated to adapt to different application scenarios and needs. Watermark attributes include the watermark's size, transparency, and position, which can be adjusted according to actual needs to achieve the best protection effect and user experience.

[0120] Step S302: Based on the target watermark, the watermark attributes, and the bitmap data, an image is drawn on a canvas to generate pixel data of the watermarked image.

[0121] It should be noted that when drawing images of the target watermark and bitmap data on the canvas, they can be drawn separately and then superimposed, or the target watermark can be directly embedded into the bitmap data. This embodiment does not impose any specific restrictions on this.

[0122] Understandably, the entire process of adding a watermark is completed on the client side without the need for server-side involvement, which further reduces the server's burden. Furthermore, since the watermark is directly embedded in the pixel data, it cannot be easily removed even after the image is downloaded, ensuring the security of the image data.

[0123] In one possible implementation, step S302 may include steps A10-A11:

[0124] Step A10: Draw images of the target watermark and the bitmap data on a canvas to obtain pixel data of the target watermark and pixel data of the watermark-free image.

[0125] Step A11: Generate pixel data of the watermarked image based on the watermark attributes, the pixel data of the target watermark, and the pixel data of the watermark-free image.

[0126] It should be noted that in this embodiment, the Canvas is used to draw the pattern of the target watermark and the corresponding watermark-free image of the bitmap data, and then the pixel information is extracted to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0127] It is understandable that when generating pixel data for a watermarked image, the pixel data of the target watermark is adjusted according to the watermark attributes, and then mixed with the corresponding pixel data of the watermark-free image according to a certain algorithm to ensure the visibility of the watermark, thus obtaining the pixel data of the watermarked image.

[0128] It is worth noting that by drawing images of the target watermark and bitmap data separately, and then overlaying the pixel data, the efficiency of watermark addition can be effectively improved.

[0129] In one feasible implementation, step A10 specifically includes: setting a first canvas layer and a second canvas layer; creating a first blank canvas and a second blank canvas on the first canvas layer and the second canvas layer respectively; drawing the target watermark on the first blank canvas to obtain a watermarked canvas; drawing the bitmap data on the second blank canvas to obtain a watermark-free image canvas; and extracting the pixel values ​​from the watermarked canvas and the watermark-free image canvas to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0130] It should be noted that a canvas layer refers to a virtual layer used to hold image drawing in a graphical user interface. By setting different canvas layers, layered management and manipulation of images can be achieved, thereby improving the flexibility and efficiency of image processing. In this embodiment, the setting of the first canvas layer and the second canvas layer allows the drawing of the target watermark and bitmap data to be performed independently without affecting each other. This design not only simplifies the image processing workflow but also enhances the controllability of the final watermarked image. When extracting pixel values, the pixel data of the target watermarked and watermark-free images can be accurately obtained.

[0131] As is understood, a blank canvas refers to a canvas in the graphical user interface that has not yet been used for any image drawing. In this implementation, by creating a blank canvas, it is ensured that the drawing of the target watermark and bitmap data will not be interfered with by other image elements, thereby guaranteeing the purity and accuracy of the pixel data.

[0132] It's worth noting that drawing the image on both the first and second blank canvases effectively isolates the target watermark and bitmap data, ensuring the clarity of the watermark and the integrity of the bitmap when generating a watermarked image. Furthermore, extracting pixel data from both canvases separately significantly improves the accuracy of the pixel data.

[0133] In one feasible implementation, step A11 specifically includes: determining the watermark transparency, watermark size, watermark position, and watermark rotation angle based on the watermark attributes; adjusting the pixel data of the target watermark based on the watermark transparency, watermark size, and watermark rotation angle to obtain the adjusted pixel data of the target watermark; and superimposing the adjusted pixel data of the target watermark with the pixel data of the watermark-free image based on the watermark position to generate the pixel data of the watermarked image.

[0134] It should be noted that in this embodiment, the watermark attributes include watermark transparency, watermark size, watermark position, and watermark rotation angle. Watermark transparency refers to the degree of transparency of the watermark, watermark size refers to the size of the watermark, watermark position refers to the specific location of the watermark in the image, and watermark rotation angle refers to the degree of rotation of the watermark relative to its original position. Through precise control of these attributes, the watermark can be finely adjusted to achieve optimal visual effects and concealment.

[0135] Understandably, adjusting the pixel values ​​in the target watermark's pixel data based on its transparency, size, and rotation angle ensures the watermark is visually prominent without excessively interfering with the original image content. When the adjusted target watermark pixel data is overlaid with the pixel data of the watermark-free image, a pixel value fusion algorithm needs to be considered to ensure the watermark blends naturally and visually harmonizes, thereby generating the pixel data of the watermarked image. Determining the watermark's position ensures a reasonable layout within the image, preventing it from obscuring important information while maintaining its visibility.

[0136] In the specific implementation, a transparency adjustment formula is applied to each pixel in the target watermark's pixel data based on the watermark's transparency to reduce or increase pixel transparency, thereby controlling the watermark's visibility. The target watermark's pixel data is adjusted according to its size, potentially including scaling algorithms, to ensure the watermark maintains a consistent visual effect across images of different sizes. For adjusting the watermark's rotation angle, a rotation algorithm is applied to ensure the watermark retains its original clarity and aesthetics after rotation. During the overlay process, pixel fusion is performed using a weighted average to achieve a natural blend between the watermark and the background image.

[0137] In one possible implementation, step S302 may further include steps B10-B11:

[0138] Step B10: Based on the target watermark and the bitmap data, an image is drawn on a canvas to generate mixed pixel data.

[0139] Step B11: Adjust the mixed pixel data according to the watermark attributes to generate pixel data of the watermarked image.

[0140] It should be noted that in this embodiment, the target watermark is directly embedded into the bitmap data during the drawing process on the canvas, and then pixel information is extracted to obtain the mixed pixel data. When generating the pixel data of the watermarked image, the mixed pixel data is directly adjusted according to the watermark attributes, and the adjusted mixed pixel data is the pixel data of the watermarked image.

[0141] It is understandable that by directly embedding the target watermark into the bitmap data during the drawing process on the canvas, and then adjusting the pixel values ​​in the mixed pixel data according to the watermark attributes, the effect of watermark addition can be effectively improved.

[0142] In one feasible implementation, step B10 specifically includes: setting a canvas layer and creating a blank canvas on the canvas layer; drawing an image on the bitmap data on the blank canvas to obtain a watermark-free image area on the canvas; drawing an image on the target watermark on the watermark-free image area on the canvas to obtain a watermarked image canvas; and extracting pixel values ​​from the watermarked image canvas to obtain mixed pixel data.

[0143] It should be noted that, in this embodiment, drawing the target watermark and bitmap data on the same canvas can ensure precise alignment between the watermark and the bitmap data, avoiding positional deviations that may occur due to layered drawing.

[0144] The process involves first drawing bitmap data on a blank canvas, creating a watermark-free image corresponding to the bitmap data, then locating the area of ​​the watermark-free image on the canvas, and finally drawing the target watermark on that area, ensuring precise alignment between the watermark and the bitmap data. This effectively avoids visual misalignment or blurring of the watermark, thus improving the quality of the final watermarked image. Furthermore, since the mixed pixel data is generated on the same canvas, the accuracy and consistency of the extracted pixel values ​​are ensured, and the extracted mixed pixel data accurately reflects the combined effect of the watermark and bitmap data.

[0145] In one feasible implementation, step B11 specifically includes: determining the watermark transparency, watermark size, watermark position, and watermark rotation angle according to the watermark attributes; adjusting the RGBA value of each pixel in the mixed pixel data according to the watermark transparency to obtain the mixed pixel data with adjusted transparency; and adjusting the watermark pixel data in the mixed pixel data with adjusted transparency according to the watermark size, watermark position, and watermark rotation angle to obtain the pixel data of the watermarked image.

[0146] It should be noted that, in this embodiment, the watermark attributes also include watermark transparency, watermark size, watermark position, and watermark rotation angle.

[0147] As you can understand, RGBA values ​​refer to the values ​​of the four channels: red, green, blue, and alpha (transparency). These values ​​collectively define the color and transparency of each pixel in an image. When adjusting the blended pixel data, the transparency of the watermark can be controlled by changing the alpha channel within the RGBA values, ensuring that the watermark is visually visible without excessively interfering with the original image content.

[0148] It's worth noting that adjusting the size and position of the watermark's pixel data ensures a consistent visual effect across images of different sizes, and that the watermark occupies an appropriate position within the image, neither obscuring important information nor compromising its visibility. For the watermark's rotation angle, a rotation algorithm ensures that the watermark retains its original clarity and aesthetics after rotation. Ultimately, through these adjustments, the pixel data of the generated watermarked image ensures the watermark blends naturally and achieves visual harmony.

[0149] In this embodiment, the image is drawn on a canvas based on the target watermark and bitmap data, making it impossible to obtain the original image by copying and pasting or saving the image from the webpage. Then, the pixel data is adjusted according to the watermark attributes to generate pixel data of the watermarked image, making it impossible for users to easily restore the original bitmap data. This effectively protects the security of the image data. Since the watermark addition process is completed on the client side without the need for server-side involvement, the server load is further reduced.

[0150] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the image protection method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0151] This application also provides an image protection device, please refer to... Figure 4 The image protection device includes:

[0152] The receiving module 10 is used to respond to the image display request sent by the server and receive watermark-free image data.

[0153] The conversion module 20 is used to convert the format of the watermark-free image data to generate bitmap data.

[0154] The drawing module 30 is used to acquire watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of the watermarked image.

[0155] The rendering module 40 is used to render the pixel data of the watermarked image into a corresponding watermarked image and display it.

[0156] This embodiment provides an image protection device. In response to an image display request sent by a server, this embodiment receives watermark-free image data; converts the format of the watermark-free image data to generate bitmap data; obtains watermark data; and, based on the watermark data and the bitmap data, performs image drawing on a canvas to generate pixel data of a watermarked image; and renders the pixel data of the watermarked image into a corresponding watermarked image and displays it. This effectively prevents watermark-free image data from being obtained through network packet sniffing tools, thereby achieving effective protection of image data and significantly improving image data security.

[0157] In summary, this embodiment, by receiving watermark-free image data after the server sends an image display request, eliminates the need for server-side watermarking, thus reducing server processing load. The watermark-free image data is then converted into bitmap data for pixel-level manipulation and processing, effectively improving canvas rendering efficiency. Based on the watermark and bitmap data, pixel data for a watermarked image is generated on the canvas, rendered, and displayed. This process avoids triggering network data loading, preventing users from obtaining the image via network packet capture tools. Even if image data is obtained, it cannot be reconstructed from the original image due to its pixel-level nature. This effectively protects the image data, overcoming the technical shortcomings of traditional image display methods that require network data loading, allowing users to obtain images via network packet capture tools and resulting in poor image data security. This embodiment effectively prevents watermark-free image data from being obtained through network packet capture tools, thus achieving effective image data protection and significantly improving image data security.

[0158] Optionally, the drawing module 30 is further configured to acquire watermark data, and determine a target watermark and watermark attributes based on the watermark data; and draw an image on a canvas based on the target watermark, the watermark attributes, and the bitmap data to generate pixel data of a watermarked image.

[0159] Optionally, the drawing module 30 is further configured to draw images of the target watermark and the bitmap data on a canvas to obtain pixel data of the target watermark and pixel data of the watermark-free image; and generate pixel data of the watermarked image based on the watermark attributes, the pixel data of the target watermark, and the pixel data of the watermark-free image.

[0160] Optionally, the drawing module 30 is further configured to create a first blank canvas and a second blank canvas on the first canvas layer and the second canvas layer, respectively; draw the target watermark on the first blank canvas to obtain a watermarked canvas; draw the bitmap data on the second blank canvas to obtain a watermark-free image canvas; and extract the pixel values ​​from the watermarked canvas and the watermark-free image canvas to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0161] Optionally, the drawing module 30 is further configured to determine the watermark transparency, watermark size, watermark position, and watermark rotation angle according to the watermark attributes; adjust the pixel data of the target watermark based on the watermark transparency, watermark size, and watermark rotation angle to obtain the adjusted pixel data of the target watermark; and superimpose the adjusted pixel data of the target watermark with the pixel data of the watermark-free image according to the watermark position to generate the pixel data of the watermarked image.

[0162] Optionally, the drawing module 30 is further configured to draw an image on a canvas based on the target watermark and the bitmap data to generate mixed pixel data; and adjust the mixed pixel data according to the watermark attributes to generate pixel data of a watermarked image.

[0163] Optionally, the drawing module 30 is further configured to set a canvas layer and create a blank canvas on the canvas layer; draw an image on the bitmap data on the blank canvas to obtain a watermark-free image area on the canvas; draw an image on the target watermark on the watermark-free image area on the canvas to obtain a watermarked image canvas; and extract pixel values ​​from the watermarked image canvas to obtain mixed pixel data.

[0164] Optionally, the drawing module 30 is further configured to determine the watermark transparency, watermark size, watermark position, and watermark rotation angle according to the watermark attributes; adjust the RGBA value of each pixel in the mixed pixel data according to the watermark transparency to obtain the mixed pixel data with adjusted transparency; and adjust the watermark pixel data in the mixed pixel data with adjusted transparency according to the watermark size, watermark position, and watermark rotation angle to obtain the pixel data of the watermarked image.

[0165] Optionally, the conversion module 20 is further configured to convert the format of the watermark-free image data to generate an image data object; and to convert the format of the image data object to generate bitmap data.

[0166] Optionally, the conversion module 20 is further configured to decrypt the watermark-free image data to obtain decrypted watermark-free image data; decode the decrypted watermark-free image data into byte stream data; and encapsulate the byte stream data into an image data object.

[0167] The image protection device provided in this application, employing the image protection method described in the above embodiments, can solve the technical problem that the image display process requires triggering network data loading, allowing users to obtain images through network packet capture tools, resulting in poor image data security. Compared with the prior art, the beneficial effects of the image protection device provided in this application are the same as those of the image protection method provided in the above embodiments, and other technical features in the image protection device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0168] This application provides an image protection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the image protection method in Embodiment 1 above.

[0169] The following is for reference. Figure 5 The diagram illustrates a structural schematic of an image protection device suitable for implementing embodiments of this application. The image protection device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The image protection device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0170] like Figure 5As shown, the image protection device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the image protection device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the image protection device to communicate wirelessly or wiredly with other devices to exchange data. Although image protection devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0171] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0172] The image protection device provided in this application, employing the image protection method described in the above embodiments, can solve the technical problem that the image display process requires triggering network data loading, allowing users to obtain images through network packet capture tools, resulting in poor image data security. Compared with the prior art, the beneficial effects of the image protection device provided in this application are the same as those of the image protection method provided in the above embodiments, and other technical features of this image protection device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0173] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0174] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0175] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the image protection method described in the above embodiments.

[0176] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0177] The aforementioned computer-readable storage medium may be included in the image protection device; or it may exist independently and not be assembled into the image protection device.

[0178] The aforementioned computer-readable storage medium carries one or more programs. When the image protection device executes the aforementioned one or more programs, the image protection device causes the image protection device to: receive watermark-free image data in response to an image display request sent by the server; perform format conversion on the watermark-free image data to generate bitmap data; acquire watermark data; draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image; and render the pixel data of the watermarked image into a corresponding watermarked image and display it.

[0179] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0180] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0181] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0182] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described image protection method. This solves the technical problem that image display requires triggering network data loading, allowing users to obtain images through network packet capture tools, resulting in poor image data security. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the image protection method provided in the above embodiments, and will not be repeated here.

[0183] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the image protection method described above.

[0184] The computer program product provided in this application can solve the technical problem that the process of displaying images requires triggering network data loading, which allows users to obtain images through network packet capture tools, resulting in poor image data security. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the image protection method provided in the above embodiments, and will not be repeated here.

[0185] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

[0186] This invention discloses A1. An image protection method, the method comprising:

[0187] In response to an image display request sent by the server, receive watermark-free image data;

[0188] The watermark-free image data is converted to a new format to generate bitmap data;

[0189] Obtain watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image;

[0190] The pixel data of the watermarked image is rendered into a corresponding watermarked image and displayed.

[0191] A2. The method as described in A1, wherein obtaining watermark data, and drawing an image on a canvas based on the watermark data and the bitmap data to generate pixel data of the watermarked image, includes:

[0192] Obtain watermark data, and determine the target watermark and watermark attributes based on the watermark data;

[0193] Based on the target watermark, the watermark attributes, and the bitmap data, an image is drawn on a canvas to generate pixel data of a watermarked image.

[0194] A3. The method as described in A2, wherein the step of generating pixel data of the watermarked image by drawing an image on a canvas based on the target watermark, the watermark attributes, and the bitmap data includes:

[0195] The target watermark and the bitmap data are drawn on a canvas to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0196] Pixel data of the watermarked image is generated based on the watermark attributes, the pixel data of the target watermark, and the pixel data of the watermark-free image.

[0197] A4. The method as described in A3, wherein the step of drawing images of the target watermark and the bitmap data on a canvas to obtain pixel data of the target watermark and pixel data of the watermark-free image includes:

[0198] Set the first canvas layer and the second canvas layer;

[0199] Create a first blank canvas and a second blank canvas in the first canvas layer and the second canvas layer, respectively.

[0200] The target watermark is drawn on the first blank canvas to obtain the watermark canvas;

[0201] The bitmap data is drawn on the second blank canvas to obtain a watermark-free image canvas.

[0202] Pixel values ​​are extracted from the watermarked canvas and the watermark-free image canvas respectively to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0203] A5. The method as described in A3, wherein generating pixel data of the watermarked image based on the watermark attribute, the pixel data of the target watermark, and the pixel data of the watermark-free image includes:

[0204] The watermark transparency, watermark size, watermark position, and watermark rotation angle are determined based on the watermark attributes.

[0205] The pixel data of the target watermark is adjusted based on the watermark transparency, the watermark size, and the watermark rotation angle to obtain the adjusted pixel data of the target watermark.

[0206] The pixel data of the adjusted target watermark is superimposed on the pixel data of the watermark-free image according to the watermark position to generate the pixel data of the watermarked image.

[0207] A6. The method as described in A2, wherein the step of generating pixel data of a watermarked image by drawing an image on a canvas based on the target watermark, the watermark attributes, and the bitmap data, further includes:

[0208] Based on the target watermark and the bitmap data, an image is drawn on a canvas to generate mixed pixel data;

[0209] The mixed pixel data is adjusted according to the watermark attributes to generate pixel data of a watermarked image.

[0210] A7. The method as described in A6, wherein the step of drawing an image on a canvas based on the target watermark and the bitmap data to generate mixed pixel data includes:

[0211] Set up a canvas layer and create a blank canvas on that canvas layer;

[0212] The bitmap data is drawn on the blank canvas to obtain a watermark-free image area on the canvas.

[0213] The target watermark is drawn on the watermark-free image area of ​​the canvas to obtain a watermarked image canvas.

[0214] Pixel values ​​are extracted from the watermarked image canvas to obtain mixed pixel data.

[0215] A8. The method as described in A6, wherein adjusting the mixed pixel data according to the watermark attribute to generate pixel data of the watermarked image includes:

[0216] The watermark transparency, watermark size, watermark position, and watermark rotation angle are determined based on the watermark attributes.

[0217] The RGBA values ​​of each pixel in the mixed pixel data are adjusted according to the watermark transparency to obtain the mixed pixel data with adjusted transparency.

[0218] The watermark pixel data in the mixed pixel data after transparency adjustment is adjusted according to the watermark size, watermark position and watermark rotation angle to obtain the pixel data of the watermarked image.

[0219] A9. The method as described in A1, wherein the format conversion of the watermark-free image data to generate bitmap data includes:

[0220] The watermark-free image data is converted to a new format to generate an image data object;

[0221] The image data object is format-converted to generate bitmap data.

[0222] A10. The method described in A9, wherein the format conversion of the watermark-free image data to generate an image data object includes:

[0223] The watermark-free image data is decrypted to obtain the decrypted watermark-free image data.

[0224] The decrypted watermark-free image data is decoded into a byte stream data;

[0225] The byte stream data is encapsulated into an image data object.

[0226] The present invention also discloses B11. An image protection device, the image protection device comprising:

[0227] The receiving module is used to respond to image display requests sent by the server and receive watermark-free image data;

[0228] The conversion module is used to convert the format of the watermark-free image data to generate bitmap data;

[0229] The drawing module is used to acquire watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image.

[0230] The rendering module is used to render the pixel data of the watermarked image into a corresponding watermarked image and display it.

[0231] B12. The apparatus as described in B11, wherein the drawing module is further configured to acquire watermark data and determine a target watermark and watermark attributes based on the watermark data;

[0232] Based on the target watermark, the watermark attributes, and the bitmap data, an image is drawn on a canvas to generate pixel data of a watermarked image.

[0233] B13. The apparatus as described in B12, wherein the drawing module is further configured to draw an image of the target watermark and the bitmap data on a canvas to obtain pixel data of the target watermark and pixel data of the watermark-free image;

[0234] Pixel data of the watermarked image is generated based on the watermark attributes, the pixel data of the target watermark, and the pixel data of the watermark-free image.

[0235] B14. The apparatus as described in B13, wherein the drawing module is further configured to set a first canvas layer and a second canvas layer;

[0236] Create a first blank canvas and a second blank canvas in the first canvas layer and the second canvas layer, respectively.

[0237] The target watermark is drawn on the first blank canvas to obtain the watermark canvas;

[0238] The bitmap data is drawn on the second blank canvas to obtain a watermark-free image canvas.

[0239] Pixel values ​​are extracted from the watermarked canvas and the watermark-free image canvas respectively to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

[0240] B15. The apparatus as described in B13, wherein the drawing module is further configured to determine the watermark transparency, watermark size, watermark position, and watermark rotation angle based on the watermark attributes.

[0241] The pixel data of the target watermark is adjusted based on the watermark transparency, the watermark size, and the watermark rotation angle to obtain the adjusted pixel data of the target watermark.

[0242] The pixel data of the adjusted target watermark is superimposed on the pixel data of the watermark-free image according to the watermark position to generate the pixel data of the watermarked image.

[0243] B16. The apparatus as described in B12, wherein the drawing module is further configured to draw an image on a canvas based on the target watermark and the bitmap data, generating mixed pixel data;

[0244] The mixed pixel data is adjusted according to the watermark attributes to generate pixel data of a watermarked image.

[0245] B17. The apparatus as described in B16, wherein the drawing module is further configured to set a canvas layer and create a blank canvas on the canvas layer;

[0246] The bitmap data is drawn on the blank canvas to obtain a watermark-free image area on the canvas.

[0247] The target watermark is drawn on the watermark-free image area of ​​the canvas to obtain a watermarked image canvas.

[0248] Pixel values ​​are extracted from the watermarked image canvas to obtain mixed pixel data.

[0249] B18. The apparatus as described in B16, wherein the drawing module is further configured to determine the watermark transparency, watermark size, watermark position, and watermark rotation angle based on the watermark attributes.

[0250] The RGBA values ​​of each pixel in the mixed pixel data are adjusted according to the watermark transparency to obtain the mixed pixel data with adjusted transparency.

[0251] The watermark pixel data in the mixed pixel data after transparency adjustment is adjusted according to the watermark size, watermark position and watermark rotation angle to obtain the pixel data of the watermarked image.

[0252] The present invention also discloses 19. an image protection device, the image protection device comprising: a memory, a processor, and an image protection program stored in the memory and executable on the processor, the image protection program being configured to implement the image protection method as described above.

[0253] The present invention also discloses a storage medium storing an image protection program, wherein the image protection program, when executed by a processor, implements the image protection method as described above.

Claims

1. An image protection method, characterized in that, The method includes: In response to an image display request sent by the server, receive watermark-free image data; The watermark-free image data is converted to a new format to generate bitmap data; Obtain watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image; The pixel data of the watermarked image is rendered into a corresponding watermarked image and displayed.

2. The method as described in claim 1, characterized in that, The step of acquiring watermark data involves drawing an image on a canvas based on the watermark data and the bitmap data to generate pixel data of the watermarked image, including: Obtain watermark data, and determine the target watermark and watermark attributes based on the watermark data; Based on the target watermark, the watermark attributes, and the bitmap data, an image is drawn on a canvas to generate pixel data of a watermarked image.

3. The method as described in claim 2, characterized in that, The step of drawing an image on a canvas based on the target watermark, the watermark attributes, and the bitmap data to generate pixel data of the watermarked image includes: The target watermark and the bitmap data are drawn on a canvas to obtain the pixel data of the target watermark and the pixel data of the watermark-free image. Pixel data of the watermarked image is generated based on the watermark attributes, the pixel data of the target watermark, and the pixel data of the watermark-free image.

4. The method as described in claim 3, characterized in that, The step of drawing images of the target watermark and the bitmap data on a canvas to obtain pixel data of the target watermark and pixel data of the watermark-free image includes: Set the first canvas layer and the second canvas layer; Create a first blank canvas and a second blank canvas in the first canvas layer and the second canvas layer, respectively. The target watermark is drawn on the first blank canvas to obtain the watermark canvas; The bitmap data is drawn on the second blank canvas to obtain a watermark-free image canvas. Pixel values ​​are extracted from the watermarked canvas and the watermark-free image canvas respectively to obtain the pixel data of the target watermark and the pixel data of the watermark-free image.

5. The method as described in claim 3, characterized in that, The step of generating pixel data for a watermarked image based on the watermark attributes, the pixel data of the target watermark, and the pixel data of the watermark-free image includes: The watermark transparency, watermark size, watermark position, and watermark rotation angle are determined based on the watermark attributes. The pixel data of the target watermark is adjusted based on the watermark transparency, the watermark size, and the watermark rotation angle to obtain the adjusted pixel data of the target watermark. The pixel data of the adjusted target watermark is superimposed on the pixel data of the watermark-free image according to the watermark position to generate the pixel data of the watermarked image.

6. The method as described in claim 2, characterized in that, The step of generating pixel data for a watermarked image by drawing an image on a canvas based on the target watermark, the watermark attributes, and the bitmap data further includes: Based on the target watermark and the bitmap data, an image is drawn on a canvas to generate mixed pixel data; The mixed pixel data is adjusted according to the watermark attributes to generate pixel data of a watermarked image.

7. The method as described in claim 6, characterized in that, The step of drawing an image on a canvas based on the target watermark and the bitmap data to generate mixed pixel data includes: Set up a canvas layer and create a blank canvas on that canvas layer; The bitmap data is drawn on the blank canvas to obtain a watermark-free image area on the canvas. The target watermark is drawn on the watermark-free image area of ​​the canvas to obtain a watermarked image canvas. Pixel values ​​are extracted from the watermarked image canvas to obtain mixed pixel data.

8. An image protection device, characterized in that, The image protection device includes: The receiving module is used to respond to image display requests sent by the server and receive watermark-free image data; The conversion module is used to convert the format of the watermark-free image data to generate bitmap data; The drawing module is used to acquire watermark data, and draw an image on a canvas based on the watermark data and the bitmap data to generate pixel data of a watermarked image. The rendering module is used to render the pixel data of the watermarked image into a corresponding watermarked image and display it.

9. An image protection device, characterized in that, The image protection device includes: a memory, a processor, and an image protection program stored in the memory and executable on the processor, the image protection program being configured to implement the image protection method as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores an image protection program, which, when executed by a processor, implements the image protection method as described in any one of claims 1 to 7.