A method and system for adding watermarks

By calculating and adjusting the offset of the text watermark to center it after rotation, the problem of inaccurate displacement of text watermarks after rotation in existing technologies is solved, and a multi-line text watermark effect with high storage efficiency is achieved.

CN115375526BActive Publication Date: 2026-02-24SHENZHEN SEKORM COMPONENT NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210907155.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-29
Publication Date
2026-02-24
Estimated Expiration
2042-07-29

AI Technical Summary

Technical Problem

In existing technologies, after rotating a multi-line text watermark, each line of watermark is displaced in the horizontal and vertical directions, resulting in inaccurate overall centering and rotation of the text watermark.

Method used

By loading at least two lines of parallel text watermarks, rotating each line of watermarks by the same angle around its own center point, calculating and adjusting its offset, so that the center point of each line of watermarks is located on the same vertical center line, and further adjusting the offset of all watermarks, so that the whole watermark is moved to the center of the image.

Benefits of technology

It achieves centering of multi-line text watermarks after rotation, reduces storage usage, and provides multi-line text watermarks with different angle styles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115375526B_ABST
    Figure CN115375526B_ABST
Patent Text Reader

Abstract

The application discloses a watermark adding method and system, and the method comprises the following steps: loading at least two rows of parallel character watermarks; rotating each row of the character watermarks by the same angle with respect to the center point of the watermark; calculating a first offset of each row of the character watermarks, and then moving the character watermarks by the first offset, so that the center point of each row of the character watermarks is located on the same vertical center line; after the center point of each row of the character watermarks is located on the same vertical center line, calculating a second offset of all the parallel character watermarks, and then moving the character watermarks by the second offset, so that all the parallel character watermarks are moved to the midpoint of the vertical center line, that is, the center of the whole image. Through the implementation of the application, the multiple rows of character watermarks are centrally rotated, and multiple rows of character watermarks with different angle styles and small storage occupation are obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of watermark centering technology, and more particularly to a method and system for adding watermarks. Background Technology

[0002] Currently, the main ways to add watermarks are text watermarks and image watermarks. Text watermarks can add basic text watermarks with different font styles and angles. The advantage is that they are simple and take up little storage space, but the variety of watermark styles they can support is not very rich. Image watermarks can achieve more styles than text watermarks, but they take up more storage space. When adding a large number of watermarks, it may cause a significant increase in the file's storage usage.

[0003] Centering multiple lines of image watermarks is relatively easy, but when adding a lot of watermark content, the image watermark itself is much larger than the text, which may result in a much larger file size after watermarking. For text watermarks, while current watermarking tools can find the center point, if each line of text is centered, they will overlap. Outputting them at a certain line spacing will cause the overall layout to be slightly lower. Rotating the watermark will also cause the center positions of each line to deviate because each line rotates around its own center. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to address at least one defect in the existing technology: after a multi-line text watermark is rotated, each line of watermark is displaced in the horizontal and vertical directions to achieve the overall centered rotation of the text watermark, and to provide a method and system for adding watermarks.

[0005] The technical solution adopted by this invention to solve its technical problem is: to construct a watermarking method, comprising the following steps:

[0006] S1: Load at least two lines of parallel text watermark;

[0007] S2: Each line of text watermark rotates by the same angle around its own watermark center point;

[0008] S3: For each line of text watermark, calculate its first offset, and then move it according to the first offset so that the center point of each line of text watermark is located on the same vertical center line.

[0009] S4: After the center point of each line of text watermark is located on the same vertical center line, the second offset of all the parallel text watermarks is calculated. Then, the watermarks are moved according to the second offset, so that all the parallel text watermarks move together to the midpoint of the vertical center line, which is the center of the overall image.

[0010] Preferably, in the watermarking method of the present invention, the method further includes the following steps before step S1:

[0011] S0: Set the center point of the first line of watermark as the center of the overall image, and establish a rectangular coordinate system with the center of the overall image as the origin.

[0012] Preferably, in the watermarking method of the present invention, step S1 includes:

[0013] Load at least two lines of parallel text watermarks arranged sequentially along the y-axis with equal spacing.

[0014] Preferably, in the watermarking method of the present invention, the first offset includes the movement of the x-axis and y-axis; the second offset includes the movement of the y-axis.

[0015] Preferably, in the watermarking method of the present invention, when the number of lines n of each line of text watermark is odd:

[0016] The calculation of its first offset includes:

[0017] The same vertical center line is a vertical center line perpendicular to the watermark, drawn through the center point of the (n+1) / 2th row of watermarks. The first offset is the offset by which the center point of the other watermarks, excluding the (n+1) / 2nd row of watermarks, moves to the vertical center line.

[0018] Calculate the second offset of all parallel text watermarks, including:

[0019] The second offset is the overall movement of all at least two lines of parallel text watermarks after step S3, whereby the center of the (n+1) / 2th line watermark moves to the center of the overall image.

[0020] Preferably, in the watermarking method of the present invention, when the number n of each line of text watermark is an even number:

[0021] The calculation of its first offset includes:

[0022] The same vertical center line includes a vertical center line perpendicular to the watermarks, drawn at the center point between the n / 2th row watermark and the (n / 2)+1th row watermark; the first offset is the offset by which the center point of all watermarks moves to the vertical center line.

