Image processing template processing method and apparatus, and device, storage medium and product
By automatically adjusting and filling images and text, the problem of low-efficiency image processing template generation is solved, efficient automatic template generation is achieved, and human resource consumption is reduced.
Patent Information
- Application Number
- PCT/CN2024/115682
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-31
- Filing Date
- 2024-08-30
- Publication Date
- 2025-03-06
Smart Images

Figure CN2024115682_06032025_PF_FP_ABST
Abstract
Description
Image processing template processing method, device, equipment, storage medium and product
[0001] This application claims priority to Chinese Patent Application No. 202311121247.4 filed on August 31, 2023, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] The embodiments of the present disclosure relate to an image processing template processing method, apparatus, device, storage medium and product. Background Art
[0003] Image processing is a form of visual communication and is widely used in marketing, promotion, and other scenarios. For example, in poster design, some internet platforms provide image processing templates to quickly create posters. Users can create posters by replacing images and text in these templates.
[0004] In related technologies, image processing templates are generally designed and generated by designers based on their experience and actual needs. The generation efficiency of image processing templates is often low and consumes a lot of human resources.
[0005] Summary of the Invention
[0006] Embodiments of the present disclosure provide a method, apparatus, device, storage medium, and product for generating an image processing template.
[0007] In a first aspect, an embodiment of the present disclosure provides a method for generating an image processing template, comprising:
[0008] Acquire an image to be filled, and determine a first filling area of the image to be filled in a preset canvas;
[0009] Filling the image to be filled into the preset canvas based on the first filling area to obtain a filled canvas;
[0010] Acquire the text to be filled, and determine display parameters of the text to be filled according to a preset layout style, the first filling area, and text level information corresponding to the text to be filled, wherein the display parameters include second filling area parameters and font display parameters;
[0011] The text to be filled is filled into the filled canvas according to the display parameters corresponding to the text to be filled, so as to obtain an image processing template.
[0012] In a second aspect, an embodiment of the present disclosure provides an image processing template generating device, comprising:
[0013] An acquisition module, configured to acquire an image to be filled and determine a first filling area of the image to be filled in a preset canvas;
[0014] a filling module, configured to fill the image to be filled into the preset canvas based on the first filling area to obtain a filled canvas;
[0015] a determination module, configured to obtain the text to be filled, and determine display parameters of the text to be filled according to a preset layout style, the first filling area, and text level information corresponding to the text to be filled, wherein the display parameters include second filling area parameters and font display parameters;
[0016] The processing module is used to fill the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled, so as to obtain an image processing template.
[0017] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
[0018] The memory stores computer-executable instructions;
[0019] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the image processing template generation method described in the first aspect and various possible designs of the first aspect.
[0020] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the image processing template generation method described in the first aspect and various possible designs of the first aspect is implemented.
[0021] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the image processing template generation method described in the first aspect and various possible designs of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, a brief introduction to the drawings required for use in the embodiments will be given below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0023] FIG1 is a schematic diagram of the system architecture on which the embodiments of the present disclosure are based;
[0024] FIG2 is a schematic diagram of a flow chart of a method for generating an image processing template according to an embodiment of the present disclosure;
[0025] FIG3 is a schematic diagram of an image processing template provided by an embodiment of the present disclosure;
[0026] FIG4 is a schematic flow chart of a method for generating an image processing template according to another embodiment of the present disclosure;
[0027] FIG5 is a flow chart of a method for generating an image processing template according to another embodiment of the present disclosure;
[0028] FIG6 is a schematic structural diagram of an image processing template generating device provided by an embodiment of the present disclosure; and
[0029] FIG7 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0031] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0032] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0033] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0034] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0035] The present disclosure provides an image processing template generation method, apparatus, device, storage medium and product.
[0036] It should be noted that the image processing template generation method, device, equipment, storage medium and product provided by the present disclosure can be applied to any template generation scenario.
[0037] In related technologies, image processing templates are typically generated by designers after comprehensive consideration of image and text layout based on their aesthetic experience. However, this method is often time-consuming and requires high professional skills from the designer, resulting in low efficiency in image processing template generation.
[0038] In the process of solving the above technical problems, the inventors discovered through research that in order to realize the automatic generation of image processing templates, image and text processing conditions can be set in advance. When the image to be filled and the text to be filled input by the user meet the processing conditions, the image to be processed and the text to be processed can be automatically adjusted, and the adjusted image to be processed and the text to be processed can be filled into the preset canvas to obtain the image processing template.
[0039] FIG1 is a schematic diagram of the system architecture on which the embodiment of the present disclosure is based. As shown in FIG1 , the system architecture on which the present disclosure is based includes at least a server 11 and a server 12. Among them, the server 11 is provided with an image processing template generation device, and the image processing template generation device can be written in a language such as C / C++, Java, Shell or Python. The server 12 can be a data server, and the data server can be a cloud server or a server cluster, which stores a large amount of data. Alternatively, the server 12 can be provided with an artificial intelligence content generation device, which can intelligently generate images to be filled and / or texts to be filled according to actual needs.
[0040] FIG2 is a flow chart of a method for generating an image processing template according to an embodiment of the present disclosure. As shown in FIG2 , the method includes:
[0041] Step 201: Acquire an image to be filled, and determine a first filling area of the image to be filled in a preset canvas.
[0042] The execution subject of this embodiment is an image processing template generation device, which can be coupled to a server, and the server can be connected to a server for providing data. The server for providing data can be a data server, and a large number of images to be filled and texts to be filled can be stored in the data server. Alternatively, the server for providing data can also include a preset artificial intelligence content generation device. Thus, based on the data acquisition request sent by the server, the image to be filled and the text to be filled can be generated by a new content production method (AI-Generated Content, referred to as AIGC).
[0043] In this embodiment, in order to implement the operation of generating an image processing template, an image to be filled can be obtained. The image to be filled can be an image portion of the image processing template. The image to be filled can be uploaded or collected by the user who created the image processing template according to actual needs, or the image to be filled can be obtained from a preset data server, or the image to be filled can be generated by AIGC, and this disclosure does not limit this.
[0044] Optionally, different images to be filled can be obtained for different types of image processing templates. For example, if a person image processing template needs to be generated, an image to be filled that includes a person's portrait can be obtained. If an item poster needs to be generated, an image to be filled that includes an item can be obtained.
[0045] Furthermore, in order to determine the filling position of the image to be filled, a first filling area of the image to be filled in the preset canvas can also be determined. This first filling area can be determined by the user based on actual needs. Alternatively, when generating an image processing template, the user can select a layout style for the image processing template, where the layout style can be a top-bottom layout, a left-right layout, or a grid layout. The first filling area can be determined based on the layout style, and this disclosure does not impose any restrictions on this.
[0046] The first filling area may be a partial area of the preset canvas, or may be the entire area of the preset canvas.
[0047] Taking a practical application as an example, the image processing template may be a poster template. After the poster template is generated, the user can generate the poster by replacing the image to be filled and the text to be filled in the poster template.
[0048] Step 202: Fill the image to be filled into the preset canvas based on the first filling area to obtain a filled canvas.
[0049] In this embodiment, after determining the first filling area, the image to be filled can be filled into the first filling area of the preset canvas to obtain a filled canvas. The user can determine the preset canvas according to actual needs, and different canvases can correspond to different display sizes.
[0050] Optionally, the complete image to be filled may be directly scaled and then filled into the first filling area, or the image to be filled may be cropped and the cropped target area may be filled into the first filling area, which is not limited in the present disclosure.
[0051] Step 203: Obtain the text to be filled, and determine the display parameters of the text to be filled according to the preset layout style, the first filling area, and the text level information corresponding to the text to be filled, wherein the display parameters include second filling area parameters and font display parameters.
[0052] In this embodiment, after completing the filling operation on the image to be filled, the text to be filled can also be obtained. The text to be filled can be uploaded or collected by the user according to actual needs, or the text to be filled can be obtained from a preset data server, or the text to be filled can be generated by AIGC, and this disclosure does not limit this.
[0053] Furthermore, in order to automatically implement the filling operation of the text to be filled, the display parameters corresponding to the text to be filled can also be determined. The text to be filled can include multiple sub-texts, for example, the text to be filled can include a main title text, a subtitle text, a guide text, a main text, etc. Different sub-texts correspond to different text level information. In order to highlight the differences between different sub-texts, different display parameters can be set for different text level information.
[0054] Optionally, when generating an image processing template, the user can also specify a layout style, where the layout style can be a top-down layout, a left-right layout, or a grid layout. For different layout styles, the image to be filled and the text to be filled can have different display parameters. Therefore, in order to accurately determine the display parameters of the text to be filled, the display parameters of the text to be filled can be determined based on factors such as the preset layout style, the first fill area, and the text level information corresponding to the text to be filled, where the display parameters include the second fill area parameters and the font display parameters.
[0055] Step 204: Fill the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled, and obtain an image processing template.
[0056] In this embodiment, after determining the display parameters of the text to be filled based on factors such as the preset layout style, the first fill area, and the text level information corresponding to the text to be filled, the text to be filled can be filled into the filled canvas based on the display parameters to obtain an image processing template. This enables automatic generation of the image processing template without the need for manual adjustment by the user.
[0057] FIG3 is a schematic diagram of an image processing template provided by an embodiment of the present disclosure. As shown in FIG3 , the layout style of the image processing template 31 is a left-right layout, where the left side can display the text 32 to be filled, and the right side can display the image 33 to be filled.
[0058] During the generation of the image processing template 31, the user can specify a first filling area 34 of the image 33 to be filled in the preset canvas. This allows the salient areas of the image 33 to be filled to the first filling area 34 based on the first filling area 34. Based on the first filling area 34 and the preset canvas, a second filling area 35 is determined, allowing the text 32 to be filled to be filled in the second filling area 35. The line spacing and font size of subtexts at different text levels within the text 32 to be filled may vary.
[0059] Optionally, based on any of the above embodiments, step 201 includes:
[0060] Position parameter information input by a user is obtained, and a first filling area of the image to be filled in a preset canvas is determined based on the position parameter information.
[0061] or,
[0062] In response to a selection operation by a user in the preset canvas, a range selected by the user is determined as the first filling area.
[0063] In this embodiment, the first filling area can be determined by the user according to actual needs.
[0064] Optionally, the user may input position parameter information according to actual needs, wherein the position parameter information may include multiple coordinate information. Thus, a display area matching the position parameter information can be determined based on the position parameter information, and the display area is determined as the first filling area of the image to be filled in the preset canvas.
[0065] Optionally, the user may also determine the first filling area based on human-computer interaction. The user may perform a selection operation in a preset canvas based on human-computer interaction, and in response to the user's selection operation in the preset canvas, the range selected by the user is determined as the first filling area.
[0066] The image processing template generation method provided in this embodiment obtains the image to be filled and determines the first filling area of the image to be filled in the preset canvas, so that on the one hand, the image to be filled can be accurately filled based on the first filling area. On the other hand, the display parameters corresponding to the text to be filled can be accurately determined based on the first filling area, the preset layout style and the text level information corresponding to the text to be filled. Furthermore, the text to be filled can be accurately and automatically filled based on the display parameters. The automatic generation of the image processing template is achieved without the user having to manually generate the image processing template, thereby improving the efficiency of image processing template generation.
[0067] Further, based on any of the above embodiments, step 202 includes:
[0068] A preset salient region recognition algorithm is used to identify salient regions in the image to be filled.
[0069] Fill the salient area into the first filling area to obtain a filled canvas.
[0070] In this embodiment, the image to be filled often includes a salient region. For example, the salient region in an image to be filled including a portrait may be a portrait region, and the salient region in an image to be filled including an object may be an object region.
[0071] To enrich the displayed content in the image processing template and enable the image processing template to more prominently display salient regions, a preset salient region recognition algorithm can be used to identify salient regions in the image to be filled. The salient regions are then filled into the first filling region to obtain a filled canvas.
[0072] Optionally, a cropping operation may be performed on the image to be filled based on the salient region to obtain an image including only the salient region, and the image including only the salient region is filled into the first filling region to obtain a filled canvas.
[0073] The image processing template generation method provided in this embodiment determines the significant area in the image to be filled and fills the significant area into the first filling area, thereby automatically performing the filling operation of the image to be filled, so that the generated image processing template can include the significant area in the image to be filled, thereby improving the quality of the image processing template.
[0074] FIG4 is a flow chart of a method for generating an image processing template according to another embodiment of the present disclosure. Based on any of the above embodiments, the text to be filled includes at least one subtext, and each subtext corresponds to preset text level information. As shown in FIG4 , step 203 includes:
[0075] Step 401: Determine second filling area parameters corresponding to the text to be filled according to the preset layout style and the first filling area.
[0076] Step 402: For each subtext, determine the font display parameters corresponding to the text level information according to the text level information corresponding to the subtext.
[0077] Step 403: Determine the font display parameters corresponding to each subtext as the font display parameters corresponding to the text to be filled.
[0078] In this embodiment, the display parameters specifically include second filling area parameters and font display parameters. In order to determine the filling position corresponding to the text to be filled, the second filling area parameters corresponding to the text to be filled can be determined first according to the preset layout style and the first filling area.
[0079] Furthermore, the text to be filled can include multiple subtexts. For example, the text to be filled can include a main title text, a subtitle text, an introduction text, and a main body text. Different subtexts correspond to different text hierarchical information. To highlight the differences between different subtexts, different font display parameters can be set for different text hierarchical information.
[0080] Optionally, font display parameters corresponding to different text level information may be pre-set. Therefore, for each subtext, the font display parameters corresponding to the text level information may be determined based on the text level information corresponding to the subtext. The font display parameters corresponding to each subtext are determined as the font display parameters corresponding to the text to be filled.
[0081] The image processing template generation method provided in this embodiment can accurately implement the filling operation of the text to be filled by respectively determining the second filling area parameters corresponding to the text to be filled and the font display parameters corresponding to each sub-text, and can ensure the template quality of the image processing template after filling based on the display parameters.
[0082] Further, based on any of the above embodiments, step 401 includes:
[0083] Calculate the difference between the preset canvas and the first filling area.
[0084] A display relationship between the text to be filled and the image to be filled is determined according to the difference information.
[0085] The second filling area parameters corresponding to the text to be filled are determined according to the display relationship and the layout style.
[0086] In this embodiment, the area of the preset canvas may be defined as 1, the first filling area as A, and the second filling area as B. Therefore, the difference between the preset canvas and the first filling area may be calculated using the formula B=1-A.
[0087] Based on this difference information, the display relationship between the text to be filled and the image to be filled can be accurately determined. If B>0, it indicates that the text to be filled and the image to be filled are mutually exclusive. If B<0, it indicates that the text to be filled and the image to be filled are overlapping.
[0088] After determining the display relationship between the text to be filled and the image to be filled, the second filling area parameters corresponding to the text to be filled may be determined based on the display relationship and a preset layout style.
[0089] For example, in a practical application, the text to be filled and the image to be filled are mutually exclusive, the preset layout style is a top-bottom layout, and the first filling area is the upper area of the preset canvas. Therefore, based on this mutually exclusive relationship and the layout style, the second filling area can be determined to be the lower area of the preset canvas.
[0090] The image processing template generation method provided in this embodiment accurately determines the display relationship between the to-be-filled text and the to-be-filled image by calculating the difference between the preset canvas and the first fill area. Furthermore, based on this display relationship and the preset layout style, the parameters of the second fill area corresponding to the to-be-filled text can be accurately determined to prevent the to-be-filled image and text from obscuring each other.
[0091] Furthermore, based on any of the above embodiments, the font display parameters include a hierarchical order display parameter, a line spacing display parameter, and a font size display parameter. Step 402 includes:
[0092] Determine the number of text levels corresponding to the text to be filled.
[0093] The hierarchical order display parameters corresponding to each subtext are determined according to the number of text levels, the text level information corresponding to each subtext, and preset hierarchical order style information, wherein the hierarchical order style information includes the display order of different text levels under different numbers of text levels.
[0094] The line spacing display parameter corresponding to each subtext is determined according to the text level information corresponding to each subtext and a preset line spacing correspondence relationship, wherein the line spacing correspondence relationship includes a correspondence relationship between different text level information and line spacing display parameters.
[0095] The font size display parameters corresponding to each subtext are determined according to the text level information corresponding to each subtext and a preset font size correspondence relationship, wherein the font size display parameters include the correspondence relationship between different text level information and font size display parameters.
[0096] In this embodiment, the font display parameters include a level order display parameter, a line spacing display parameter, and a font size display parameter.
[0097] In order to determine the hierarchical order display parameters, hierarchical order style information can be pre-set. The hierarchical order style information includes the display order of different text levels under different numbers of text levels. Therefore, the number of text levels corresponding to the text to be filled can be determined. The hierarchical order display parameters corresponding to each subtext are determined based on the number of text levels, the text level information corresponding to each subtext, and the preset hierarchical order style information.
[0098] For example, when there are three text levels, P0, P1, and P2, the display order of the corresponding text levels may include six display orders: P0, P1, P2, or P0, P2, P1, or P1, P2, P0, or P1, P0, P2, or P2, P0, P1, or P2, P1, P0. Users can select any display order as the level order display parameter corresponding to each subtext according to actual needs.
[0099] Furthermore, in order to determine the line spacing display parameters, text level information and a preset line spacing correspondence relationship can be pre-set. Thus, for each sub-text, the line spacing display parameters corresponding to each sub-text can be determined based on the text level information and the preset line spacing correspondence relationship, wherein the line spacing correspondence relationship includes the correspondence between different text level information and line spacing display parameters.
[0100] Furthermore, in order to determine the font size display parameters, text level information and a preset font size correspondence relationship may be preset, so that for each subtext, the font size display parameters corresponding to the subtext may be determined based on the text level information and the preset font size correspondence relationship.
[0101] For example, the font size for the main title subtext can be the largest, and the font size for the content subtext can be the smallest. For the text level between the main title subtext and the content subtext, the font size can be between the largest and smallest.
[0102] The image processing template generation method provided in this embodiment determines the hierarchical order display parameters, line spacing display parameters and font size display parameters corresponding to each sub-text respectively, so that each sub-text can be accurately filled in based on the hierarchical order display parameters, line spacing display parameters and font size display parameters corresponding to each sub-text, thereby improving the quality of the image processing template.
[0103] FIG5 is a flowchart of a method for generating an image processing template according to another embodiment of the present disclosure. Based on any of the above embodiments, as shown in FIG5 , step 204 includes:
[0104] Step 501: Fill the entire text to be filled into the filled canvas according to the display parameters.
[0105] Step 502: For each filled subtext, determine whether the content of the subtext exceeds the filled canvas.
[0106] Step 503: If yes, perform a line break operation on the subtext.
[0107] Step 504: Determine whether the subtext exceeds the filled canvas after the line break operation.
[0108] Step 505: If yes, adjust the font size display parameter corresponding to the subtext until the subtext does not exceed the filled canvas, and obtain the image processing template.
[0109] In this embodiment, after determining the display parameters corresponding to the text to be filled, the entire text to be filled can be filled into the filled canvas based on the display parameters. However, when filling the entire text to be filled into the filled canvas, the corresponding display content of longer sub-texts may exceed the filled canvas, resulting in incomplete content.
[0110] Therefore, to ensure the integrity of the image processing template, for each filled subtext, determine whether the content of the subtext exceeds the filled canvas. If so, perform a line break on the subtext. Determine whether the subtext exceeds the filled canvas after the line break. If so, adjust the font size display parameters corresponding to the subtext until the subtext does not exceed the filled canvas, thereby obtaining the image processing template.
[0111] For example, if any sub-text is detected to exceed the filled canvas, the sub-text can be wrapped. If the sub-text still exceeds the filled canvas after wrapping, the font size display parameters of the sub-text can be reduced. The image processing template is obtained until the sub-text does not exceed the filled canvas.
[0112] Furthermore, based on any of the above embodiments, after step 505, the following steps may be further included:
[0113] According to the adjusted font size display parameters corresponding to the sub-text and the text level information of the sub-text, the font size display parameters of other sub-texts in the text to be filled are adjusted.
[0114] In this embodiment, adjusting the font size display parameters of any subtext in the text to be filled may result in an inconsistent overall display effect. Therefore, the font size display parameters of other subtexts in the text to be filled can be adjusted based on the font size display parameters corresponding to the adjusted subtext and the text level information of the subtext.
[0115] For example, if the font size display parameter of any sub-text is reduced by one level, the font size display parameters of other sub-texts can be reduced by one level accordingly, so as to ensure the visual coordination of the image processing template while ensuring the integrity of the text to be filled.
[0116] The image processing template generation method provided in this embodiment fills the text to be filled into the filled canvas as a whole according to the display parameters. When it is detected that the text to be filled exceeds the filled canvas, the text to be filled is wrapped and / or the font size display parameters are switched, thereby realizing automatic filling of the text to be filled. In addition, it can ensure that the text to be filled is fully displayed in the filled canvas, ensuring the integrity of the text to be filled, and thus improving the quality of the generated image processing template.
[0117] Furthermore, based on any of the above embodiments, after step 204, the following steps may be further included:
[0118] Determine the current alignment and margin information of the image to be filled and the text to be filled.
[0119] Determine whether the current alignment and margin information of the image to be filled and the text to be filled match the preset typesetting mode.
[0120] If not, the current alignment and margin information of the image to be filled and the text to be filled are adjusted according to the typesetting method.
[0121] In this embodiment, to improve the quality of the image processing template, the current alignment and margin information of the image to be filled and the text to be filled can be determined. The current alignment and margin information of the image to be filled and the text to be filled can be determined to determine whether they match a preset layout. The preset layout can include fixed margin values and alignment between the image to be filled and the text to be filled, such as centerline alignment or image edge alignment.
[0122] If it is determined that the current alignment and margin information of the image to be filled and the text to be filled do not match the preset typesetting method, in order to ensure the aesthetics of the image processing template, the current alignment and margin information of the image to be filled and the text to be filled can be adjusted according to the typesetting method.
[0123] The image processing template generation method provided in this embodiment can automatically realize the generation of the image processing template and improve the quality of the image processing template by adjusting the current alignment and margin information of the image to be filled and the text to be filled according to a preset typesetting method.
[0124] Furthermore, based on any of the above embodiments, after step 204, the following steps may be further included:
[0125] Detecting whether the image to be filled and / or the text to be filled meets a preset visual saliency condition.
[0126] If not, then based on the color information of the image to be filled and / or the text to be filled, a preset area around the image to be filled and / or the text to be filled is filled with background content that matches the color information.
[0127] In this embodiment, poster design is one of the forms of visual communication. Through the composition of the layout, it immediately attracts people's attention and provides instant stimulation. Therefore, in order to enable the image processing template to more prominently highlight the key information in the image to be filled and / or the text to be filled, it is possible to detect whether the image to be filled and / or the text to be filled meet the preset visual significance conditions. If not, in order to make the image to be filled and / or the text to be filled more eye-catching, the background content that matches the color information of the image to be filled and / or the text to be filled can be filled in the preset area around the image to be filled and / or the text to be filled according to the color information of the image to be filled and / or the text to be filled.
[0128] Taking a practical application as an example, the image to be filled may include a red object. In order to make the red object more eye-catching, a white background may be added behind the red object so that the user can view the red object more intuitively.
[0129] The image processing template generation method provided in this embodiment fills the background content of the preset area around the image to be filled and / or the text to be filled based on preset significant visual conditions, thereby enriching the display content in the image processing template and improving the quality of the image processing template on the basis of automatically generating the image processing template.
[0130] Furthermore, based on any of the above embodiments, after step 204, the following steps may be further included:
[0131] Detect whether the image processing template meets the preset visual balance condition.
[0132] If not, a preset decoration content is used to perform a decoration operation on the image processing template to obtain a processed target image processing template.
[0133] In this embodiment, visual balance refers to a visual balance of forces with the visual center as the fulcrum. Uniformity, symmetry, and proportional coordination are generally the key words for achieving visual balance. Therefore, to further improve the quality of the image processing template, decorations can be added to the image processing template to achieve visual balance.
[0134] Optionally, the image processing template may be tested to determine whether it satisfies a preset visual balance condition. A preset visual balance algorithm may be employed to detect whether the image processing template satisfies the preset visual balance condition. If not, the image processing template is decorated using preset decorative content to obtain a processed target image processing template. The decorative content may be pre-stored in a data server or generated using AIGC, and this disclosure is not limited thereto.
[0135] It should be noted that the shape, color and display position of the decorative content can be determined by a preset visual balance algorithm, or can be specified by the user according to actual needs, and this disclosure does not impose any restrictions on this.
[0136] The image processing template generation method provided in this embodiment performs a decoration operation on the image processing template using preset decorative content based on preset visual balance conditions, thereby making the generated target image processing template visually balanced and improving the quality of the image processing template, so that users can generate higher-quality posters based on the image processing template.
[0137] Furthermore, based on any of the above embodiments, after step 204, the following steps may be further included:
[0138] The image processing template is subjected to color coordination processing by a preset color coordination algorithm to obtain a processed target image processing template.
[0139] In this embodiment, in order to further improve the quality of the image processing template, the image processing template can also be subjected to color coordination processing by a preset color coordination algorithm to obtain a processed target image processing template, so that the color of the target image processing template is more coordinated.
[0140] The image processing template generation method provided in this embodiment performs color coordination processing on the image processing template through a preset color coordination algorithm to obtain a processed target image processing template, thereby making the generated target image processing template color coordinated and improving the quality of the image processing template, so that users can generate higher-quality posters based on the image processing template.
[0141] Figure 6 is a structural diagram of an image processing template generation device provided by an embodiment of the present disclosure. As shown in Figure 6, the device includes: an acquisition module 61, a filling module 62, a determination module 63 and a processing module 64. Among them, the acquisition module 61 is used to acquire the image to be filled and determine the first filling area of the image to be filled in the preset canvas. The filling module 62 is used to fill the image to be filled into the preset canvas based on the first filling area to obtain the filled canvas. The determination module 63 is used to acquire the text to be filled and determine the display parameters of the text to be filled according to the preset layout style, the first filling area and the text level information corresponding to the text to be filled, wherein the display parameters include second filling area parameters and font display parameters. The processing module 64 is used to fill the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled to obtain an image processing template.
[0142] Furthermore, based on any of the above embodiments, the acquisition module is configured to: acquire position parameter information input by a user, and determine a first fill area of the image to be filled in a preset canvas based on the position parameter information. Alternatively, in response to a user selection operation in the preset canvas, determine the range selected by the user as the first fill area.
[0143] Furthermore, based on any of the above embodiments, the filling module is configured to: identify a salient region in the image to be filled using a preset salient region recognition algorithm, and fill the salient region into the first filling region to obtain a filled canvas.
[0144] Furthermore, based on any of the above embodiments, the text to be filled includes at least one subtext, and each subtext corresponds to preset text level information. The determination module is used to: determine the second filling area parameters corresponding to the text to be filled according to the preset layout style and the first filling area. For each subtext, determine the font display parameters corresponding to the text level information according to the text level information corresponding to the subtext. The font display parameters corresponding to each subtext are determined as the font display parameters corresponding to the text to be filled.
[0145] Furthermore, based on any of the above embodiments, the determination module is configured to calculate difference information between the preset canvas and the first fill area, determine a display relationship between the to-be-filled text and the to-be-filled image based on the difference information, and determine second fill area parameters corresponding to the to-be-filled text based on the display relationship and the layout style.
[0146] Further, based on any of the above embodiments, the font display parameters include hierarchical order display parameters, line spacing display parameters and font size display parameters. The determination module is used to: determine the number of text levels corresponding to the text to be filled. The hierarchical order display parameters corresponding to each sub-text are determined according to the number of text levels, the text hierarchical information corresponding to each sub-text and the preset hierarchical order style information. Wherein, the hierarchical order style information includes the display order of different text levels under different numbers of text levels. The line spacing display parameters corresponding to each sub-text are determined according to the text hierarchical information corresponding to each sub-text and the preset line spacing correspondence, wherein the line spacing correspondence includes the correspondence between different text hierarchical information and the line spacing display parameters. The font size display parameters corresponding to each sub-text are determined according to the text hierarchical information corresponding to each sub-text and the preset font size correspondence, wherein the font size display parameters include the correspondence between different text hierarchical information and the font size display parameters.
[0147] Furthermore, based on any of the above embodiments, the processing module is configured to: fill the entire text to be filled into the filled canvas according to the display parameters. For each filled subtext, determine whether the content of the subtext exceeds the filled canvas. If so, perform a line break operation on the subtext. Determine whether the subtext exceeds the filled canvas after the line break operation. If so, adjust the font size display parameters corresponding to the subtext until the subtext does not exceed the filled canvas, thereby obtaining the image processing template.
[0148] Furthermore, based on any of the above embodiments, the processing module is used to adjust the font size display parameters of other sub-texts in the text to be filled according to the font size display parameters corresponding to the adjusted sub-text and the text level information of the sub-text.
[0149] Furthermore, based on any of the above embodiments, the apparatus further includes: a determination module, further configured to determine the current alignment and margin information of the image to be filled and the text to be filled; a detection module, configured to determine whether the current alignment and margin information of the image to be filled and the text to be filled match a preset typesetting method; and an adjustment module, configured to, if not, adjust the current alignment and margin information of the image to be filled and the text to be filled according to the typesetting method.
[0150] Furthermore, based on any of the above embodiments, the apparatus further includes: a detection module configured to detect whether the image to be filled and / or the text to be filled meet a preset visual saliency condition; and an adjustment module configured to, if not, fill a predetermined area around the image to be filled and / or the text to be filled with background content that matches the color information of the image to be filled and / or the text to be filled, based on the color information of the image to be filled and / or the text to be filled.
[0151] Furthermore, based on any of the above embodiments, the apparatus further includes: a detection module configured to detect whether the image processing template satisfies a preset visual balance condition; and an adjustment module configured to, if not, decorate the image processing template using preset decorative content to obtain a processed target image processing template.
[0152] Furthermore, based on any of the above embodiments, the device further includes: an adjustment module, configured to perform color coordination processing on the image processing template using a preset color coordination algorithm to obtain a processed target image processing template.
[0153] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0154] In order to implement the above embodiments, the embodiments of the present disclosure further provide a computer-readable storage medium, in which computer-executable instructions are stored. When the processor executes the computer-executable instructions, the image processing template generation method described in any of the above embodiments is implemented.
[0155] In order to implement the above embodiments, the embodiments of the present disclosure further provide a computer program product, including a computer program, which, when executed by a processor, implements the image processing template generation method as described in any of the above embodiments.
[0156] In order to implement the above embodiment, an embodiment of the present disclosure further provides an electronic device, including: a processor and a memory.
[0157] The memory stores computer-executable instructions.
[0158] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the image processing template generation method as described in any one of the above embodiments.
[0159] FIG7 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. As shown in FIG7 , the electronic device 700 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs and desktop computers. The electronic device shown in FIG7 is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0160] As shown in FIG7 , the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the electronic device 700 are also stored in the RAM 703. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0161] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although FIG. 7 shows an electronic device 700 having various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0162] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 709, or installed from the storage device 708, or installed from the ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0163] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0164] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0165] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0166] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet Service Provider).
[0167] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0168] The units involved in the embodiments described in this disclosure may be implemented in software or hardware. In some cases, the name of a unit does not limit the unit itself. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses."
[0169] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0170] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0171] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0172] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0173] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A method for generating an image processing template, comprising: Acquire an image to be filled, and determine a first filling area of the image to be filled in a preset canvas; Filling the image to be filled into the preset canvas based on the first filling area to obtain a filled canvas; Acquire the text to be filled, and determine the display parameters of the text to be filled according to the preset layout style, the first filling area and the text level information corresponding to the text to be filled, wherein the display parameters include the second filling area parameters and the font display parameters; The text to be filled is filled into the filled canvas according to the display parameters corresponding to the text to be filled, so as to obtain an image processing template.
2. The method according to claim 1, wherein: The determining a first filling area of the image to be filled in a preset canvas includes: Acquire position parameter information input by a user, and determine a first filling area of the image to be filled in a preset canvas based on the position parameter information; or, In response to a selection operation of a user in the preset canvas, a range selected by the user is determined as the first filling area.
3. The method according to claim 1 or 2, wherein: The step of filling the image to be filled into the preset canvas based on the first filling area to obtain the filled canvas includes: Using a preset salient region recognition algorithm to identify the salient region in the image to be filled; The salient area is filled into the first filling area to obtain a filled canvas.
4. The method according to any one of claims 1 to 3, wherein: The text to be filled includes at least one sub-text, and each sub-text corresponds to preset text level information; The determining the display parameters of the text to be filled according to the preset layout style, the first filling area and the text level information corresponding to the text to be filled includes: Determining a second filling area parameter corresponding to the text to be filled according to the preset layout style and the first filling area; For each subtext, determining a font display parameter corresponding to the text level information according to the text level information corresponding to the subtext; The font display parameters corresponding to each sub-text are determined as the font display parameters corresponding to the text to be filled.
5. The method according to claim 4, wherein: The determining, according to the preset layout style and the first filling area, a second filling area parameter corresponding to the text to be filled includes: Calculating difference information between the preset canvas and the first filling area; Determine a display relationship between the text to be filled and the image to be filled according to the difference information; The second filling area parameter corresponding to the text to be filled is determined according to the display relationship and the layout style.
6. The method according to claim 4 or 5, wherein: The font display parameters include a level order display parameter, a line spacing display parameter, and a font size display parameter; The step of determining the font display parameter corresponding to the text level information according to the text level information corresponding to the subtext includes: Determine the number of text levels corresponding to the text to be filled; Determine the hierarchical order display parameters corresponding to each subtext according to the number of text hierarchies, the text hierarchical information corresponding to each subtext, and the preset hierarchical order style information; wherein the hierarchical order style information includes the display order of different text hierarchies under different numbers of text hierarchies; Determining the line spacing display parameters corresponding to each subtext according to the text level information corresponding to each subtext and a preset line spacing correspondence relationship, wherein the line spacing correspondence relationship includes a correspondence relationship between different text level information and line spacing display parameters; The font size display parameters corresponding to each subtext are determined according to the text level information corresponding to each subtext and a preset font size correspondence relationship, wherein the font size display parameters include the correspondence relationship between different text level information and the font size display parameters.
7. The method according to any one of claims 1 to 6, wherein: The step of filling the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled includes: Filling the to-be-filled text into the filled canvas as a whole according to the display parameters; For each filled subtext, determining whether the content in the subtext exceeds the filled canvas; If yes, then perform a line break operation on the sub-text; Determine whether the subtext exceeds the filled canvas after the line break operation; If so, the font size display parameter corresponding to the sub-text is adjusted until the sub-text does not exceed the filled canvas, thereby obtaining the image processing template.
8. The method according to claim 7, wherein: After adjusting the font size display parameter corresponding to the sub-text until the sub-text does not exceed the filled canvas, the method further includes: According to the font size display parameters corresponding to the adjusted sub-text and the text level information of the sub-text, the font size display parameters of other sub-texts in the text to be filled are adjusted.
9. The method according to any one of claims 1 to 8, wherein: After filling the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled, the method further includes: Determine the current alignment and margin information of the image to be filled and the text to be filled; Determine whether the current alignment and margin information of the image to be filled and the text to be filled match the preset typesetting mode; If not, the current alignment and margin information of the image to be filled and the text to be filled are adjusted according to the typesetting method.
10. The method according to any one of claims 1 to 9, wherein: After filling the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled, the method further includes: Detecting whether the image to be filled and / or the text to be filled meets a preset visual saliency condition; If not, then based on the color information of the image to be filled and / or the text to be filled, a preset area around the image to be filled and / or the text to be filled is filled with background content matching the color information.
11. The method according to any one of claims 1 to 10, wherein: After filling the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled, the method further includes: Detecting whether the image processing template meets a preset visual balance condition; If not, a preset decoration content is used to perform a decoration operation on the image processing template to obtain a processed target image processing template.
12. The method according to any one of claims 1 to 11, wherein: After filling the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled, the method further includes: The image processing template is subjected to color coordination processing by a preset color coordination algorithm to obtain a processed target image processing template.
13. An image processing template generating device, comprising: An acquisition module is configured to acquire an image to be filled and determine a first filling area of the image to be filled in a preset canvas; A filling module, configured to fill the image to be filled into the preset canvas based on the first filling area to obtain a filled canvas; a determination module configured to obtain the text to be filled, and determine display parameters of the text to be filled according to a preset layout style, the first filling area, and text level information corresponding to the text to be filled, wherein the display parameters include second filling area parameters and font display parameters; The processing module is configured to fill the text to be filled into the filled canvas according to the display parameters corresponding to the text to be filled, so as to obtain an image processing template.
14. An electronic device, comprising: processor and memory, wherein The memory stores computer-executable instructions; When the processor executes the computer-executable instructions stored in the memory, the processor executes the image processing template generation method according to any one of claims 1 to 12.
15. A computer-readable storage medium storing computer-executable instructions, wherein: When the processor executes the computer-executable instructions, the image processing template generation method according to any one of claims 1 to 12 is implemented.
16. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the image processing template generating method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Dynamically laying out images and associated text using pre-defined layouts
CN101689177A
Image processing method and device and storage medium
CN109658486A
Poster text layout method, poster generation method and related device
CN114677402A
Poster preparation system and method
US20040075866A1
Cited By
Industrial production environment multi-mode monitoring system and method based on AIGC
CN120568015A