Intelligent image generation method and system based on dynamic template
By using a dynamic template-based intelligent image generation method, an object node tree is constructed using vector and structured data to achieve adaptive rendering of text and images. This solves the problems of text truncation and image distortion in existing technologies and achieves high-quality adaptive typesetting effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU TAIDONG TECH CO LTD
- Filing Date
- 2026-02-09
- Publication Date
- 2026-05-05
AI Technical Summary
Existing image generation methods are prone to text truncation and image distortion when faced with diverse user needs, making it impossible to achieve high-quality adaptive typesetting.
By constructing an intelligent image generation method based on dynamic templates, an object node tree is built using vector data and structured data. Combined with variable mapping tables and adaptive constraint rules, adaptive rendering of text and images is achieved, including intelligent font size adjustment of text and affine transformation matrix calculation of images.
It achieves high-quality adaptive layout of text and images, avoiding text truncation and image distortion, ensuring that the finished image does not require manual adjustment and achieves the effect of a professional designer's manual cropping.
Smart Images

Figure CN121982154A_ABST
Abstract
Description
Technical Field
[0001] This invention generally relates to the field of image processing technology. More specifically, this invention relates to an intelligent image generation method and system based on dynamic templates. Background Technology
[0002] With the rapid development of mobile internet, e-commerce, and digital marketing technologies, the form of information dissemination has shifted from simple text to highly visually impactful multimedia formats of text and images. In scenarios such as e-commerce promotions, social media operations, and personalized advertising, in order to capture user attention and improve conversion rates, businesses are experiencing exponential growth in demand for high-quality, diverse, and targeted marketing visual materials.
[0003] To cope with the massive demand for graphic design, existing image production methods have mainly gone through two stages: the first is the manual design mode based on professional design software (such as Adobe Photoshop). Although this mode produces high-quality images, it is highly dependent on the designer's personal experience, has low production efficiency, and cannot meet the needs of large-scale concurrency. The second is the automated generation mode based on fixed templates. This mode uses a pre-set fixed layer structure and a program to replace business data (such as product names and images) in the specified positions of the template, thereby realizing the batch production of materials.
[0004] However, in photo editing or poster creation, when the title entered by the user is long, the text is often cut off or exceeds the border; when the aspect ratio of the image uploaded by the user (such as a portrait photo) is inconsistent with the template slots (such as a landscape frame), the image is often forcibly stretched and deformed or the core subject (such as a face or product) is incorrectly cropped out. Summary of the Invention
[0005] To address the technical problems of easily distorted and misaligned generated images, the present invention provides solutions in the following aspects.
[0006] In a first aspect, an intelligent image generation method based on dynamic templates includes: responding to receiving an image generation request including source material image data; obtaining a target template identifier and a business data set based on the source material image data; obtaining vector data and structured data from a preset database based on the target template identifier; constructing an object node tree using the vector data; and obtaining dynamic rendering control data using the structured data; wherein the object node tree includes multiple vector layer nodes, each vector layer node including a unique identifier, an element label, and a set of rendering attributes, the set of rendering attributes including: a geometric attribute field for recording initial coordinates and dimensions, a font attribute field for recording text styles, and a transformation attribute field for recording spatial transformation parameters; the dynamic rendering control data includes a variable mapping table and an adaptive constraint rule set; mapping the business data set to each vector layer node in the object node tree according to the variable mapping table to generate a document structure to be rendered; calculating the rendering size of each vector layer node in the document structure to be rendered according to the adaptive constraint rule set, and correcting the geometric attribute fields of each vector layer node according to the rendering size of each vector layer node to obtain a target document structure; and converting the target document structure into a bitmap data stream and outputting it.
[0007] Preferably, obtaining the target template identifier includes: performing feature extraction on the source material data to obtain the geometric feature parameters and content semantic tags of the source material data; calculating the comprehensive matching score between the source material data and each candidate template in the preset database; determining the unique identifier of the candidate template with the highest comprehensive matching score as the target template identifier; obtaining the business data set includes: encapsulating the source material image data into a preset general key-value pair structure to obtain the business data set, wherein the general key-value pair structure includes a main content field key name pointing to the source material image data.
[0008] Preferably, each candidate template in the database is configured with applicable scene tags and historical rendering performance normalization values. The formula for calculating the comprehensive matching score between the source material data and the candidate templates in the preset database is as follows: ,in The overall matching score is... The aspect ratio of the main image region in the candidate template. The aspect ratio of the main image in the source material data. The number of overlaps between the applicable scenario tags of the candidate template and the semantic tags of the source material. The total number of duplicate application scenario tags and semantic tags of the source material for the candidate template. This is the normalized value of the historical rendering performance of the candidate template. ω 1. ω 2 and γ All of these are preset weighting coefficients.
[0009] Preferably, constructing an object node tree using the vector data includes: parsing the vector data to obtain multiple layer element labels and the nesting hierarchy between each layer element label; constructing an object node tree topology with a parent-child index structure based on the nesting hierarchy between each layer element label; wherein the layer element label includes the layer's position coordinates, outline size, and visual style attributes; and mapping and storing the layer element label as geometric attribute fields of the corresponding vector layer nodes in the object node tree.
[0010] Preferably, obtaining dynamic rendering control data through the structured data includes: parsing the structured data to obtain variable binding configuration items and layout adaptation parameter items; constructing an index relationship between business field names and unique identifiers of graphic object nodes based on the variable binding configuration items to obtain the variable mapping table; obtaining geometric threshold parameters and corresponding deformation strategy instructions based on the layout adaptation parameter items, and instantiating the geometric threshold parameters and corresponding deformation strategy instructions into the adaptive constraint rule set used to control the dynamic behavior of vector layer nodes.
[0011] Preferably, mapping the business data set to each vector layer node in the object node tree according to the variable mapping table to generate the document structure to be rendered includes: traversing each vector layer node in the object node tree to obtain a unique identifier for each vector layer node; searching the variable mapping table for a target business field name corresponding to the unique identifier; if it exists, extracting the corresponding business data content from the business data set using the target business field name as the index key; and binding the business data content to the vector layer node to obtain the document structure to be rendered.
[0012] Preferably, correcting the geometric attribute field of a vector layer node based on its rendering size includes: determining the type of the vector layer node, wherein the type of the vector layer node is text or image; in response to the vector layer node being text, measuring the original rendering width based on the text content of the vector layer node, and calculating a target scaling font size when the original rendering width exceeds the container threshold in the adaptive constraint rule set, and updating the font attribute field of the vector layer node using the target scaling font size; in response to the vector layer node being text, calculating an affine transformation matrix based on the aspect ratio and salient region center of the image resource of the vector layer node, and applying the affine transformation matrix to the transformation attribute field of the vector layer node.
[0013] Preferably, the formula for calculating the target scaled font size is:
[0014] .
[0015] in Scale the font size for the target. This refers to the initial font size in the font attribute field of the vector layer node before the update. The threshold value for the container. For the preset safety inner margin, The default original rendering width. This is the preset buffer coefficient.
[0016] Preferably, calculating the affine transformation matrix includes: calculating the minimum scaling factor K, where the calculation formula is: .
[0017] The width of the main image region in the candidate template. The height of the main image region in the candidate template, The width of the source image, The height of the source image is given; the constrained alignment offset of the center of the salient region in the horizontal direction is calculated. And the initial alignment offset in the vertical direction, where the calculation formula is: ; ; The horizontal coordinates of the center of the salient region. The vertical coordinates of the center of the salient region; Construct an affine transformation matrix, where the affine transformation matrix M satisfies: .
[0018] In a second aspect, a dynamic template-based intelligent image generation system includes a processor and a memory, the memory storing a computer program, the processor executing the computer program to implement the dynamic template-based intelligent image generation method as described in any of the above-described inventions.
[0019] The beneficial effects of this invention are as follows: This invention pre-measures the actual rendered width of the filled text at the current font size. Once the text width is detected to exceed the container's allowed threshold, the system automatically triggers a font size scaling strategy. Instead of mechanically truncating the text, it intelligently calculates a smaller target font size based on the ratio between the actual text length and the container's available width. At the same time, it retains preset safety margins to ensure that the text is displayed completely without being too close to the edges, maintaining the layout's breathing room and aesthetic appeal.
[0020] This invention utilizes affine transformation technology to calculate the optimal scaling ratio and translation distance before filling the image, constructing an intelligent alignment strategy that ensures the core subject is always locked in the center of the template viewport regardless of the source image size, and that the image fills the entire viewport. This avoids black borders or stretching distortion caused by mismatched image proportions, and eliminates the phenomenon of missing subjects, achieving a visual effect similar to manual cropping by a professional designer.
[0021] This invention solves the technical problem that existing fixed templates are prone to text truncation and image distortion when replacing content, and achieves high-quality adaptive layout of text and image content, ensuring that the finished image does not require manual secondary adjustment. Attached Figure Description
[0022] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent upon reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not limitation, and like or corresponding reference numerals denote like or corresponding parts, wherein: Figure 1 This is a schematic flowchart illustrating the steps of an intelligent image generation method based on a dynamic template according to an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the structural block diagram of the intelligent image generation system based on dynamic templates according to this embodiment. Detailed Implementation
[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0025] Figure 1 This is a schematic flowchart illustrating the steps of an intelligent image generation method based on a dynamic template according to an embodiment of the present invention.
[0026] like Figure 1 As shown, the intelligent image generation method based on dynamic templates includes steps S1 to S5.
[0027] Step S1: In response to receiving an image generation request including source material image data, obtain a target template identifier and a set of business data based on the source material image data; and obtain vector data and structured data from a preset database based on the target template identifier. In one embodiment, obtaining the target template identifier includes: performing feature extraction on the source material data to obtain geometric feature parameters and content semantic tags of the source material data; calculating the comprehensive matching score between the source material data and each candidate template in a preset database; and determining the unique identifier of the candidate template with the highest comprehensive matching score as the target template identifier. Obtaining the business data set includes: encapsulating the source material image data into a preset general key-value pair structure to obtain the business data set, wherein the general key-value pair structure includes a main content field key name pointing to the source material image data.
[0028] It's important to note that feature extraction refers to the in-depth analysis of source material using computer vision techniques. "Geometric feature parameters" primarily refer to the physical properties of the image, such as resolution (width × height), dominant color distribution, image sharpness, and most importantly, aspect ratio. The aspect ratio determines the basic composition of the template; for example, forcibly adapting a horizontally composed image to a vertically composed template will result in severe cropping or excessive white space. "Content semantic tags," on the other hand, are generated by using deep learning models (such as Convolutional Neural Networks (CNNs) or multimodal pre-trained models like CLIP) to identify image content and output tags such as "landscape," "food," "portrait," "promotion," and "tech-savvy." These tags will be used for subsequent semantic alignment with the template's applicable scenarios.
[0029] Encapsulating the data into a pre-defined, generic key-value pair structure is a standardized data preprocessing step. Since the subsequent rendering process is based on a variable mapping table (i.e., finding the value by the key), and the original input is only a single image data file (RawData) lacking key indexes, the system must manually wrap it into a JSON object or Map structure. This ensures that the subsequent generic population logic can handle both user-specified and system-recommended templates without distinction, guaranteeing consistency in the data flow interface and preventing program exceptions caused by differences in data structures.
[0030] In one embodiment, each candidate template in the database is configured with applicable scene tags and historical rendering performance normalization values. The formula for calculating the comprehensive matching score between the source material data and the candidate templates in the preset database is as follows: ,in The overall matching score is... The aspect ratio of the main image region in the candidate template. The aspect ratio of the main image in the source material data. The number of overlaps between the applicable scenario tags of the candidate template and the semantic tags of the source material. The total number of duplicate application scenario tags and semantic tags of the source material for the candidate template. This is the normalized value of the historical rendering performance of the candidate template. ω 1. ω 2 and γ All of these are preset weighting coefficients.
[0031] It should be noted that the main image area in the candidate template is a viewport or container specifically reserved by the designer in the pre-set template file to display the core visual content. In vector data, the main image area in the candidate template is represented as a rectangle with fixed coordinates and a fixed size. The main image in the source material data is either the user-uploaded source material image data itself, or the core subject area determined after saliency testing. The historical rendering performance normalization value is usually calculated manually; this value represents the candidate template's overall performance score in past business operations. In one embodiment, the historical rendering performance normalization value is a weighted calculation and normalized (mapped to the 0-1 range) of business metrics such as click-through rate, usage frequency, and conversion rate, representing the market popularity of the candidate template.
[0032] Step S2: Construct an object node tree using the vector data, and obtain dynamic rendering control data using the structured data.
[0033] The object node tree includes multiple vector layer nodes. Each vector layer node includes a unique identifier, an element label, and a set of rendering attributes. The set of rendering attributes includes: a geometric attribute field for recording initial coordinates and dimensions, a font attribute field for recording text style, and a transformation attribute field for recording spatial transformation parameters.
[0034] In one embodiment, constructing an object node tree using the vector data includes: parsing the vector data to obtain multiple layer element labels and the nesting hierarchy between the layer element labels; constructing an object node tree topology with a parent-child index structure based on the nesting hierarchy between the layer element labels; wherein the layer element labels include the layer's position coordinates, outline size, and visual style attributes; and mapping and storing the layer element labels as geometric attribute fields of the corresponding vector layer nodes in the object node tree.
[0035] It's important to note that vector data refers to graphic description files stored in XML format (such as SVG). Unlike bitmaps, it records instructions for "drawing circles" or "drawing lines" rather than individual pixels, thus allowing for infinite scaling without distortion. Layer element tags are specific code snippets within vector data, such as... <rect>(rectangle), <text>(text), (Images), etc. These are the basic atomic units that make up a picture.
[0036] The object node tree topology is a tree-like data structure (similar to the DOM tree) built in computer memory that reflects the parent-child containment relationships between layers. "Topology" emphasizes the connections and hierarchical relationships between nodes. Geometric attribute fields are variables in the memory object used to store values such as node position, size, and rotation angle. Modifying the screen essentially involves reading and writing values to these fields.
[0037] In one embodiment, obtaining dynamic rendering control data through the structured data includes: parsing the structured data to obtain variable binding configuration items and layout adaptation parameter items; constructing an index relationship between business field names and unique identifiers of graphic object nodes based on the variable binding configuration items to obtain the variable mapping table; obtaining geometric threshold parameters and corresponding deformation strategy instructions based on the layout adaptation parameter items, and instantiating the geometric threshold parameters and corresponding deformation strategy instructions into the adaptive constraint rule set for controlling the dynamic behavior of vector layer nodes.
[0038] It should be noted that structured data is a JSON-formatted configuration file that exists alongside vector data and is used to describe business logic. Variable binding configuration items are the data-layer mapping rules defined in the configuration file. Layout adaptation parameters are the constraint thresholds and strategies set in the configuration file.
[0039] The adaptive constraint rule set is a set of logical checkers generated in memory after parsing the above parameter items. It is an executable program logic unit that can determine in real time whether a node violates the rules (such as whether the text exceeds the limit) and trigger the corresponding correction algorithm.
[0040] Step S3: The dynamic rendering control data includes a variable mapping table and an adaptive constraint rule set; the business data set is mapped to each vector layer node in the object node tree according to the variable mapping table to generate the document structure to be rendered.
[0041] In one embodiment, mapping the business data set to each vector layer node in the object node tree according to the variable mapping table to generate the document structure to be rendered includes: traversing each vector layer node in the object node tree to obtain a unique identifier for each vector layer node; searching the variable mapping table for a target business field name corresponding to the unique identifier; if it exists, extracting the corresponding business data content from the business data set using the target business field name as the index key; and binding the business data content to the vector layer node to obtain the document structure to be rendered.
[0042] It's important to note that the variable mapping table is a hash table maintained in memory by the system, creating a fast index from business field names to unique node identifiers. The variable mapping table serves as a navigation graph for data injection. The target business field name is a string used as the index key in the variable mapping table. The business data content is the specific value extracted from the business data set and to be filled into the template. For text-based vector layer nodes, it's a string; for image-based vector layer nodes, the business data content is the URL address or binary stream handle of the image resource.
[0043] Step S4: Calculate the rendering size of each vector layer node in the document structure to be rendered according to the adaptive constraint rule set, and correct the geometric attribute fields of each vector layer node according to the rendering size of each vector layer node to obtain the target document structure.
[0044] In one embodiment, modifying the geometric attribute field of a vector layer node based on its rendering size includes: determining the type of the vector layer node, wherein the type of the vector layer node is text or image; in response to the vector layer node being text, measuring the original rendering width based on the text content of the vector layer node, and calculating a target scaling font size when the original rendering width exceeds the container threshold in the adaptive constraint rule set, and updating the font attribute field of the vector layer node using the target scaling font size; in response to the vector layer node being text, calculating an affine transformation matrix based on the aspect ratio and salient region center of the image resource of the vector layer node, and applying the affine transformation matrix to the transformation attribute field of the vector layer node.
[0045] It's important to note that rendering size refers to the actual screen pixel width and height occupied by a node after it has been populated with new business data (such as long text or a new image), under the current style settings. The container threshold is the maximum display area limit (usually the maximum width or height) preset by the designer for this node. The saliency region center is the geometric center coordinate of the region of greatest interest to the human eye (such as a face or product subject) in an image, identified by computer vision algorithms (saliency detection). The affine transformation matrix is a 3x3 mathematical matrix that, through matrix multiplication, can perform translation, scaling, and rotation operations on an image in one operation; it is the core mathematical tool for geometric transformations in graphics rendering engines.
[0046] In one embodiment, the formula for calculating the target scaled font size is: .
[0047] in Scale the font size for the target. This refers to the initial font size in the font attribute field of the vector layer node before the update. The threshold value for the container. For the preset safety inner margin, The default original rendering width. This is the preset buffer coefficient.
[0048] It's important to note that the target scaling font size is the calculated optimal font size that allows the text content to fit completely within the container without overflowing. Safe padding is the total blank area (left margin + right margin) reserved to prevent text from touching the container edges. The buffer factor is a correction factor greater than 0 and less than 1. The buffer factor's purpose is to further refine the font within the theoretically calculated range, eliminating the risk of edge overlap caused by font rendering engine precision errors.
[0049] In one embodiment, calculating the affine transformation matrix includes: calculating the minimum scaling factor K, wherein the calculation formula is: .
[0050] The width of the main image region in the candidate template. The height of the main image region in the candidate template, The width of the source image, The height of the source image is given; the constrained alignment offset of the center of the salient region in the horizontal direction is calculated. And the initial alignment offset in the vertical direction, where the calculation formula is: ; ; The horizontal coordinates of the center of the salient region. The vertical coordinates of the center of the salient region; Construct an affine transformation matrix, where the affine transformation matrix M satisfies: .
[0051] It should be noted that the minimum scaling factor is the minimum magnification / reduction factor required for the source image to completely cover the target viewport without leaving black borders. The minimum scaling factor is determined by the larger of the width-to-width and height-to-height ratios. The constrained alignment offset is the amount of displacement required to move the salient center of the source image to the center of the viewport.
[0052] Step S5: Convert the target document structure into a bitmap data stream and output it.
[0053] In one embodiment, converting the target document structure into a bitmap data stream includes: selecting an appropriate rendering kernel from a preset rendering kernel pool according to the output instruction in the image generation request, the rendering kernel pool including rendering kernels based on headless browsers and rendering kernels based on the system's underlying graphics library; serializing the target document structure into a data stream in a general vector graphics format and loading it into the rendering kernel; calling the rendering kernel's drawing interface to perform rasterization processing based on the vector description information in the target document structure to generate pixel buffer data; and encoding and compressing the pixel buffer data according to the resolution and encoding format specified in the output instruction to obtain the bitmap data stream and output it.
[0054] It's important to note that the process of solidifying the logical structure in memory into a user-visible image involves rasterization and encoding. For complex templates containing advanced CSS effects (such as filters and blending modes), the system can intelligently select a headless browser-based kernel to ensure the rendering effect is completely consistent with the front-end design. For simple templates prioritizing speed, a kernel based on low-level graphics libraries like Skia, Cairo, or GDI+ can be selected to reduce system memory overhead. Serialization converts the object node tree in memory back into a standard format string that the rendering engine can recognize. Rasterization is the physical implementation step of image generation. The rendering kernel calculates the RGBA color value of each physical pixel on the canvas based on the geometric instructions in the serialized data and fills it into the pixel buffer in memory. At this stage, the data is uncompressed raw bitmap data, which is usually quite large. Depending on the user's needs, the massive pixel data is encoded and compressed into common formats such as JPG, PNG, and WebP. The bitmap data stream generated in this step can be directly written to disk to generate an image file, or it can be returned to the client as a stream via HTTP response, marking the completion of the closed loop of the intelligent image generation process.
[0055] Figure 2 This is a schematic diagram illustrating the structural block diagram of the intelligent image generation system based on dynamic templates according to this embodiment.
[0056] This invention also provides an intelligent image generation system based on dynamic templates. For example... Figure 2 As shown, the system includes a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement the intelligent image generation method based on dynamic templates according to the first aspect of the present invention.
[0057] The system also includes other components well known to those skilled in the art, such as communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.
[0058] In this invention, the aforementioned memory can be any tangible medium containing or storing a program that can be used or combined with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc., or any other medium that can be used to store desired information and can be accessed by an application, module, or both. Any such computer storage medium can be part of a device or accessible to or connected to a device. Any application or module described in this invention can be implemented using computer-readable / executable instructions that can be stored or otherwise maintained by such a computer-readable medium.
[0059] In the description of this specification, "multiple" and "several" mean at least two, such as two, three or more, unless otherwise explicitly specified.
[0060] While this specification has shown and described numerous embodiments of the invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention. It should be understood that various alternatives to the embodiments of the invention described herein may be employed in the practice of this invention.< / text> < / rect>
Claims
1. A method for intelligent image generation based on dynamic templates, characterized in that, include: In response to receiving an image generation request including source material image data, a target template identifier and a set of business data are obtained based on the source material image data; Vector data and structured data are obtained from a preset database based on the target template identifier; an object node tree is constructed using the vector data, and dynamic rendering control data is obtained using the structured data; wherein, the object node tree includes multiple vector layer nodes, and each vector layer node includes a unique identifier, an element label, and a set of rendering attributes, the set of rendering attributes including: a geometric attribute field for recording initial coordinates and dimensions, a font attribute field for recording text style, and a transformation attribute field for recording spatial transformation parameters; the dynamic rendering control data includes a variable mapping table and an adaptive constraint rule set; The business data set is mapped to each vector layer node in the object node tree according to the variable mapping table to generate the document structure to be rendered. The rendering size of each vector layer node in the document structure to be rendered is calculated based on the adaptive constraint rule set, and the geometric attribute fields of each vector layer node are corrected according to the rendering size of each vector layer node to obtain the target document structure; the target document structure is then converted into a bitmap data stream and output.
2. The intelligent image generation method based on dynamic templates according to claim 1, characterized in that, Obtaining the target template identifier includes: extracting features from the source material data to obtain geometric feature parameters and content semantic tags of the source material data; calculating the comprehensive matching score between the source material data and each candidate template in the preset database; and determining the unique identifier of the candidate template with the highest comprehensive matching score as the target template identifier. Obtaining the business data set includes: encapsulating the source material image data into a preset general key-value pair structure to obtain the business data set, wherein the general key-value pair structure includes a main content field key name pointing to the source material image data.
3. The intelligent image generation method based on dynamic templates according to claim 2, characterized in that, Each candidate template in the database is configured with applicable scene tags and historical rendering performance normalization values. The formula for calculating the comprehensive matching score between the source material data and the candidate templates in the preset database is as follows: , The overall matching score is... The aspect ratio of the main image region in the candidate template. The aspect ratio of the main image in the source material data. The number of overlaps between the applicable scenario tags of the candidate template and the semantic tags of the source material. The total number of duplicate application scenario tags and semantic tags of the source material for the candidate template. This is the normalized value of the historical rendering performance of the candidate template. ω 1. ω 2 and γ All of these are preset weighting coefficients.
4. The intelligent image generation method based on dynamic templates according to claim 1, characterized in that, Constructing an object node tree using the vector data includes: The vector data is parsed to obtain multiple layer element labels and the nesting hierarchy between the layer element labels; an object node tree topology with a parent-child index structure is constructed based on the nesting hierarchy between the layer element labels; wherein the layer element labels include the layer's position coordinates, outline size, and visual style attributes; The layer element labels are mapped and stored as geometric attribute fields of the corresponding vector layer nodes in the object node tree.
5. The intelligent image generation method based on dynamic templates according to claim 1, characterized in that, Obtaining dynamic rendering control data through the structured data includes: The structured data is parsed to obtain variable binding configuration items and layout adaptation parameter items; The variable mapping table is obtained by constructing an index relationship between business field names and unique identifiers of graphical object nodes based on the variable binding configuration items; geometric threshold parameters and corresponding deformation strategy instructions are obtained based on the layout adaptation parameter items, and the geometric threshold parameters and corresponding deformation strategy instructions are instantiated into the adaptive constraint rule set used to control the dynamic behavior of vector layer nodes.
6. The intelligent image generation method based on dynamic templates according to claim 1, characterized in that, Based on the variable mapping table, the business data set is mapped to each vector layer node in the object node tree, generating the document structure to be rendered, including: Traverse each vector layer node in the object node tree to obtain the unique identifier of the vector layer node; Search the variable mapping table to see if there is a target business field name corresponding to the unique identifier; if it exists, extract the corresponding business data content from the business data set using the target business field name as the index key. The business data content is bound to the vector layer node to obtain the document structure to be rendered.
7. The intelligent image generation method based on dynamic templates according to claim 1, characterized in that, The geometric attribute fields of a vector layer node are adjusted based on its rendering size. Determine the type of the vector layer node, wherein the type of the vector layer node is text or image; In response to the vector layer node being of type text, the original rendering width is measured based on the text content of the vector layer node. When the original rendering width exceeds the container threshold in the adaptive constraint rule set, the target scaling font size is calculated, and the font attribute field of the vector layer node is updated using the target scaling font size. In response to the vector layer node being of type text, an affine transformation matrix is calculated based on the aspect ratio and salient region center of the image resource of the vector layer node, and the affine transformation matrix is applied to the transformation attribute field of the vector layer node.
8. The intelligent image generation method based on dynamic templates according to claim 7, characterized in that, The formula for calculating the target scaled font size is: ; in Scale the font size for the target. This refers to the initial font size in the font attribute field of the vector layer node before the update. The threshold value for the container. For the preset safety inner margin, The preset original rendering width, This is the preset buffer coefficient.
9. The intelligent image generation method based on dynamic templates according to claim 7, characterized in that, Calculating the affine transformation matrix includes: Calculate the minimum scaling factor K, where the formula is: ; The width of the main image region in the candidate template. The height of the main image region in the candidate template, The width of the source image, The height of the source image; Calculate the constrained alignment offset of the center of the salient region in the horizontal direction. And the initial alignment offset in the vertical direction, where the calculation formula is: ; ; The horizontal coordinates of the center of the salient region. The vertical coordinates of the center of the salient region; Construct an affine transformation matrix, where the affine transformation matrix M satisfies: .
10. An intelligent image generation system based on dynamic templates, comprising a processor and a memory, characterized in that, The memory stores a computer program, and the processor executes the computer program to implement the intelligent image generation method based on dynamic templates as described in any one of claims 1-9.