[0023] The calculation of the second offset of all the parallel text watermarks includes:

[0024] The second offset is the overall movement of all at least two parallel text watermarks after step S3. The overall movement is the movement of the center point between the n / 2th and (n / 2)+1th watermarks to the center of the overall image.

[0025] Preferably, in the watermarking method of the present invention, the movement according to the first offset includes:

[0026] When the rotation is clockwise and the rotation angle is less than 90 degrees, the first offset is to move to the lower right when passing the watermark above the center point of the (n+1) / 2nd row of watermarks; and to the upper left when passing the watermark below the center point of the (n+1) / 2nd row of watermarks.

[0027] Or, if the rotation is counterclockwise and the rotation angle is less than 90 degrees, the first offset is to move to the upper left when passing the watermark above the center point of the (n+1) / 2th row watermark; and the first offset is to move to the lower right when passing the watermark below the center point of the (n+1) / 2nd row watermark.

[0028] The movement according to the second offset includes:

[0029] All of the at least two lines of parallel text watermarks are moved upwards as a whole.

[0030] Preferably, in the watermarking method of the present invention, the movement according to the first offset includes:

[0031] When the rotation is clockwise and the rotation angle is less than 90 degrees, the first offset is to move to the lower right when passing through the upper part of the watermark above the center point between the n / 2nd row watermark and the (n / 2)+1st row watermark; and the first offset is to move to the upper left when passing through the lower part of the watermark below the center point between the n / 2nd row watermark and the (n / 2)+1st row watermark.

[0032] Or, if the rotation is counterclockwise and the rotation angle is less than 90 degrees, the first offset is to move to the upper left of the watermark above the center point between the n / 2nd and (n / 2)+1st row watermarks; and the first offset is to move to the lower right of the watermark below the center point between the n / 2nd and (n / 2)+1st row watermarks.

[0033] The movement according to the second offset includes:

[0034] All of the parallel text watermarks are moved upwards.

[0035] Preferably, in the watermarking method of the present invention, the first offset of the (n+1) / 2th row watermark is zero.

[0036] The present invention also constructs a watermarking system, comprising:

[0037] The loading module is used to load at least two lines of parallel text watermarks.

[0038] The rotation module is used to rotate at least two parallel lines of text watermarks around their own watermark center point by the same angle.

[0039] The first processing module is used to calculate the first offset of each line of text watermark, and then move it according to the first offset so that the center point of each line of text watermark is located on the same vertical center line.

[0040] After the at least two lines of parallel text watermarks are rotated, the first offset of the at least two lines of parallel text watermarks is calculated. After the at least two lines of parallel text watermarks are moved according to the first offset, the center points of the at least two lines of parallel text watermarks are located on the same vertical center line.

[0041] The second processing module calculates the second offset of all parallel text watermarks after the center points of each line of text watermarks are located on the same vertical center line. It then moves these parallel text watermarks according to the second offset, so that all parallel text watermarks move together to the midpoint of the vertical center line, which is the center of the overall image. Similarly, after the center points of at least two lines of parallel text watermarks are located on the same vertical center line, the module calculates the second offset of these at least two lines of parallel text watermarks. After these at least two lines of parallel text watermarks move according to the second offset, they move together to the midpoint of the vertical center line, which is the center of the overall image.

[0042] By implementing this invention, the following beneficial effects are achieved:

[0043] This invention discloses a method and system for adding watermarks, which can output multi-line text watermarks on a specified page. When multi-line text watermarks need to be rotated, the offset of each line of watermark should be moved in the horizontal and vertical directions after the multi-line text watermark is rotated to achieve the overall centering of the multi-line text watermark, resulting in multi-line text watermarks with different angle styles and small storage footprint. Attached Figure Description

[0044] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:

[0045] Figure 1 This is a flowchart illustrating the watermarking method of the present invention;

[0046] Figure 2 This is a diagram of the first embodiment of the watermarking method of the present invention;

[0047] Figure 3 This is a diagram of the second embodiment of the watermarking method of the present invention;

[0048] Figure 4 This is a diagram of the third embodiment of the watermarking method of the present invention;

[0049] Figure 5 This is a diagram of the fourth embodiment of the watermarking method of the present invention;

[0050] Figure 6 This is a block diagram of the watermarking system of the present invention. Detailed Implementation

[0051] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0052] It should be noted that the flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0053] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0054] In this embodiment, as Figure 1 As shown, the present invention constructs a method for adding watermarks, including the following steps:

[0055] S1: Load at least two lines of parallel text watermark;

[0056] S2: Each line of text watermark rotates by the same angle around its own watermark center point;

[0057] S3: For each line of text watermark, calculate its first offset, and then move it according to the first offset so that the center point of each line of text watermark is located on the same vertical center line.

[0058] S4: After the center point of each line of text watermark is located on the same vertical center line, calculate the second offset of all parallel text watermarks. Then move them according to the second offset so that all parallel text watermarks move together to the midpoint of the vertical center line, which is the center of the overall image.

[0059] In some embodiments, the method further includes the following steps prior to step S1:

[0060] S0: Set the center point of the first line of watermark as the center of the entire image, and establish a rectangular coordinate system with the center of the entire image as the origin.

