Electronic seal image generation method and device, electronic equipment and storage medium
By using vector graphics drawing technology and pre-stored templates and element components, electronic seal images are generated, which solves the problems of low efficiency and poor accuracy in the prior art, and achieves fast and accurate electronic seal image generation.
Patent Information
- Application Number
- CN202411565814.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art is inefficient, poorly accurate when generating electronic seal images, and requires a lot of manpower consumption.
By obtaining the drawing parameters of the electronic seal image to be drawn, combining the pre-stored electronic seal image information template and seal vector element components, a target electronic seal image is generated using vector graphic drawing technology.
It realizes the rapid and accurate generation of electronic seal images, reduces manpower consumption, and improves the accuracy and efficiency of electronic seal images generation.
Smart Images

Figure CN119417939A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating an electronic seal image. Background Art
[0002] At present, with the continuous development of science and technology, electronic seals have been rapidly and widely used. Electronic seals are data formats in which seal makers digitally sign seal holder information and seal images. The seal image is a graphical representation of the appearance of the electronic seal. The collection and production of seal images is the most important link in the application of electronic seals. Usually, they are generated by scanning, cutting out and retouching. In a normal temperature environment, ink or ink that matches the seal surface is used to continuously stamp 20 times on the stamping paper with a standard stamping force, and the most complete and clearest seal text is taken as the object of collection. Then the stamping paper containing the seal text is scanned and processed to generate image files in formats such as PNG, and then processed with drawing software such as Photoshop to finally generate the seal image. This method has low efficiency and poor accuracy in generating electronic seals, and also requires more manpower. Summary of the invention
[0003] Some embodiments of the present application aim to provide a method, device, electronic device and storage medium for generating an electronic seal image. Through the technical scheme of the embodiments of the present application, by obtaining drawing parameters of the electronic seal image to be drawn; determining a target electronic seal image information template corresponding to the drawing parameters according to the drawing parameters and a pre-stored electronic seal image information template; determining electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters; determining a target seal vector graphics file corresponding to the electronic seal description data according to the pre-stored seal vector element components; determining a target electronic seal image corresponding to the drawing parameters according to the target seal vector graphics file, in the embodiments of the present application, electronic seal graphics are drawn by using vector graphics drawing technology, which has the advantages of high visual quality of drawn graphics, not easy to deform, and low computer resource consumption, and can quickly and accurately generate electronic seal images, reduce manpower consumption, and improve the accuracy and efficiency of electronic seal image generation.
[0004] In a first aspect, some embodiments of the present application provide a method for generating an electronic seal image, comprising:
[0005] Obtaining drawing parameters of the electronic seal image to be drawn;
[0006] Determining a target electronic seal image information template corresponding to the drawing parameters according to the drawing parameters and a pre-stored electronic seal image information template;
[0007] Determine the electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters; determine the target seal vector graphics file corresponding to the electronic seal description data according to the pre-stored seal vector element components;
[0008] According to the target seal vector graphics file, a target electronic seal image corresponding to the drawing parameters is determined.
[0009] Some embodiments of the present application use vector graphics drawing technology to draw electronic seal graphics, which has the advantages of high visual quality of drawn graphics, not easy to deform, and low consumption of computer resources. It can quickly and accurately generate electronic seal images, reduce manpower consumption, and improve the accuracy and efficiency of electronic seal image generation.
[0010] Optionally, the step of determining a target seal vector graphics file corresponding to the electronic seal description data according to the pre-stored seal vector element components includes:
[0011] Determining a target seal vector element component corresponding to the electronic seal description data according to the pre-stored seal vector element components;
[0012] The target seal vector element component is drawn to obtain a target seal vector graphics file corresponding to the electronic seal description data.
[0013] Optionally, the drawing parameters at least include drawing parameters of vector graphics and drawing parameters of seals, the drawing parameters of vector graphics at least include vector graphics width, vector graphics height and view area, and the drawing parameters of seals at least include attribute information of seal shape, attribute information of text object, attribute information of coding object and attribute information of central pattern object. Optionally, the drawing parameters of seals also include: attribute information of attachment object, attribute information of ellipse double ring and attribute information of inner ring of circle.
[0014] Some embodiments of the present application can pre-set the drawing parameters of the vector graphics and the drawing parameters of the seal, which can be set according to user needs.
[0015] Optionally, the step of drawing the target seal vector element component to obtain a target seal vector graphics file corresponding to the electronic seal description data includes:
[0016] For the target seal vector element component, the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object are drawn in sequence from top to bottom and from left to right to obtain a vector graphics file corresponding to the drawing parameters.
[0017] Some embodiments of the present application, by drawing the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object in order from top to bottom and from left to right, obtain a vector graphics file corresponding to the drawing parameters, thereby improving the accuracy and efficiency of electronic seal image generation.
[0018] Optionally, in the case where the electronic seal image is a circular seal, the step of determining the electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters includes:
[0019] Determine the configuration parameters of the circular border according to the electronic seal image information template, wherein the configuration parameters at least include the coordinates of the center of the circle, the radius of the circle, the color of the circle, the width of the circle, and whether to fill it;
[0020] Determine the curvature of each character in the text object according to the curvature of the circular border;
[0021] Determine the total arc length of the text object according to the arc of each character;
[0022] Calculate the character spacing according to the total arc length, the arc of each character and the number of characters;
[0023] Calculate the font spacing based on the width and height ratio of the text;
[0024] Drawing a text object according to the character spacing, the font spacing and the circular border;
[0025] The double ring object, the inner ring object, the central pattern, the horizontal line, the attachment, and the coded object are drawn in sequence to obtain electronic seal description data corresponding to the drawing parameters.
[0026] Optionally, determining a target electronic seal image corresponding to the drawing parameters according to the target seal vector graphics file includes:
[0027] According to a preset format conversion algorithm, the target seal vector graphics files are respectively converted into target electronic seal images in a target format corresponding to the preset format conversion algorithm, wherein the target electronic seal images in the target format at least include: a raster image or a layout image.
[0028] Some embodiments of the present application convert vector graphics into images of different formats as required, thereby realizing a method for automatically generating seal images of different formats. This method is completely implemented using code programming and does not require professional image processing personnel. The cost of generating seal images can be greatly reduced, and the speed of manually producing seal images is also increased exponentially compared to the manual production of seal images.
[0029] In a second aspect, some embodiments of the present application provide a device for generating an electronic seal image, including:
[0030] An acquisition module, used for acquiring drawing parameters of the electronic seal image to be drawn;
[0031] A first determining module, used for determining a target electronic seal image information template corresponding to the drawing parameters according to the drawing parameters and a pre-stored electronic seal image information template;
[0032] A second determining module is used to determine the electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters;
[0033] A drawing module, used for determining a target seal vector graphics file corresponding to the electronic seal description data according to pre-stored seal vector element components;
[0034] The conversion module is used to determine the target electronic seal image corresponding to the drawing parameters according to the target seal vector graphics file.
[0035] Some embodiments of the present application use vector graphics drawing technology to draw electronic seal graphics, which has the advantages of high visual quality of drawn graphics, not easy to deform, and low consumption of computer resources. It can quickly and accurately generate electronic seal images, reduce manpower consumption, and improve the accuracy and efficiency of electronic seal image generation.
[0036] Optionally, the drawing module is used to:
[0037] Determining a target seal vector element component corresponding to the electronic seal description data according to the pre-stored seal vector element components;
[0038] The target seal vector element component is drawn to obtain a target seal vector graphics file corresponding to the electronic seal description data.
[0039] Optionally, the drawing parameters include at least drawing parameters of the vector graphics and drawing parameters of the seal, the drawing parameters of the vector graphics include at least vector graphics width, vector graphics height and view area, and the drawing parameters of the seal include at least attribute information of the seal shape, attribute information of the text object, attribute information of the coding object and attribute information of the central pattern object. Some embodiments of the present application can pre-set the drawing parameters of the vector graphics and the drawing parameters of the seal, which can be set according to user needs.
[0040] Optionally, the drawing module is used to:
[0041] According to the electronic seal image information template, the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object are drawn in sequence from top to bottom and from left to right to obtain a vector graphics file corresponding to the drawing parameters.
[0042] Some embodiments of the present application, by drawing the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object in order from top to bottom and from left to right, obtain a vector graphics file corresponding to the drawing parameters, thereby improving the accuracy and efficiency of electronic seal image generation.
[0043] Optionally, the second determining module is used to:
[0044] Determine the configuration parameters of the circular border according to the electronic seal image information template, wherein the configuration parameters at least include the coordinates of the center of the circle, the radius of the circle, the color of the circle, the width of the circle, and whether to fill it;
[0045] Determine the curvature of each character in the text object according to the curvature of the circular border;
[0046] Determine the total arc length of the text object according to the arc of each character;
[0047] Calculate the character spacing according to the total arc length, the arc of each character and the number of characters;
[0048] Calculate the font spacing based on the width and height ratio of the text;
[0049] Drawing a text object according to the character spacing, the font spacing and the circular border;
[0050] The double ring object, the inner ring object, the central pattern, the horizontal line, the attachment, and the coded object are drawn in sequence to obtain electronic seal description data corresponding to the drawing parameters.
[0051] Optionally, the conversion module is used to:
[0052] According to a preset format conversion algorithm, the target seal vector graphics files are respectively converted into target electronic seal images in a target format corresponding to the preset format conversion algorithm, wherein the target electronic seal images in the target format at least include: a raster image or a layout image.
[0053] Some embodiments of the present application convert vector graphics into images of different formats as required, thereby realizing a method for automatically generating complex style seal images. This method is completely implemented using code programming and does not require professional image processing personnel. The cost of seal image generation can be greatly reduced, and the speed of manually making seal images is also multiplied.
[0054] In a third aspect, some embodiments of the present application provide an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for generating an electronic seal image as described in any embodiment of the first aspect can be implemented.
[0055] In a fourth aspect, some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the method for generating an electronic seal image as described in any embodiment of the first aspect.
[0056] In a fifth aspect, some embodiments of the present application provide a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, it can implement the method for generating an electronic seal image as described in any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions of some embodiments of the present application, the drawings required for use in some embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 A schematic diagram of a flow chart of a method for generating an electronic seal image provided in an embodiment of the present application;
[0059] Figure 2 A schematic diagram of a process for automatically generating an electronic seal image provided in an embodiment of the present application;
[0060] Figure 3 A schematic diagram of a seal template filling process provided in an embodiment of the present application;
[0061] Figure 4 An example diagram of a template after a circular stamp is filled in according to an embodiment of the present application;
[0062] Figure 5 A schematic diagram of the seal template parsing process provided in an embodiment of the present application;
[0063] Figure 6 A schematic diagram of a seal image drawing process provided in an embodiment of the present application;
[0064] Figure 7 An example diagram of a vector graphics file of a circular seal provided in an embodiment of the present application;
[0065] Figure 8A schematic diagram of a calculation example of a character arc length provided in an embodiment of the present application;
[0066] Fig. 9 A schematic diagram of the seal image format conversion and delivery process provided in an embodiment of the present application;
[0067] Fig.10 A schematic diagram of a circular seal image provided in an embodiment of the present application;
[0068] Fig.11 A schematic diagram of the structure of a device for generating an electronic seal image provided in an embodiment of the present application;
[0069] Fig.12 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] The technical solutions in some embodiments of the present application will be described below in conjunction with the drawings in some embodiments of the present application.
[0071] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0072] At present, with the continuous development of science and technology, electronic seals have been rapidly and widely used. Electronic seals are data formats in which seal makers digitally sign the seal holder information and seal images. The seal image is a graphical representation of the appearance of the electronic seal. The collection and production of seal images is the most important link in the application of electronic seals. Usually, they are generated by scanning, cutting out and retouching. In a normal temperature environment, use ink or ink pad that matches the seal surface, and use standard stamping force to stamp on the stamping paper 20 times in a row. The most complete and clearest seal text is taken as the object of collection. Then, the stamped paper containing the seal text is scanned to generate an image file in a format such as PNG, which is then processed using drawing software such as Photoshop to finally generate a seal image. In this way, the efficiency and accuracy of generating an electronic seal are low, and a lot of manpower is also consumed. In view of this, some embodiments of the present application provide a method for generating an electronic seal image, the method comprising: obtaining drawing parameters of an electronic seal image to be drawn; determining a target electronic seal image information template corresponding to the drawing parameters based on the drawing parameters and a pre-stored electronic seal image information template; determining electronic seal description data corresponding to the drawing parameters based on the target electronic seal image information template and the drawing parameters; determining a target seal vector graphics file corresponding to the electronic seal description data based on pre-stored seal vector element components; determining a target electronic seal image corresponding to the drawing parameters based on the target seal vector graphics file. In the embodiments of the present application, electronic seal graphics are drawn using vector graphics drawing technology, which has the advantages of high visual quality of drawn graphics, not easy to deform, and low computer resource consumption, and can quickly and accurately generate electronic seal images, reduce manpower consumption, and improve the accuracy and efficiency of electronic seal image generation.
[0073] like Figure 1 As shown, an embodiment of the present application provides a method for generating an electronic seal image, the method comprising:
[0074] S101, obtaining drawing parameters of the electronic seal image to be drawn;
[0075] Specifically, the user inputs the drawing parameters of the electronic seal image to be drawn in the terminal device, and the terminal device obtains the drawing parameters, which include at least target text data and target drawing conditions, wherein the drawing parameters include at least the drawing parameters of the vector graphics and the drawing parameters of the seal, the drawing parameters of the vector graphics include at least the vector graphics width, the vector graphics height and the view area, and the drawing parameters of the seal include at least the attribute information of the seal shape, the attribute information of the text object, the attribute information of the coding object and the attribute information of the central pattern object.
[0076] S102, determining a target electronic seal image information template corresponding to the drawing parameters according to the drawing parameters and the pre-stored electronic seal image information template;
[0077] Specifically, the terminal device pre-stores an electronic seal image information template, which includes drawing sub-templates of various objects, which at least include templates of seal shape, text object, coding object, central pattern object and attachment, as shown in Table 1.
[0078] Set drawing sub-templates for different objects, and all drawing sub-templates constitute electronic seal image information templates. Electronic seal image information template is a complete set, only one, which specifies all seal elements involved in all seal types. In the process of seal image generation, users only need to fill the seal data into the template, and the elements not involved can be left blank. For example, if the drawing is not a double-ring seal, you don't need to set the template information items related to the double ring.
[0079] After obtaining the drawing parameters of the electronic seal image to be drawn, the terminal device selects drawing sub-templates of different objects corresponding to the drawing parameters from the electronic seal image information template according to the drawing parameters;
[0080] For example, if the drawing parameters include a seal shape and a text object, it is necessary to find a drawing sub-template corresponding to the seal shape and a drawing sub-template corresponding to the text object.
[0081] S103, determining electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters;
[0082] Specifically, after determining the target electronic seal image information template, the terminal device draws the target text data in the drawing parameters to obtain a vector graphics file corresponding to the drawing parameters.
[0083] S104, determining a target seal vector graphics file corresponding to the electronic seal description data according to the pre-stored seal vector element components;
[0084] Vector element components: These are graphics that often appear in a seal, such as a five-pointed star or horizontal line, which can be used as a component. These components can be used to assemble a complete seal image.
[0085] Vector graphics drawing technology has the following advantages: 1) The technology has good scalability. Almost any graphic can be rendered using vector trajectories. (2) Vector images have higher visual quality. The seal image will not be distorted after arbitrary enlargement, reduction, and format conversion. (3) Vector images use less resources during the computer processing process, which is suitable for computer automation and has low cost.
[0086] S105 , determining a target electronic seal image corresponding to the drawing parameters according to the target seal vector graphics file.
[0087] Specifically, the terminal device converts the vector graphics file according to the image format requirements to obtain the target electronic seal image corresponding to the drawing parameters. Electronic seal and electronic seal image are not the same concept. In addition to electronic seal image, electronic seal also contains other data, such as: the digital signature value of the electronic seal issuing agency for the electronic seal data.
[0088] The embodiment of the present application provides a method for generating an electronic seal image, including: specifying the drawing parameters of the electronic seal image to be drawn, and filling the seal drawing parameters into the seal image information template to form complete electronic seal description data; drawing vector graphics according to the electronic seal description data, and selecting pre-set seal vector element components as needed during the drawing process to facilitate the drawing process; according to the vector graphics file, converting the vector graphics file into a target seal image. In the embodiment of the present application, by using vector graphics drawing technology to draw electronic seal graphics, it has the advantages of high visual quality of drawn graphics, not easy to deform, and low computer resource consumption. It can quickly and accurately generate electronic seal images, reduce manpower consumption, and improve the accuracy and efficiency of electronic seal image generation. Another embodiment of the present application further supplements the method for generating electronic seal images provided in the above embodiment.
[0089] Optionally, determining a target seal vector graphic file corresponding to the electronic seal description data according to the pre-stored seal vector element components includes:
[0090] Determine the target seal vector element component corresponding to the electronic seal description data according to the pre-stored seal vector element component;
[0091] The target seal vector element components are drawn to obtain a target seal vector graphics file corresponding to the electronic seal description data.
[0092] Optionally, the drawing parameters include at least the drawing parameters of the vector graphics and the drawing parameters of the seal, the drawing parameters of the vector graphics include at least the vector graphics width, the vector graphics height and the view area, and the drawing parameters of the seal include at least the attribute information of the seal shape, the attribute information of the text object, the attribute information of the coding object and the attribute information of the central pattern object.
[0093] Optionally, the drawing parameters of the seal also include: attribute information of the attachment object, attribute information of the double rings of the ellipse, and attribute information of the inner ring of the circle.
[0094] Optionally, the target seal vector element component is drawn to obtain a target seal vector graphics file corresponding to the electronic seal description data, including:
[0095] For the target seal vector element component, the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object are drawn in sequence from top to bottom and from left to right to obtain a vector graphics file corresponding to the drawing parameters.
[0096] Some embodiments of the present application, by drawing the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object in order from top to bottom and from left to right, obtain a vector graphics file corresponding to the drawing parameters, thereby improving the accuracy and efficiency of electronic seal image generation.
[0097] Optionally, the method is not only applicable to the drawing of circular seal images, but can also be applied to the drawing of seal images of shapes such as elliptical seals, square seals, triangular seals, and diamond seals.
[0098] Optionally, in the case where the electronic seal image is a circular seal, determining the electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters includes:
[0099] Determine the configuration parameters of the circular border according to the electronic seal image information template, wherein the configuration parameters at least include the coordinates of the center of the circle, the radius of the circle, the color of the circle, the width of the circle, and whether to fill it;
[0100] According to the curvature of the circular border, determine the curvature of each character in the text object;
[0101] According to the arc of each character, determine the total arc length of the text object;
[0102] Calculate the character spacing based on the total arc length, the arc of each character and the number of characters;
[0103] Calculate the font spacing based on the width and height ratio of the text;
[0104] Draw the text object according to the text spacing, font spacing and circular border;
[0105] The double ring object, the inner ring object, the central pattern, the horizontal line, the attachment, and the coding object are drawn in sequence to obtain a vector graphics file corresponding to the drawing parameters.
[0106] Specifically, the embodiment of the present application takes a circular electronic seal as an example, and the specific description is as follows:
[0107] 1) Drawing of circular border:
[0108] The circular border mainly determines the coordinates of the circle center, the radius of the circle, the color of the circle, the width of the circle, and whether to fill it.
[0109] cx, cy: represent the coordinates of the center of the circular seal; r: represents the radius of the circular seal; stroke: represents that the color of the seal is red;
[0110] stroke-width: indicates the width of the circular edge; fill: indicates whether to fill the circular area, such as the following example:
[0111] <circle cx="2250.0000"cy="2250.0000"r="2200.0000"stroke="#00FF00"stroke-width="100.0000"fill="none" / >
[0112] 2) Draw the seal text along the arc
[0113] To draw the seal text along the arc, it is necessary to determine the starting point of the arc path where the seal text is distributed, the end point of the arc, the radius of the arc, the content of the text, the font name, color, font size, and font spacing. The calculation of font spacing is the key factor in ensuring that the text is evenly distributed on the arc.
[0114] The calculation formula for font spacing on the lower arc is described in detail below:
[0115] First, calculate the arc length of each character, such as Figure 8 As shown, line segment AB is the width of the character, r is the radius of the character baseline, and the angle φ can be calculated based on AB and r, and then the arc length of AB can be calculated through φ, thereby obtaining the arc length of each character;
[0116] According to the given parameter, the included angle of the seal body is used to calculate the total arc length of the seal body;
[0117] According to the total arc length, the calculated arc length of each character, and the number of characters in the seal text, the space between characters is calculated, space = (total arc length - arc length of each character × number of characters) / number of spaces;
[0118] The font spacing (litter-spacing) is calculated according to the aspect ratio of the text, where litter-spacing = space / text aspect ratio.
[0119] For example Figure 7The path of the defs node defines an arc path for the seal text. M9323820 indicates the starting point of the arc, 3568 3820 indicates the end point of the arc, and A2050 2050 indicates the radius of the arc. The font-family="simsun" of the text node indicates that the font is Songti, font-size:200.00 indicates the font size, the node value "36.9311" of letter-spacing indicates the font spacing value, and the node value "Beijing Co., Ltd. Test" of the textPath indicates the content of the seal text.
[0120] <defs>
[0121] <path id="path2"d="M932 3820A2050 2050 0 0,0 3568 3820" / >
[0122] < / defs>
[0123] <text font-family="simsun"xml:space="preserve"style="fill:#00FF00;font-size:200.00;font-weight:bolder">
[0124] <textPath xlink:href="#path2"textLength="2936.2021"letter-spacing="36.9311"lengthAdjust="spacingAndGlyphs"> Test of a Beijing Limited Liability Company
[0125]
[0126] Optionally, determining a target electronic seal image corresponding to the drawing parameters according to the target seal vector graphics file includes:
[0127] According to a preset format conversion algorithm, the target seal vector graphics files are converted into target electronic seal images in target formats corresponding to the preset format conversion algorithm. The target electronic seal images in target formats at least include: raster images or layout images.
[0128] Among them, the seal image format conversion and delivery mainly involves format conversion of vector graphics as required. The embodiment of the present application provides three types of format converters. According to the pre-specified target image format, different image converters can be created to respectively realize conversion from vector graphics to raster images (PNG, JPEG or TIFF format), from vector graphics to other vector formats (such as EPS, WMF format, etc.), and from vector graphics to layout formats (such as PDF, OFD format, etc.).
[0129] See the seal image format conversion and delivery process for Fig. 9 .
[0130] [1] Read vector graphics files;
[0131] [2] Convert the target image format to raster format such as PNG, JPEG, etc. as shown in the figure, and create corresponding format converters such as PNGTranscoder, JPEGTranscoder, etc.
[0132] [2'] As shown in the figure, convert the target image format to vector format images such as EPS and WMF, and create corresponding format transcoders, such as EPSTranscoder, WMFTranscoder, etc.;
[0133] [2”] As shown in the figure, convert the target image format to PDF, OFD and other layout formats, and create corresponding format transcoders, such as PDFTranscoder, OFDTranscode, etc.;
[0134] [3] Set the transcoder input and output parameters, respectively set the vector graphics file access path and the conversion target image storage path, and prepare for format conversion;
[0135] [4] Execute transcoding. Execute the converter transcode command to start image conversion;
[0136] [5] Close the input and output streams and the conversion is complete.
[0137] The above processes [2], [2'], and [2”] need to be selected according to the specific target image format. For examples of converted image files, see Fig.10 .
[0138] Some embodiments of the present application convert vector graphics into images of different formats as required, thereby realizing a method for automatically generating complex style seal images. This method is completely implemented using code programming and does not require professional image processing personnel. The cost of seal image generation can be greatly reduced, and the speed of manually making seal images is also multiplied.
[0139] like Figure 2 As shown, the method for generating an electronic seal image provided in the embodiment of the present application includes: a seal template filling process, a seal template parsing process, a seal image drawing process, and a seal image format conversion and delivery process:
[0140] Specifically include:
[0141] Specify / obtain the drawing parameters of the electronic seal image to be drawn, and fill the seal drawing parameters into the drawing sub-templates of various objects in turn, and finally form a complete electronic seal description data
[0142] Parse the electronic seal description data and perform integrity check on the data to ensure data integrity
[0143] Draw vector graphics based on electronic seal description data
[0144] According to the vector graphic file, the vector graphic file is converted into a target stamp image.
[0145] 1. Stamp template filling process
[0146] The upper system fills in data according to the template format provided in the embodiment of the present application. The filling method can be input through the system page and then automatically filled in by the system code, or the upper system directly reads the data from the database and then automatically fills in through system code programming.
[0147] The seal template mainly includes the shape, color, content and layout of the seal image (including the parameter information of the seal frame, the text object, the bottom coding object and) as shown in Table 1:
[0148] Table 1 Seal image information template
[0149]
[0150]
[0151]
[0152] The stamp template filling process is as follows Figure 3 shown.
[0153] [1] Generate object classes of the corresponding programming language through template definition using tools or manual code programming, including: SealInfo, SealShape, SealMainText, bottomCode, centerPattern, horizontalLine, attachmentOne, attachmentTwo, bilateralBox, innerCircle and other object classes. See Table 1 for objects and internal attributes;
[0154] [2] Instantiate the object and assign values according to the target stamp image;
[0155] [3] The object is deserialized to form a string that can be transmitted over the network. The string encoding format is UTF-8.
[0156] An example of a template filled with a circular seal is as follows: Figure 4 As shown, in addition to the above circular seals, the template data formats of elliptical seals, square seals, triangular seals, diamond seals and other shapes can also be realized according to the same idea.
[0157] See the seal template analysis process Figure 5 .
[0158] [1] Load the seal image template string and deserialize the template information into the SealInfo template object, including objects such as SealInfo, SealShape, SealMainText, bottomCode, centerPattern, horizontalLine, attachmentOne, attachmentTwo, bilateralBox, innerCircle and their internal properties. Usually, the string will be deserialized into a dictionary (Map) or object (Object), the array will be deserialized into a list (List) or array (Array), and numbers, Boolean values, etc. will be deserialized into corresponding data types. If the deserialization is successful, proceed to the next step, otherwise, an error message will be fed back to the upper system and the process ends.
[0159] [2] Verify the data integrity according to the seal template regulations. For verification rules, please refer to the "Required" constraint items in Table 1. If the verification passes, proceed to the next step. Otherwise, an error message is fed back to the upper system and the process ends.
[0160] [3] According to the seal template regulations, verify the rationality of the data. For the verification rules, please refer to the "rationality" constraints in Table 1. If the verification passes, proceed to the next step. Otherwise, feedback error information to the upper system and the process ends.
[0161] The seal image drawing process is the process of drawing the data obtained by analyzing the template into vector graphics. The graphics are drawn in the order from outside to inside and from top to bottom.
[0162] See the seal image drawing process Figure 6 .
[0163] [1] Create a vector file and initialize the basic information of the vector graphics model, including version number and encoding format;
[0164] [2] Set the width (width), height (height), view area (viewbox), fill color (fill), stroke information (stroke), etc. of the vector graphic;
[0165] [3] Draw the seal outer border graphics. Draw the seal shape (sealShape), color (sealColor), width (sealWidth), height (sealHeight) and line width (sealStrokeWidth) in the template information and add the element to the file;
[0166] [4] Similarly, repeat step [3] in the order of main text object, double ring object, inner ring object, center pattern, horizontal line, attachment 1, attachment 2, bottom code, etc. until all elements are drawn;
[0167] [5] Save the completed vector graphics file.
[0168] Vector sample data information is available at Figure 7 .
[0169] The vector rendering graphic elements of the embodiment of the present application are rich, and almost any graphic can be rendered using vector trajectories, with good technical scalability; the vector image has higher visual quality and will not be distorted after arbitrary enlargement, reduction and format conversion of the seal image; the vector image uses little resources in the computer's internal processing process, is suitable for computer automation implementation, and has low usage costs.
[0170] Based on the core technology of vector image drawing, the embodiment of the present application also expands the design of seal template filling, seal template parsing, seal image conversion and delivery, etc., and can quickly realize the automatic generation of electronic seal images according to this method. This method can be embedded in the electronic seal system in the form of SDK components, or it can be encapsulated into an electronic seal image generation service, or even form an independent electronic seal image generation system.
[0171] The embodiment of the present application realizes automatic electronic seal image generation by adopting a vector image drawing method. Based on this core design method, a set of processes from seal template filling, seal template parsing to seal vector graphics drawing is designed, and finally the vector graphics are converted into images of different formats according to requirements, thereby realizing a method for automatically generating complex style seal images. The method is completely implemented by code programming, does not require professional image processing personnel, can greatly reduce the cost of seal image generation, and has also been doubled compared to manual seal image production.
[0172] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any combination without conflict, and this application is not limited thereto.
[0173] Another embodiment of the present application provides a device for generating an electronic seal image, which is used to execute the method for generating an electronic seal image provided in the above embodiment.
[0174] like Fig.11 , which is a schematic diagram of the structure of the electronic seal image generation device provided in the embodiment of the present application. The electronic seal image generation device includes an acquisition module 1101, a first determination module 1102, a second determination module 1103, a drawing module 1104 and a conversion module 1105, wherein:
[0175] The acquisition module 1101 is used to acquire the drawing parameters of the electronic seal image to be drawn;
[0176] The first determining module 1102 is used to determine the target electronic seal image information template corresponding to the drawing parameters according to the drawing parameters and the pre-stored electronic seal image information template;
[0177] The second determining module 1103 is used to determine the electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters;
[0178] The drawing module 1104 is used to determine the target seal vector graphics file corresponding to the electronic seal description data according to the pre-stored seal vector element components;
[0179] The conversion module 1105 is used to determine a target electronic seal image corresponding to the drawing parameters according to the target seal vector graphics file.
[0180] Some embodiments of the present application use vector graphics drawing technology to draw electronic seal graphics, which has the advantages of high visual quality of drawn graphics, not easy to deform, and low consumption of computer resources. It can quickly and accurately generate electronic seal images, reduce manpower consumption, and improve the accuracy and efficiency of electronic seal image generation.
[0181] Another embodiment of the present application further supplements the description of the device for generating the electronic seal image provided in the above embodiment.
[0182] Optionally, the drawing module is used to:
[0183] Determine the target seal vector element component corresponding to the electronic seal description data according to the pre-stored seal vector element component;
[0184] The target seal vector element components are drawn to obtain a target seal vector graphics file corresponding to the electronic seal description data.
[0185] Optionally, the drawing parameters include at least drawing parameters of the vector graphics and drawing parameters of the seal, the drawing parameters of the vector graphics include at least vector graphics width, vector graphics height and view area, and the drawing parameters of the seal include at least attribute information of the seal shape, attribute information of the text object, attribute information of the coding object and attribute information of the central pattern object. Some embodiments of the present application can pre-set the drawing parameters of the vector graphics and the drawing parameters of the seal, which can be set according to user needs.
[0186] Optionally, a drawing module is used to:
[0187] According to the electronic seal image information template, the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object are drawn in sequence from top to bottom and from left to right to obtain a vector graphics file corresponding to the drawing parameters.
[0188] Some embodiments of the present application, by drawing the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object in order from top to bottom and from left to right, obtain a vector graphics file corresponding to the drawing parameters, thereby improving the accuracy and efficiency of electronic seal image generation.
[0189] Optionally, the second determining module is used to:
[0190] Determine the configuration parameters of the circular border according to the electronic seal image information template, wherein the configuration parameters at least include the coordinates of the center of the circle, the radius of the circle, the color of the circle, the width of the circle, and whether to fill it;
[0191] According to the curvature of the circular border, determine the curvature of each character in the text object;
[0192] According to the arc of each character, determine the total arc length of the text object;
[0193] Calculate the character spacing based on the total arc length, the arc of each character and the number of characters;
[0194] Calculate the font spacing based on the width and height ratio of the text;
[0195] Draw the text object according to the text spacing, font spacing and circular border;
[0196] The double ring object, the inner ring object, the central pattern, the horizontal line, the attachment, and the coding object are drawn in sequence to obtain electronic seal description data corresponding to the drawing parameters.
[0197] Optionally, a conversion module is used to:
[0198] According to a preset format conversion algorithm, the target seal vector graphics files are converted into target electronic seal images in target formats corresponding to the preset format conversion algorithm. The target electronic seal images in target formats at least include: raster images or layout images.
[0199] Some embodiments of the present application convert vector graphics into images of different formats as required, thereby realizing a method for automatically generating complex style seal images. This method is completely implemented using code programming and does not require professional image processing personnel. The cost of seal image generation can be greatly reduced, and the speed of manually making seal images is also multiplied.
[0200] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0201] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any combination without conflict, and this application is not limited thereto.
[0202] The embodiments of the present application also provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the operation of the method corresponding to any embodiment of the method for generating an electronic seal image provided in the above embodiments can be implemented.
[0203] An embodiment of the present application further provides a computer program product, which includes a computer program, wherein when the computer program is executed by a processor, it can implement the operations corresponding to the method of any embodiment of the method for generating an electronic seal image provided in the above embodiments.
[0204] like Fig.12 As shown, some embodiments of the present application provide an electronic device 1200, which includes: a memory 1210, a processor 1220, and a computer program stored in the memory 1210 and executable on the processor 1220, wherein the processor 1220 can implement any of the methods of the above-mentioned method for generating an electronic seal image when reading the program from the memory 1210 through a bus 1230 and executing the program.
[0205] Processor 1220 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 1220 can be a microprocessor.
[0206] The memory 1210 may be used to store instructions executed by the processor 1220 or data related to the execution of instructions. These instructions and / or data may include codes for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 1220 of the disclosed embodiment may be used to execute instructions in the memory 1210 to implement the method shown above. The memory 1210 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memory known to those skilled in the art.
[0207] The above are only embodiments of the present application and are not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0208] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0209] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A method for generating an electronic seal image, characterized in that: The method comprises: Obtaining drawing parameters of the electronic seal image to be drawn; Determining a target electronic seal image information template corresponding to the drawing parameters according to the drawing parameters and a pre-stored electronic seal image information template; Determining electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters; Determining a target seal vector graphics file corresponding to the electronic seal description data according to the pre-stored seal vector element components; According to the target seal vector graphics file, a target electronic seal image corresponding to the drawing parameters is determined.
2. The method for generating an electronic seal image according to claim 1, characterized in that: The step of determining a target seal vector graphic file corresponding to the electronic seal description data according to the pre-stored seal vector element components comprises: Determining a target seal vector element component corresponding to the electronic seal description data according to the pre-stored seal vector element components; The target seal vector element component is drawn to obtain a target seal vector graphics file corresponding to the electronic seal description data.
3. The method for generating an electronic seal image according to claim 1, characterized in that: The drawing parameters include at least the drawing parameters of the vector graphics and the drawing parameters of the seal. The drawing parameters of the vector graphics include at least the vector graphics width, the vector graphics height and the view area. The drawing parameters of the seal include at least the attribute information of the seal shape, the attribute information of the text object, the attribute information of the coding object and the attribute information of the central pattern object.
4. The method for generating an electronic seal image according to claim 2, characterized in that: The step of drawing the target seal vector element component to obtain a target seal vector graphics file corresponding to the electronic seal description data includes: For the target seal vector element component, the main text object, double ring object, inner ring object, central pattern, horizontal line, attachment, and coding object are drawn in sequence from top to bottom and from left to right to obtain a vector graphics file corresponding to the drawing parameters.
5. The method for generating an electronic seal image according to claim 4, characterized in that: In the case where the electronic seal image is a circular seal, the step of determining the electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters includes: Determine the configuration parameters of the circular border according to the electronic seal image information template, wherein the configuration parameters at least include the coordinates of the center of the circle, the radius of the circle, the color of the circle, the width of the circle, and whether to fill it; Determine the curvature of each character in the text object according to the curvature of the circular border; Determine the total arc length of the text object according to the arc of each character; Calculate the character spacing according to the total arc length, the arc of each character and the number of characters; Calculate the font spacing based on the width and height ratio of the text; Drawing a text object according to the character spacing, the font spacing and the circular border; The double ring object, the inner ring object, the central pattern, the horizontal line, the attachment, and the coded object are drawn in sequence to obtain electronic seal description data corresponding to the drawing parameters.
6. The method for generating an electronic seal image according to claim 1, characterized in that: The step of determining a target electronic seal image corresponding to the drawing parameters according to the target seal vector graphics file includes: According to a preset format conversion algorithm, the target seal vector graphics files are respectively converted into target electronic seal images in a target format corresponding to the preset format conversion algorithm, wherein the target electronic seal images in the target format at least include: a raster image or a layout image.
7. A device for generating an electronic seal image, characterized in that: The device comprises: An acquisition module, used for acquiring drawing parameters of the electronic seal image to be drawn; A first determining module, used for determining a target electronic seal image information template corresponding to the drawing parameters according to the drawing parameters and a pre-stored electronic seal image information template; A second determining module is used to determine the electronic seal description data corresponding to the drawing parameters according to the target electronic seal image information template and the drawing parameters; A drawing module, used for determining a target seal vector graphics file corresponding to the electronic seal description data according to pre-stored seal vector element components; The conversion module is used to determine the target electronic seal image corresponding to the drawing parameters according to the target seal vector graphics file.
8. The electronic seal image generating device according to claim 7, characterized in that: The drawing module is used for: Determining a target seal vector element component corresponding to the electronic seal description data according to the pre-stored seal vector element components; The target seal vector element component is drawn to obtain a target seal vector graphics file corresponding to the electronic seal description data.
9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for generating an electronic seal image as claimed in any one of claims 1 to 6 can be implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the program is executed by a processor, the method for generating an electronic seal image as described in any one of claims 1 to 6 can be implemented.