[0061] In some embodiments, step S1 includes:

[0062] Load at least two lines of parallel text watermarks arranged sequentially along the y-axis with equal spacing.

[0063] In some embodiments, the first offset includes the amount of movement along the x-axis and y-axis; the second offset includes the amount of movement along the y-axis.

[0064] In some embodiments, when the number of lines n of each line of text watermark is odd:

[0065] The calculation of its first offset includes:

[0066] The same vertical center line is a vertical center line perpendicular to the watermark, drawn from the center point of the (n+1) / 2th row watermark. The first offset is the offset by which the center point of the other watermarks except the (n+1) / 2nd row watermark moves to the vertical center line.

[0067] Calculate the second offset of all parallel text watermarks, including:

[0068] The second offset is the overall movement of all at least two parallel text watermarks after step S3, where the center of the (n+1) / 2th line watermark is moved to the center of the overall image.

[0069] Specifically, when the number of lines n in each line of the text watermark is odd:

[0070] It moves according to the first offset, including:

[0071] When the rotation is clockwise and the rotation angle is less than 90 degrees, the first offset for the watermark above the center point of the (n+1) / 2th row is to move to the lower right; the first offset for the watermark below the center point of the (n+1) / 2nd row is to move to the upper left.

[0072] Alternatively, if the rotation is counterclockwise and the rotation angle is less than 90 degrees, the first offset for the watermark above the center point of the (n+1) / 2th row watermark is to move to the upper left; the first offset for the watermark below the center point of the (n+1) / 2nd row watermark is to move to the lower right.

[0073] It moves according to the second offset, including:

[0074] All parallel text watermarks are moved upwards.

[0075] In some embodiments, when the number of rows of a multi-line watermark is an odd number greater than or equal to 2, the first offset of the (n+1) / 2th row of the watermark is zero.

[0076] In the first embodiment, n rows of watermarks are provided, for example, as shown below. Figure 2 (a) shows a 3-row watermark, with each pair of watermarks spaced by a distance of b. The midpoint of the first row of watermarks is (0,0), and the other watermarks are arranged sequentially downwards along the y-axis at a distance b. When the number of rows n of the multi-row watermark is an odd number greater than or equal to 2, and as shown in (a)... Figure 2 (b) When rotating A° clockwise by less than 90°, calculate the first offset by which the midpoints of all watermarks except for the (n+1) / 2 row watermarks move to the same vertical midline:

[0077] If the watermark is located in the kth row above the (n+1) / 2th row watermark, then the formula for calculating the first offset is:

[0078] Xk1=kb(sinA^2), Yk1=kbsinAcosA.

[0079] After calculating the first offset, as follows: Figure 2 (c) shows that the watermark moves to the lower right.

[0080] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then the formula for calculating the first offset is:

[0081] Xk2=-kbsinAcosA, Yk2=-kb(sinA^2).

[0082] After calculating the first offset, as follows: Figure 2 (c) shows that the watermark moves to the upper left.

[0083] After the watermark in row (n+1) / 2 is rotated, there is no need to move it by the first offset.

[0084] After all watermarks except the (n+1) / 2th row watermark are moved by the first offset, the second offset is calculated for all watermarks. The common center of all watermarks is then moved to the center of the overall image (0,0). This means the center point of the (n+1) / 2th row watermark is moved to the center of the overall image, where its coordinates are (0, nb / 2). Therefore, it is necessary to... Figure 2 As shown in (d), all watermarks are moved up nb / 2 along the Y-axis.

[0085] Therefore, the formula for calculating the total offset is:

[0086] If the watermark is located on the k-th row above the (n+1) / 2-th row watermark, then it is:

[0087] Xk3=kb(sinA^2), Yk3=kbsinAcosA+nb / 2.

[0088] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then it is:

[0089] Xk4=-kbsinAcosA, Yk4=-kb(sinA^2)+nb / 2.

[0090] In the second embodiment, n rows of watermarks are provided, for example, as shown below. Figure 3 (a) shows a 3-row watermark, with each pair of watermarks spaced by a distance of b. The midpoint of the first row of watermarks is (0,0), and the other watermarks are arranged sequentially downwards along the y-axis at a distance b. When the number of rows n of the multi-row watermark is an odd number greater than or equal to 2, and as shown in (a)... Figure 3 (b) When rotating A° counterclockwise by less than 90°, calculate the first offset by which the midpoints of all watermarks except for the (n+1) / 2 row watermarks move to the same vertical midline:

[0091] If the watermark is located in the kth row above the (n+1) / 2th row watermark, then the formula for calculating the first offset is:

[0092] Xk5=-kb(sinA^2), Yk5=-kbsinAcosA.

[0093] After calculating the first offset, as follows: Figure 3 (c) shows that the watermark moves to the lower left.

[0094] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then the formula for calculating the first offset is:

[0095] Xk6=kbsinAcosA, Yk6=kb(sinA^2).

[0096] After calculating the first offset, as follows: Figure 3 (c) shows that the watermark moves to the upper right.

[0097] After the watermark in row (n+1) / 2 is rotated, there is no need to move it by the first offset.

[0098] After all watermarks except the (n+1) / 2th row watermark are moved by the first offset, the second offset is calculated for all watermarks. The common center of all watermarks is then moved to the center of the overall image (0,0). This means the center point of the (n+1) / 2th row watermark is moved to the center of the overall image, where its coordinates are (0,nb / 2). Figure 3 As shown in (d), all watermarks need to be moved up along the Y-axis by nb / 2.

[0099] Therefore, the formula for calculating the total offset is:

[0100] If the watermark is located on the k-th row above the (n+1) / 2-th row watermark, then it is:

[0101] Xk7=-kb(sinA^2), Yk7=-kbsinAcosA+nb / 2.

[0102] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then it is:

[0103] Xk8=kbsinAcosA, Yk8=kb(sinA^2)+nb / 2.

[0104] In some embodiments, when the number of lines n of each line of text watermark is even:

[0105] The calculation of its first offset includes:

[0106] The same vertical center line includes a vertical center line perpendicular to the watermark drawn at the center point between the n / 2th row watermark and the (n / 2)+1th row watermark; the first offset is the offset by which the center point of all watermarks moves to the vertical center line;

[0107] Calculate the second offset of all parallel text watermarks, including:

[0108] The second offset is the overall movement of all parallel text watermarks after step S3. The overall movement is to move from the center point between the n / 2th row watermark and the (n / 2)+1th row watermark to the center of the overall image.

[0109] Specifically, when the number of lines in each line of the text watermark is even:

[0110] It moves according to the first offset, including:

[0111] When the rotation is clockwise and the rotation angle is less than 90 degrees, the watermark above the center point between the n / 2th and (n / 2)+1th watermarks will move to the lower right with the first offset; the watermark below the center point between the n / 2th and (n / 2)+1st watermarks will move to the upper left with the first offset.

[0112] Or, when the rotation is counterclockwise and the rotation angle is less than 90 degrees, the watermark above the center point between the n / 2th row watermark and the (n / 2)+1th row watermark will move to the upper left with the first offset; the watermark below the center point between the n / 2th row watermark and the (n / 2)+1st row watermark will move to the lower right with the first offset.

[0113] At least two lines of parallel text watermarks are shifted by a second offset, including:

[0114] All at least two lines of parallel text watermarks should be moved upwards.

[0115] In the third embodiment, n rows of watermarks are provided, for example, Figure 4 (a) shows two rows of watermarks, with a pairwise distance of b between each watermark. The midpoint of the first row of watermarks is (0,0), and the other watermarks are arranged sequentially downwards along the y-axis at a distance b. When the number of rows n of the multi-row watermarks is an even number greater than or equal to 2, and as shown in (a)... Figure 4 (b) When rotating clockwise by less than 90° at A°, the first offset of the midpoint of each watermark row moving to the same vertical midline is calculated as follows:

[0116] If the watermark is located in the kth row above the center point between the watermark in row n / 2 and the watermark in row (n / 2)+1, then the formula for calculating the first offset is:

[0117] Xk9=(k-1 / 2)bsinAcosA, Yk9=(k-1 / 2)b(sinA^2).

[0118] After calculating the first offset, as follows: Figure 4 (c) shows that the watermark moves to the lower right.

[0119] If the watermark is located in the kth row below the center point between the n / 2nd row watermark and the (n / 2)+1th row watermark, then the formula for calculating the first offset is:

[0120] Xk 10 =-(k-1 / 2)bsinAcosA,Yk 10 = -(k-1 / 2)b(sinA^2).

[0121] After calculating the first offset, as follows: Figure 4 (c) shows that the watermark moves to the upper left.

[0122] After each multi-line watermark is moved by the first offset, the second offset is calculated, and the common center of all watermarks is moved to the center of the overall image (0,0). That is, the center point between the n / 2th and (n / 2)+1th line watermarks is moved to the center of the overall image. At this point, the coordinates of this center point are (0, (n-1)b / 2). Figure 4 As shown in (d), all watermarks need to be moved up (n-1)b / 2 along the Y-axis.

[0123] Therefore, the formula for calculating the total offset is:

[0124] If the watermark is located on the k-th row above the (n+1) / 2-th row watermark, then it is:

[0125] Xk 11 = (k-1 / 2)bsinAcosA, Yk 11=(k-1 / 2)b(sinA^2)+(n-1)b / 2.

[0126] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then it is:

[0127] Xk 12 =-(k-1 / 2)b / sinAcosA,Yk 12 =-(k-1 / 2)b(sinA^2)+(n-1)b / 2.

[0128] In the fourth embodiment, n rows of watermarks are provided, for example, Figure 5 (a) shows two rows of watermarks, with a pairwise distance of b between each watermark. The midpoint of the first row of watermarks is (0,0), and the other watermarks are arranged sequentially downwards along the y-axis at a distance b. When the number of rows n of the multi-row watermarks is an even number greater than or equal to 2, and as shown in (a)... Figure 5 (b) When rotating counterclockwise by less than 90° at A°, the first offset of the midpoint of each watermark row moving to the same vertical midline is calculated as follows:

[0129] If the watermark is located in the kth row above the center point between the watermark in row n / 2 and the watermark in row (n / 2)+1, then the formula for calculating the first offset is:

[0130] Xk 13 =-(k-1 / 2)bsinAcosA,Yk 13 = -(k-1 / 2)b(sinA^2).

[0131] After calculating the first offset, as follows: Figure 5 (c) shows that the watermark moves to the lower left.

[0132] If the watermark is located in the kth row below the center point between the n / 2nd row watermark and the (n / 2)+1th row watermark, then the formula for calculating the first offset is:

[0133] Xk 14 = (k-1 / 2)bsinAcosA, Yk 14 = (k-1 / 2)b(sinA^2).

[0134] After calculating the first offset, as follows: Figure 5 (c) shows that the watermark moves to the upper right.

[0135] After each multi-line watermark is moved by the first offset, the second offset is calculated, and the common center of all the watermarks is moved to the center of the overall image (0,0). This means moving the center point between the n / 2nd and (n / 2)+1th line watermarks to the center of the overall image. At this point, the coordinates of this center point are (0, (n-1)b / 2). Therefore, it is necessary to... Figure 5 As shown in (d), all watermarks are moved up (n-1)b / 2 along the Y-axis.

[0136] Therefore, the formula for calculating the total offset is:

[0137] If the watermark is located on the k-th row above the (n+1) / 2-th row watermark, then it is:

[0138] Xk 15 =-(k-1 / 2)bsinAcosA,Yk 15 =-(k-1 / 2)b(sinA^2)+(n-1)b / 2.

[0139] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then it is:

[0140] Xk 16 =(k-1 / 2)b / sinAcosA,Yk 16 =(k-1 / 2)b(sinA^2)+(n-1)b / 2.

[0141] In this embodiment, as Figure 6 The present invention also constructs a watermarking system, comprising:

[0142] The loading module is used to load at least two lines of parallel text watermarks.

[0143] The rotation module is used to rotate each line of text watermark by the same angle around its own watermark center point;

[0144] The first processing module is used to calculate the first offset of each line of text watermark, and then move it according to the first offset so that the center point of each line of text watermark is located on the same vertical center line.

[0145] The second processing module calculates the second offset of all parallel text watermarks after the center point of each line of text watermark is located on the same vertical center line. Then, it moves the watermarks according to the second offset so that all parallel text watermarks move together to the midpoint of the vertical center line, which is the center of the overall image.

[0146] In some embodiments, the system further includes:

[0147] The system establishment module is used to set the center point of the first line of watermark as the center of the entire image, and to establish a rectangular coordinate system with the center of the entire image as the origin.

[0148] In some embodiments, the loading module is further configured to:

[0149] Load at least two lines of parallel text watermarks arranged sequentially along the y-axis with equal spacing.

[0150] In some embodiments, the first offset includes the amount of movement along the x-axis and y-axis; the second offset includes the amount of movement along the y-axis.

[0151] In some embodiments, when the number of lines n of each line of text watermark is odd:

[0152] The first offset calculated in the first processing module includes:

[0153] The same vertical center line is a vertical center line perpendicular to the watermark, drawn from the center point of the (n+1) / 2th row watermark. The first offset is the offset by which the center point of the other watermarks except the (n+1) / 2nd row watermark moves to the vertical center line.

[0154] The second processing module calculates the second offset of all parallel text watermarks, including:

[0155] The second offset is the overall movement of at least two parallel lines of text watermarks after the first offset. The overall movement is the movement of the center of the (n+1) / 2th line of watermark to the center of the overall image.

[0156] Specifically, when the number of lines n in each line of the text watermark is odd:

[0157] The first processing module moves according to a first offset, including:

[0158] When the rotation is clockwise and the rotation angle is less than 90 degrees, the first offset for the watermark above the center point of the (n+1) / 2th row is to move to the lower right; the first offset for the watermark below the center point of the (n+1) / 2nd row is to move to the upper left.

[0159] Alternatively, if the rotation is counterclockwise and the rotation angle is less than 90 degrees, the first offset for the watermark above the center point of the (n+1) / 2th row watermark is to move to the upper left; the first offset for the watermark below the center point of the (n+1) / 2nd row watermark is to move to the lower right.

[0160] The second processing module moves according to the second offset, including:

[0161] All parallel text watermarks are moved upwards.

[0162] In some embodiments, when the number of rows of a multi-line watermark is an odd number greater than or equal to 2, the first offset of the (n+1) / 2th row of the watermark is zero.

[0163] In the first embodiment, n rows of watermarks are provided, for example, as shown below. Figure 2 (a) shows a 3-row watermark, with each pair of watermarks spaced by a distance of b. The midpoint of the first row of watermarks is (0,0), and the other watermarks are arranged sequentially downwards along the y-axis at a distance b. When the number of rows n of the multi-row watermark is an odd number greater than or equal to 2, and as shown in (a)... Figure 2 (b) When rotating A° clockwise by less than 90°, calculate the first offset by which the midpoints of all watermarks except for the (n+1) / 2 row watermarks move to the same vertical midline:

[0164] If the watermark is located in the kth row above the (n+1) / 2th row watermark, then the formula for calculating the first offset is:

[0165] Xk1=kb(sinA^2), Yk1=kbsinAcosA.

[0166] After calculating the first offset, as follows: Figure 2 (c) shows that the watermark moves to the lower right.

[0167] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then the formula for calculating the first offset is:

[0168] Xk2=-kbsinAcosA, Yk2=-kb(sinA^2).

[0169] After calculating the first offset, as follows: Figure 2 (c) shows that the watermark moves to the upper left.

[0170] After the watermark in row (n+1) / 2 is rotated, there is no need to move it by the first offset.

[0171] After all watermarks except the (n+1) / 2th row watermark are moved by the first offset, the second offset is calculated for all watermarks. The common center of all watermarks is then moved to the center of the overall image (0,0). This means the center point of the (n+1) / 2th row watermark is moved to the center of the overall image, where its coordinates are (0,nb / 2). Figure 2 As shown in (d), all watermarks need to be moved up along the Y-axis by nb / 2.

[0172] Therefore, the formula for calculating the total offset is:

[0173] If the watermark is located on the k-th row above the (n+1) / 2-th row watermark, then it is:

[0174] Xk3=kb(sinA^2), Yk3=kbsinAcosA+nb / 2.

[0175] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then it is:

[0176] Xk4=-kbsinAcosA, Yk4=-kb(sinA^2)+nb / 2.

[0177] In the second embodiment, n rows of watermarks are provided, for example, as shown below. Figure 3 (a) shows a 3-row watermark, with each pair of watermarks spaced by a distance of b. The midpoint of the first row of watermarks is (0,0), and the other watermarks are arranged sequentially downwards along the y-axis at a distance b. When the number of rows n of the multi-row watermark is an odd number greater than or equal to 2, and as shown in (a)... Figure 3 (b) When rotating A° counterclockwise by less than 90°, calculate the first offset by which the midpoints of all watermarks except for the (n+1) / 2 row watermarks move to the same vertical midline:

[0178] If the watermark is located in the kth row above the (n+1) / 2th row watermark, then the formula for calculating the first offset is:

[0179] Xk5=-kb(sinA^2), Yk5=-kbsinAcosA.

[0180] After calculating the first offset, as follows: Figure 3 (c) shows that the watermark moves to the lower left.

[0181] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then the formula for calculating the first offset is:

[0182] Xk6=kbsinAcosA, Yk6=kb(sinA^2).

[0183] After calculating the first offset, as follows: Figure 3 (c) shows that the watermark moves to the upper right.

[0184] After the watermark in row (n+1) / 2 is rotated, there is no need to move it by the first offset.

[0185] After all watermarks except the (n+1) / 2th row watermark are moved by the first offset, the second offset is calculated for all watermarks. The common center of all watermarks is then moved to the center of the overall image (0,0). This means the center point of the (n+1) / 2th row watermark is moved to the center of the overall image, where its coordinates are (0,nb / 2). Figure 3 As shown in (d), all watermarks need to be moved up along the Y-axis by nb / 2.

[0186] Therefore, the formula for calculating the total offset is:

[0187] If the watermark is located on the k-th row above the (n+1) / 2-th row watermark, then it is:

[0188] Xk7=-kb(sinA^2), Yk7=-kbsinAcosA+nb / 2.

[0189] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then it is:

[0190] Xk8=kbsinAcosA, Yk8=kb(sinA^2)+nb / 2.

[0191] In some embodiments, when the number of lines n of each line of text watermark is even:

[0192] The first offset calculated in the first processing module includes:

[0193] The same vertical center line includes a vertical center line perpendicular to the watermark drawn at the center point between the n / 2th row watermark and the (n / 2)+1th row watermark; the first offset is the offset by which the center point of all watermarks moves to the vertical center line;

[0194] The second processing module calculates the second offset of all parallel text watermarks, including:

[0195] The second offset is the overall movement of all parallel text watermarks after the first offset. The overall movement is to move from the center point between the n / 2th row watermark and the (n / 2)+1th row watermark to the center of the overall image.

[0196] Specifically, when the number of lines in each line of the text watermark is even:

[0197] The first processing module moves according to a first offset, including:

[0198] When the rotation is clockwise and the rotation angle is less than 90 degrees, the watermark above the center point between the n / 2th and (n / 2)+1th watermarks will move to the lower right with the first offset; the watermark below the center point between the n / 2th and (n / 2)+1st watermarks will move to the upper left with the first offset.

[0199] Or, when the rotation is counterclockwise and the rotation angle is less than 90 degrees, the watermark above the center point between the n / 2th row watermark and the (n / 2)+1th row watermark will move to the upper left with the first offset; the watermark below the center point between the n / 2th row watermark and the (n / 2)+1st row watermark will move to the lower right with the first offset.

[0200] At least two lines of parallel text watermarks are shifted by a second offset, including:

[0201] All at least two lines of parallel text watermarks should be moved upwards.

[0202] In the third embodiment, n rows of watermarks are provided, for example, Figure 4 (a) shows two rows of watermarks, with a pairwise distance of b between each watermark. The midpoint of the first row of watermarks is (0,0), and the other watermarks are arranged sequentially downwards along the y-axis at a distance b. When the number of rows n of the multi-row watermarks is an even number greater than or equal to 2, and as shown in (a)... Figure 4 (b) When rotating clockwise by less than 90° at A°, the first offset of the midpoint of each watermark row moving to the same vertical midline is calculated as follows:

[0203] If the watermark is located in the kth row above the center point between the watermark in row n / 2 and the watermark in row (n / 2)+1, then the formula for calculating the first offset is:

[0204] Xk9=(k-1 / 2)bsinAcosA, Yk9=(k-1 / 2)b(sinA^2).

[0205] After calculating the first offset, as follows: Figure 4 (c) shows that the watermark moves to the lower right.

[0206] If the watermark is located in the kth row below the center point between the n / 2nd row watermark and the (n / 2)+1th row watermark, then the formula for calculating the first offset is:

[0207] Xk 10 =-(k-1 / 2)bsinAcosA,Yk 10 = -(k-1 / 2)b(sinA^2).

[0208] After calculating the first offset, as follows: Figure 4 (c) shows that the watermark moves to the upper left.

[0209] After each multi-line watermark is moved by the first offset, the second offset is calculated, and the common center of all watermarks is moved to the center of the overall image (0,0). That is, the center point between the n / 2th and (n / 2)+1th line watermarks is moved to the center of the overall image. At this point, the coordinates of this center point are (0, (n-1)b / 2). Figure 4 As shown in (d), all watermarks need to be moved up (n-1)b / 2 along the Y-axis.

[0210] Therefore, the formula for calculating the total offset is:

[0211] If the watermark is located on the k-th row above the (n+1) / 2-th row watermark, then it is:

[0212] Xk 11= (k-1 / 2)bsinAcosA, Yk 11 =(k-1 / 2)b(sinA^2)+(n-1)b / 2.

[0213] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then it is:

[0214] Xk 12 =-(k-1 / 2)b / sinAcosA,Yk 12 =-(k-1 / 2)b(sinA^2)+(n-1)b / 2.

[0215] In the fourth embodiment, n rows of watermarks are provided, for example, Figure 5 (a) shows two rows of watermarks, with a pairwise distance of b between each watermark. The midpoint of the first row of watermarks is (0,0), and the other watermarks are arranged sequentially downwards along the y-axis at a distance b. When the number of rows n of the multi-row watermarks is an even number greater than or equal to 2, and as shown in (a)... Figure 5 (b) When rotating counterclockwise by less than 90° at A°, the first offset of the midpoint of each watermark row moving to the same vertical midline is calculated as follows:

[0216] If the watermark is located in the kth row above the center point between the watermark in row n / 2 and the watermark in row (n / 2)+1, then the formula for calculating the first offset is:

[0217] Xk 13 =-(k-1 / 2)bsinAcosA,Yk 13 = -(k-1 / 2)b(sinA^2).

[0218] After calculating the first offset, as follows: Figure 5 (c) shows that the watermark moves to the lower left.

[0219] If the watermark is located in the kth row below the center point between the n / 2nd row watermark and the (n / 2)+1th row watermark, then the formula for calculating the first offset is:

[0220] Xk 14 = (k-1 / 2)bsinAcosA, Yk 14 = (k-1 / 2)b(sinA^2).

[0221] After calculating the first offset, as follows: Figure 5 (c) shows that the watermark moves to the upper right.

[0222] After each multi-line watermark is moved by the first offset, the second offset is calculated, and the common center of all the watermarks is moved to the center of the overall image (0,0). This means moving the center point between the n / 2nd and (n / 2)+1th line watermarks to the center of the overall image. At this point, the coordinates of this center point are (0, (n-1)b / 2). Therefore, it is necessary to... Figure 5 As shown in (d), all watermarks are moved up (n-1)b / 2 along the Y-axis.

[0223] Therefore, the formula for calculating the total offset is:

[0224] If the watermark is located on the k-th row above the (n+1) / 2-th row watermark, then it is:

[0225] Xk 15 =-(k-1 / 2)bsinAcosA,Yk 15 =-(k-1 / 2)b(sinA^2)+(n-1)b / 2.

[0226] If the watermark is located in the kth row below the (n+1) / 2th row watermark, then it is:

[0227] Xk 16 =(k-1 / 2)b / sinAcosA,Yk 16 =(k-1 / 2)b(sinA^2)+(n-1)b / 2.

[0228] By implementing this invention, the following beneficial effects are achieved:

[0229] This invention discloses a method and system for adding watermarks, which can output multi-line text watermarks on a specified page. When multi-line text watermarks need to be rotated, the offset of each line of watermark should be moved in the horizontal and vertical directions after the multi-line text watermark is rotated by using trigonometric functions to achieve the overall centering and rotation of the multi-line text watermark, resulting in multi-line text watermarks with different angle styles and small storage footprint.

[0230] It is understood that the above embodiments only illustrate preferred embodiments of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can freely combine the above technical features without departing from the concept of the present invention, and can also make several modifications and improvements, all of which fall within the protection scope of the present invention. Therefore, all equivalent transformations and modifications made with respect to the scope of the claims of the present invention should fall within the scope of the claims of the present invention.

Claims

1. A method for adding a watermark, characterized in that, Includes the following steps: S1: Load at least two lines of parallel text watermark; S2: Each line of text watermark rotates by the same angle around its own watermark center point; S3: For each line of text watermark, calculate its first offset, and then move it according to the first offset so that the center point of each line of text watermark is located on the same vertical center line; when the number of lines n of each line of text watermark is odd: calculating its first offset includes: the same vertical center line is a vertical center line perpendicular to the watermark drawn through the center point of the (n+1) / 2th line of watermark, and the first offset is the offset by which the center point of the other watermarks except the (n+1) / 2th line of watermark moves to the vertical center line; or, when the number of lines n of each line of text watermark is even: calculating its first offset includes: the same vertical center line includes a vertical center line perpendicular to the watermark drawn through the center point between the (n / 2th)th line of watermark and the (n / 2)+1th line of watermark; the first offset is the offset by which the center point of all watermarks moves to the vertical center line. S4: After the center point of each line of text watermark is located on the same vertical center line, the second offset of all the parallel text watermarks is calculated. Then, the watermarks are moved according to the second offset, so that all the parallel text watermarks move together to the midpoint of the vertical center line, which is the center of the overall image.

2. The method for adding a watermark according to claim 1, characterized in that, Step S1 is preceded by: S0: Set the center point of the first line of watermark as the center of the overall image, and establish a rectangular coordinate system with the center of the overall image as the origin.

3. The method for adding a watermark according to claim 2, characterized in that, Step S1 includes: Load at least two lines of parallel text watermarks arranged sequentially along the y-axis with equal spacing.

4. The method for adding a watermark according to claim 2, characterized in that, The first offset includes the amount of movement along the x-axis and y-axis; the second offset includes the amount of movement along the y-axis.

5. The method for adding a watermark according to claim 1, characterized in that, When the number of lines n of each line of text watermark is odd: The calculation of the second offset of all the parallel text watermarks includes: The second offset is the overall movement of all the parallel text watermarks after step S3, whereby the center of the (n+1) / 2th row watermark moves to the center of the overall image.

6. The method for adding a watermark according to claim 1, characterized in that, When the number of lines n of each line of text watermark is even: The calculation of the second offset of all the parallel text watermarks includes: The second offset is the overall movement of all the parallel text watermarks after step S3. The overall movement is the movement of the center point between the n / 2th row watermark and the (n / 2)+1th row watermark to the center of the overall image.

7. The method for adding a watermark according to claim 5, characterized in that, When the number of lines n of each line of text watermark is odd: The movement according to the first offset includes: When the rotation is clockwise and the rotation angle is less than 90 degrees, the first offset is to move to the lower right when passing the watermark above the center point of the (n+1) / 2nd row of watermarks; and to the upper left when passing the watermark below the center point of the (n+1) / 2nd row of watermarks. Or, if the rotation is counterclockwise and the rotation angle is less than 90 degrees, the first offset is to move to the upper left when passing the watermark above the center point of the (n+1) / 2th row watermark; and the first offset is to move to the lower right when passing the watermark below the center point of the (n+1) / 2nd row watermark. The movement according to the second offset includes: All of the parallel text watermarks are moved upwards.

8. The method for adding a watermark according to claim 6, characterized in that, When the number of lines n of each line of text watermark is even: The movement according to the first offset includes: When the rotation is clockwise and the rotation angle is less than 90 degrees, the first offset is to move to the lower right when passing through the upper part of the watermark above the center point between the n / 2nd and (n / 2)+1st watermarks; and the first offset is to move to the upper left when passing through the lower part of the watermark below the center point between the n / 2nd and (n / 2)+1st watermarks. Or, if the rotation is counterclockwise and the rotation angle is less than 90 degrees, the first offset is to move to the upper left of the watermark above the center point between the n / 2nd and (n / 2)+1st row watermarks; and the first offset is to move to the lower right of the watermark below the center point between the n / 2nd and (n / 2)+1st row watermarks. The movement according to the second offset includes: All of the parallel text watermarks are moved upwards.

9. The method for adding a watermark according to claim 5, characterized in that, The first offset of the watermark in the (n+1) / 2th row is zero.

10. A watermarking system, characterized in that, include: The loading module is used to load at least two lines of parallel text watermarks. The rotation module is used to rotate each line of text watermark by the same angle around its own watermark center point; The first processing module is used to calculate the first offset for each line of text watermark, and then move it according to the first offset so that the center point of each line of text watermark is located on the same vertical center line; when the number of lines n of each line of text watermark is odd: calculating the first offset includes: the same vertical center line is a vertical center line perpendicular to the watermark drawn through the center point of the (n+1) / 2th line of watermark, and the first offset is the offset by which the center points of the other watermarks except the (n+1) / 2th line of watermark move to the vertical center line; or, when the number of lines n of each line of text watermark is even: calculating the first offset includes: the same vertical center line includes a vertical center line perpendicular to the watermark drawn through the center point between the (n / 2th)th line of watermark and the (n / 2)+1th line of watermark; the first offset is the offset by which the center points of all watermarks move to the vertical center line. The second processing module is used to calculate the second offset of all the parallel text watermarks after the center point of each line of text watermark is located on the same vertical center line. Then, it moves the watermarks according to the second offset so that all the parallel text watermarks move together to the midpoint of the vertical center line, which is the center of the overall image.

Citation Information

Patent Citations

  • Multiline text watermark production device

    CN105139334A

  • Picture compression processing method and system

    CN108322755A