A method for processing plane works and related equipment
The method processes single-page flat works by obtaining and replacing template elements within image templates, effectively converting them into flat images, thereby overcoming the conversion limitations of existing technologies.
Patent Information
- Application Number
- CN202111049114.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-08
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2041-09-08
AI Technical Summary
Existing technologies are unable to effectively convert single-page flat works into corresponding flat images.
A method that involves obtaining component data from single-page flat works, requesting and processing image templates based on specific parameters, identifying and replacing template elements with corresponding data, and rendering the processed templates into a flat image.
Enables the conversion of single-page flat works into flat images, addressing the limitations of existing technologies by systematically processing and rendering the data into a visual format.
Smart Images

Figure CN113760435B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method for processing a planar work and related equipment. Background Art
[0002] With the development of science and technology and social economy, the application areas of graphic works are constantly expanding.
[0003] A graphic work refers to a graphic design work that can be composed of multiple parts such as pictures, text, QR codes, embedded boxes, date signatures and / or backgrounds. Each part can be an element component in the graphic work. For example, a picture in a graphic work can be called a picture element component in the graphic work. A graphic work can be generated by a non-graphic editor such as an H5 editor or a form editor.
[0004] However, the existing technology cannot convert the plane works into corresponding plane pictures. Summary of the invention
[0005] In view of the above problems, the present invention provides a method and related equipment for processing a planar work that overcomes the above problems or at least partially solves the above problems. The technical solution is as follows:
[0006] A method for processing a plane work, comprising:
[0007] Obtaining component content data of at least one work element component in a single-page graphic work;
[0008] Obtaining template request parameters, and obtaining at least one image template based on the template request parameters, each of the image templates including at least one template element component;
[0009] Determine one of the picture templates as a target picture template;
[0010] Searching for a target template element component carrying a predefined tag among the template element components of the target image template;
[0011] In the component content data of each of the work element components, searching for target component content data corresponding to the target template element component;
[0012] Based on the target component content data, the component content data in the target template element component is replaced to obtain a processed target image template;
[0013] Rendering the processed target image template onto a canvas to obtain a rendered canvas;
[0014] The rendered canvas is converted into a corresponding target plane image.
[0015] Optionally, after converting the rendered canvas into a corresponding target plane image, the method further includes:
[0016] Return to the step of determining one of the picture templates as the target picture template until the target plane pictures corresponding to each of the picture templates are obtained.
[0017] Optionally, the template request parameters include: the number N of application scenario identifiers, the number M of required plane images, and the number Z of image template identifiers.
[0018] Optionally, obtaining at least one image template based on the template request parameter includes:
[0019] If the sum of Z and N is not greater than M, then obtain Z picture templates based on the Z picture template identifiers, obtain N picture templates based on the N application scenario identifiers, and randomly obtain X1 picture templates, where the sum of Z, N and X1 is M;
[0020] If Z is not less than M, then based on M picture template identifiers among the Z picture template identifiers, obtain corresponding M picture templates;
[0021] If Z is less than M, and the sum of Z and N is greater than M, then Z picture templates are obtained based on the Z picture template identifiers, and corresponding X2 picture templates are obtained based on X application scenario identifiers among the N application scenario identifiers, where the sum of Z and X2 is M.
[0022] Optionally, after obtaining the template request parameters, the method further includes:
[0023] Verifying the template request parameters according to a predefined verification method, and then executing the step of obtaining at least one image template based on the template request parameters after the verification passes;
[0024] Wherein: the predefined verification method includes: a first verification method, a second verification method and / or a third verification method;
[0025] The first verification method is: verifying whether the template request parameters contain required parameters;
[0026] The second verification method is: verifying whether the parameter type of each parameter in the template request parameter is correct;
[0027] The third verification method is: verifying whether the parameter value of each parameter in the template request parameter meets the predefined conditions.
[0028] Optionally, the method is applied to a plane editor, and the step of obtaining component content data of at least one work element component in a single-page plane work includes:
[0029] Obtaining component content data of at least one work element component in the single-page planar work sent by the non-planar editor;
[0030] The obtaining of template request parameters includes:
[0031] Obtaining template request parameters sent by the non-planar editor;
[0032] The method further includes: sending the target plane image to the non-plane editor for display.
[0033] A planar work processing device comprises: a first obtaining unit, a second obtaining unit, a third obtaining unit, a first determining unit, a first searching unit, a second searching unit, a replacement processing unit, a fourth obtaining unit, a fifth obtaining unit and a conversion unit; wherein:
[0034] The first obtaining unit is used to obtain component content data of at least one work element component in a single-page plane work;
[0035] The second obtaining unit is used to obtain template request parameters;
[0036] The third obtaining unit is used to obtain at least one image template based on the template request parameter, each of the image templates includes at least one template element component;
[0037] The first determining unit is used to determine one of the picture templates as a target picture template;
[0038] The first search unit is used to search for a target template element component carrying a predefined tag among the template element components of the target image template;
[0039] The second search unit is used to search for target component content data corresponding to the target template element component in the component content data of each of the work element components;
[0040] The replacement processing unit is used to perform replacement processing on the component content data in the target template element component based on the target component content data;
[0041] The fourth obtaining unit is used to obtain a processed target image template;
[0042] The fifth obtaining unit is used to render the processed target image template onto a canvas to obtain a rendered canvas;
[0043] The conversion unit is used to convert the rendered canvas into a corresponding target plane image.
[0044] Optionally, the device further includes: a first trigger unit;
[0045] The first triggering unit is used to trigger the first determining unit until a target plane image corresponding to each of the image templates is obtained.
[0046] Optionally, the template request parameters include: the number N of application scenario identifiers, the number M of required plane images, and the number Z of image template identifiers.
[0047] Optionally, the third obtaining unit includes: a first picture template obtaining unit, a second picture template obtaining unit, a third picture template obtaining unit, a fourth picture template obtaining unit, a fifth picture template obtaining unit and a sixth picture template obtaining unit; wherein:
[0048] If the sum of Z and N is not greater than M, the first picture template obtaining unit, the second picture template obtaining unit and the third picture template obtaining unit are triggered;
[0049] If Z is not less than M, triggering the fourth picture template obtaining unit;
[0050] If Z is less than M, and the sum of Z and N is greater than M, the fifth picture template obtaining unit and the sixth picture template obtaining unit are triggered; wherein:
[0051] The first picture template obtaining unit is used to obtain Z picture templates based on the Z picture template identifiers;
[0052] The second picture template obtaining unit is used to obtain N picture templates based on N application scenario identifiers;
[0053] The third picture template obtaining unit is used to randomly obtain X1 picture templates; wherein the sum of Z, N and X1 is M;
[0054] The fourth picture template obtaining unit is used to obtain corresponding M picture templates based on M picture template identifiers among the Z picture template identifiers;
[0055] The fifth picture template obtaining unit is used to obtain Z picture templates based on the Z picture template identifiers;
[0056] The sixth picture template obtaining unit is used to obtain corresponding X2 picture templates based on X application scenario identifiers among the N application scenario identifiers, and the sum of Z and X2 is M.
[0057] Optionally, the device further comprises: a verification unit;
[0058] The verification unit is used to verify the template request parameters according to a predefined verification method after the template request parameters are obtained, and trigger the third obtaining unit after the verification passes;
[0059] Wherein: the predefined verification method includes: a first verification method, a second verification method and / or a third verification method;
[0060] The first verification method is: verifying whether the template request parameters contain required parameters;
[0061] The second verification method is: verifying whether the parameter type of each parameter in the template request parameter is correct;
[0062] The third verification method is: verifying whether the parameter value of each parameter in the template request parameter meets the predefined conditions.
[0063] Optionally, the device is applied to a plane editor, and the first obtaining unit is used to obtain component content data of at least one work element component in a single-page plane work sent by a non-plane editor;
[0064] The second obtaining unit is used to obtain the template request parameters sent by the non-planar editor;
[0065] The device further includes: a sending unit; the sending unit is used to send the target plane image to the non-plane editor for display.
[0066] An electronic device comprises at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute the above-mentioned planar work processing method.
[0067] A computer-readable storage medium stores a program, which implements the above-mentioned planar work processing method when executed by a processor.
[0068] The method and related equipment for processing a planar work proposed in the present invention can obtain component content data of at least one work element component in a single-page planar work, obtain template request parameters, obtain at least one picture template based on the template request parameters, each picture template includes at least one template element component, determine a picture template as a target picture template, find out a target template element component carrying a predefined tag in each template element component of the target picture template, find out target component content data corresponding to the target template element component in the component content data of each work element component, replace the component content data in the target template element component based on the target component content data, obtain a processed target picture template, render the processed target picture template onto a canvas, obtain a rendered canvas, and convert the rendered canvas into a corresponding target planar picture. The present invention can realize the conversion of a single-page planar work into a planar picture.
[0069] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0071] Figure 1 A flow chart showing a first method for processing a planar work provided by an embodiment of the present invention is shown;
[0072] Figure 2 A schematic diagram showing the structure of a first device for processing a planar work provided by an embodiment of the present invention is shown;
[0073] Figure 3 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0074] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0075] like Figure 1 As shown, this embodiment proposes a first method for processing a planar work, comprising the following steps:
[0076] S101, obtaining component content data of at least one work element component in a single-page planar work;
[0077] It should be noted that the present invention can be applied to electronic devices, such as tablet computers and desktop computers.
[0078] The single-page graphic work may be a graphic design work with one page, or a graphic design work of a certain page in a graphic design work with multiple pages. Specifically, the single-page graphic work may be a graphic design work that includes work element components such as a title, a picture, text, a QR code, an embedded box, a date signature, and / or a background. Optionally, the single-page graphic work may be a graphic design work of a certain page output by a non-graphic editor (such as an H5 editor and a form editor).
[0079] The work element component may be an element component in a single-page graphic work.
[0080] Specifically, component content data may include content data in a work element component, but may not include information such as the position and size of the work element component in a single-page work. For example, component content data of a title may include the descriptive text (such as Chinese characters) in the title, but may not include information such as the coordinates, width and height of the title in a single-page work; for another example, component content data of a QR code may include content data such as the center icon and cover image of the QR code, but may not include information such as the coordinates, width and height of the QR code in a single-page work.
[0081] Specifically, the present invention can obtain the component identification of the work element component when obtaining the component content data of each work element component. Optionally, the component identification can be included in the component content data of the work element component. In this case, the present invention can identify the work element component to which it belongs based on the component content data; optionally, the component identification may not be included in the component content data of the work element component. In this case, the present invention can obtain the component identification of the work element component when obtaining the component content data of the work element component. Specifically, the present invention can identify the work element component to which the component content data belongs based on the obtained component identification of the work element component. It should be noted that the component identification can be composed of one or more of Chinese characters, letters, numbers and other characters.
[0082] It should be noted that a single-page planar work may not be a planar picture as a whole. Figure 1 The steps shown are used to convert a single-page flat work of a non-flat image into a flat image.
[0083] S102, obtaining template request parameters;
[0084] The template request parameter may be a parameter for requesting a picture template. It should be noted that the present invention can convert a single-page plane work into a corresponding plane picture based on the picture template.
[0085] Optionally, the template request parameters include: the number N of application scenario identifiers, the number M of required plane images, and the number Z of image template identifiers, wherein N, M, and Z can all be positive integers.
[0086] The application scenario identifier may be an identifier of the application scenario. The present invention can obtain a picture template corresponding to the application scenario (such as a product promotion advertisement and a singing competition poster, etc.) through the application scenario identifier.
[0087] The required number of plane images may be the number of plane images to be obtained. The present invention may determine the number of picture templates to be obtained by the required number of plane images. For example, when the required number of plane images is 5, the number of picture templates required by the present invention is 5.
[0088] The picture template identifier may be an identifier of a picture template. The present invention can obtain a corresponding picture template through the picture template identifier.
[0089] Specifically, the present invention can obtain a corresponding picture template based on a picture template identifier; it can also obtain a corresponding picture template based on an application scenario identifier.
[0090] Optionally, the template request parameters may also include only some parameters of the number of application scenario identifiers, the number of required plane images, and the number of image template identifiers. For example, the template request parameters may include only the number of required plane images. Of course, the template request parameters may also include other types of parameters, such as color combination styles, plant types, and game character identifiers. Specifically, the present invention does not limit the specific parameters of the template request parameters.
[0091] S103: obtaining at least one image template based on the template request parameters, each image template including at least one template element component;
[0092] Specifically, the present invention can obtain the corresponding number and type of picture templates based on the template request parameters. Optionally, the present invention can obtain the picture template in the local storage based on the template request parameters; Optionally, the present invention can also obtain the picture template from the server storing a large number of picture templates based on the template request parameters.
[0093] It is understandable that the picture template may also be a graphic design work consisting of multiple parts such as pictures, text, QR code, embedded frame, date signature and / or background. Each part in the picture template may be referred to as a template element component.
[0094] Optionally, when the template request parameters include the number N of application scenario identifiers, the number M of required plane images, and the number Z of image template identifiers, step S103 may include:
[0095] If the sum of Z and N is not greater than M, then Z picture templates are obtained based on the Z picture template identifiers, N picture templates are obtained based on the N application scenario identifiers, and X1 picture templates are obtained randomly, and the sum of Z, N and X1 is M;
[0096] If Z is not less than M, then based on M picture template identifiers among the Z picture template identifiers, obtain corresponding M picture templates;
[0097] If Z is less than M, and the sum of Z and N is greater than M, then Z picture templates are obtained based on the Z picture template identifiers, and corresponding X2 picture templates are obtained based on X application scenario identifiers among the N application scenario identifiers, and the sum of Z and X2 is M.
[0098] Specifically, when the template request parameter includes the number of application scenario identifiers, the number of plane image requirements, and the number of image template identifiers, the present invention can first determine the number of image templates to be obtained based on the number of plane image requirements. After that, the present invention can preferentially obtain the corresponding number of image templates based on the image template identifiers. If the number of image templates obtained does not reach the required number, the corresponding number of image templates is then obtained based on the application scenario identifiers to meet the required number of image templates.
[0099] If the number of image templates obtained based on the image template identifier and the application scenario identifier does not reach the required number, the present invention can randomly obtain the remaining number of image templates. Optionally, if the template request parameter only includes the required number of plane images, the present invention can obtain the corresponding number of image templates by random acquisition.
[0100] S104, determining a picture template as a target picture template;
[0101] Specifically, the present invention can use each picture template as a target picture template, perform subsequent processing, and obtain a corresponding plane picture.
[0102] S105, searching for a target template element component carrying a predefined tag among the template element components of the target image template;
[0103] The predefined tag may be a predefined special tag of a certain type, which can be used to identify the target template element component. Specifically, the predefined tag may be composed of one or more characters such as numbers, letters and symbols. For example, the predefined tag may be "the template element component of the component content data to be replaced".
[0104] Specifically, after determining the target image template, the present invention can search for the target template element component among all template element components of the target image template. The target template element component can include one or more template element components.
[0105] S106, searching for target component content data corresponding to the target template element component in the component content data of each work element component of the single-page plane work;
[0106] Specifically, the present invention can first determine the target work element component corresponding to the target template element component, and then based on the component identifier of the target work element component, find out the component content data of the target work element component in the component content data of each work element component obtained, and determine the found component content data of the target work element component as the target component content data.
[0107] Among them, the component identification (such as component name) of the target work element component and the component identification of the target template element component may correspond. For example, when the target template element component is a large title in the target picture template, the target work element component may be a large title in a single-page plane work; for another example, when the target template element component is a QR code description text, the target work element component may be a QR code description text in a single-page plane work. It is understandable that the present invention can determine the corresponding target work element component based on the component identification of the target template element component.
[0108] Specifically, when the target template element component includes only one template element component, the present invention can determine a work element component corresponding to the target template element component, and determine the determined work element component as the target work element component. At this time, the target component content data can be the component content data of a certain work element component.
[0109] Specifically, when the target template element component includes multiple template element components, the present invention can determine a work element component accordingly based on each template element component in the target template element component, and determine each determined work element component as the target work element component. For example, when the target template element component includes a QR code and a QR code description text, the present invention can determine the QR code in a single-page plane work based on the QR code in the target template element component, determine the QR code description text in the single-page plane work based on the QR code description text in the target template element component, and determine the QR code and QR code description text in the determined single-page plane work as the target work element component. At this time, the target work element component can include multiple work element components. At this time, the target component content data can include component content data of multiple work element components in the target work element component.
[0110] S107, based on the target component content data, replace the component content data in the target template element component to obtain a processed target image template;
[0111] Specifically, when the target template element component only includes a certain template element component, the target component content data may be the component content data of a certain work element component. At this time, the present invention can directly replace the component content data in the target template element component with the target component content data during the process of replacing the component content data in the target template element component.
[0112] Specifically, when the target template element component includes multiple template element components, the target component content data may include component content data of multiple work element components in the target work element component. At this time, in the process of replacing the component content data in the target template element component, the present invention may replace the component content data of each template element component in the target template element component with the component content data of the corresponding work element component in the target component content data. For example, when the target template element component includes a QR code and a QR code description text, the target component content data may include the component content data of the corresponding QR code and the QR code description text. The present invention may replace the component content data of the QR code in the target template element component with the component content data of the QR code in the target component content data, and replace the component content data of the QR code description text in the target template element component with the component content data of the QR code description text in the target work element component.
[0113] Specifically, the present invention may determine the target image template after the replacement process is completed as the processed target image template.
[0114] S108, rendering the processed target image template onto a canvas to obtain a rendered canvas;
[0115] Specifically, after obtaining the processed target image template, the present invention can render the processed target image template onto a canvas of a plane editor or an image editor to obtain a rendered canvas.
[0116] It can be understood that what is presented in the rendered canvas is the component content data in the processed target image template after the replacement process has been completed.
[0117] S109, converting the rendered canvas into a corresponding target plane image.
[0118] Specifically, the present invention can convert the rendered canvas into a corresponding target plane image through the existing technology.
[0119] It should be noted that the present invention implements Figure 1 The steps shown can realize the conversion of a single-page graphic work into a corresponding graphic image.
[0120] Optionally, other methods for processing a planar work proposed in this embodiment may further include:
[0121] Return to the step of determining an image template as a target image template until the target plane images corresponding to each image template are obtained.
[0122] It is understandable that the present invention can obtain a required number of target plane images by using each image template as a target image template to obtain a target plane image corresponding to the target image template.
[0123] The method for processing a planar work proposed in this embodiment can obtain component content data of at least one work element component in a single-page planar work, obtain template request parameters, obtain at least one picture template based on the template request parameters, each picture template includes at least one template element component, determine a picture template as a target picture template, find out the target template element component carrying a predefined tag in each template element component of the target picture template, find out the target component content data corresponding to the target template element component in the component content data of each work element component, replace the component content data in the target template element component based on the target component content data, obtain the processed target picture template, render the processed target picture template onto a canvas, obtain a rendered canvas, and convert the rendered canvas into a corresponding target planar picture. The present invention can realize the conversion of a single-page planar work into a planar picture.
[0124] based on Figure 1 The steps shown in the figure, this embodiment proposes a second method for processing a planar work. After step S102, the method may further include:
[0125] Verify the template request parameters according to a predefined verification method, and then execute step S103 after the verification passes;
[0126] Wherein: the predefined verification method includes: a first verification method, a second verification method and / or a third verification method;
[0127] The first verification method is: verify whether the template request parameters contain required parameters;
[0128] The second verification method is: verify whether the parameter type of each parameter in the template request parameter is correct;
[0129] The third verification method is: verifying whether the parameter value of each parameter in the template request parameter satisfies the predefined conditions.
[0130] The required parameters may be parameters that must be included in the template request parameters. For example, the required parameters may be the required number of plane images.
[0131] It should be noted that if the verification fails, the present invention may prohibit the execution of step S102 and subsequent processing steps to avoid unnecessary consumption of resources.
[0132] The method for processing a planar work proposed in this embodiment can verify the template request parameters when obtaining the template request parameters. If the verification passes, the subsequent processing process can be executed. If the verification fails, the subsequent processing process can be prohibited to avoid unnecessary consumption of resources.
[0133] based on Figure 1 The steps shown in the figure, this embodiment proposes a third method for processing a plane work. The method can be applied to a plane editor. At this time, in the method, step S101 may include:
[0134] Obtaining component content data of at least one work element component in the single-page planar work sent by the non-planar editor;
[0135] Step S102 may include: obtaining a template request parameter sent by the non-planar editor;
[0136] Among them, the third method for processing planar works also includes: sending the target planar image to a non-planar editor for display.
[0137] Among them, the non-planar editor may be an H5 editor, a form editor, and the like.
[0138] Specifically, after the non-planar editor generates a single-page planar work, the present invention can obtain component content data and template request parameters of each work element component in the single-page planar work sent by the non-planar editor.
[0139] It is understandable that the present invention can simultaneously obtain the component content data and template request parameters of each work element component sent by the non-planar editor.
[0140] Specifically, after generating the target plane image, the present invention can send the target plane image to the non-plane editor, and perform image preview in the non-plane editor.
[0141] It should be noted that the present invention can identify communication data by carrying different types of messages during the communication with the non-planar editor. For example, when the non-planar editor sends component content data and template request parameters to the planar editor, it can carry a first type of message, so that when the present invention reads the first type of message, it can determine that the data sent by the non-planar editor is the component content data and template request parameters; for another example, when the present invention sends a target plane image to the non-planar editor, it can carry a second type of message, so that when the non-planar editor reads the second type of message, it can determine that the data sent by the planar editor is the target plane image.
[0142] It should be noted that the present invention can implement the process of converting a plane work into a plane image on a plane editor. Specifically, through the communication between the non-plane editor and the plane editor, and the plane work processing process of the plane editor, the present invention can convert the plane work generated by the non-plane editor into a plane image, and display it on the non-plane editor, thereby realizing the output function of the non-plane editor.
[0143] Optionally, in other methods for processing planar works proposed in this embodiment, the present invention can also be applied to non-planar editors. At this time, the non-planar editor can establish communication with the planar editor, and the present invention can send the component content data and template request parameters of each work element component in the generated single-page planar work to the planar editor, and the planar editor performs the planar work processing process, obtains the target planar image returned by the planar editor, and displays the target planar image, which can also realize the output function of the non-planar editor.
[0144] It should be noted that the present invention allows the user to select and use the generated target plane image on the non-plane editor. For example, when the image template is a poster image template, the present invention can generate a corresponding number of poster images (target plane images) and display them on the non-plane editor, and the user can select and apply the poster images at this time.
[0145] The method for processing planar works proposed in this embodiment can convert the planar works generated by the non-planar editor into planar images and display them on the non-planar editor through the communication between the non-planar editor and the planar editor and the planar works processing process of the planar editor, thereby realizing the output function of the non-planar editor.
[0146] and Figure 1 The steps shown correspond to Figure 2 As shown, this embodiment proposes a first planar work processing device, which may include: a first obtaining unit 101, a second obtaining unit 102, a third obtaining unit 103, a first determining unit 104, a first searching unit 105, a second searching unit 106, a replacement processing unit 107, a fourth obtaining unit 108, a fifth obtaining unit 109 and a conversion unit 110; wherein:
[0147] The first obtaining unit 101 is used to obtain component content data of at least one work element component in a single-page plane work;
[0148] It should be noted that the present invention can be applied to electronic devices, such as tablet computers and desktop computers.
[0149] The single-page graphic work may be a graphic design work with one page, or a graphic design work of a certain page in a graphic design work with multiple pages. Specifically, the single-page graphic work may be a graphic design work that includes work element components such as a title, a picture, text, a QR code, an embedded box, a date signature, and / or a background. Optionally, the single-page graphic work may be a graphic design work of a certain page output by a non-graphic editor (such as an H5 editor and a form editor).
[0150] The work element component may be an element component in a single-page graphic work.
[0151] Specifically, the component content data may include the content data in a work element component, but may not include information such as the position and size of the work element component in a single-page flat work.
[0152] Specifically, the present invention can obtain the component identification of the work element component when obtaining the component content data of each work element component. Optionally, the component identification can be included in the component content data of the work element component. In this case, the present invention can identify the work element component to which it belongs based on the component content data; optionally, the component identification may not be included in the component content data of the work element component. In this case, the present invention can obtain the component identification of the work element component when obtaining the component content data of the work element component. Specifically, the present invention can identify the work element component to which the component content data belongs based on the obtained component identification of the work element component. It should be noted that the component identification can be composed of one or more of Chinese characters, letters, numbers and other characters.
[0153] It should be noted that a single-page planar work may not be a planar picture as a whole. The present invention can realize the conversion of a single-page planar work that is not a planar picture into a planar picture.
[0154] The second obtaining unit 102 is used to obtain template request parameters;
[0155] The template request parameter may be a parameter for requesting a picture template. It should be noted that the present invention can convert a single-page plane work into a corresponding plane picture based on the picture template.
[0156] Optionally, the template request parameters include: the number N of application scenario identifiers, the number M of required plane images, and the number Z of image template identifiers, wherein N, M, and Z can all be positive integers.
[0157] The application scenario identifier may be an identifier of the application scenario. The present invention can obtain a picture template corresponding to the application scenario (such as a product promotion advertisement and a singing competition poster, etc.) through the application scenario identifier.
[0158] The required number of plane images may be the number of plane images to be obtained. The present invention may determine the number of picture templates to be obtained by the required number of plane images. For example, when the required number of plane images is 5, the number of picture templates required by the present invention is 5.
[0159] The picture template identifier may be an identifier of a picture template. The present invention can obtain a corresponding picture template through the picture template identifier.
[0160] Specifically, the present invention can obtain a corresponding picture template based on a picture template identifier; it can also obtain a corresponding picture template based on an application scenario identifier.
[0161] Optionally, the template request parameters may also include only some parameters of the number of application scenario identifiers, the number of required plane images, and the number of image template identifiers. For example, the template request parameters may include only the number of required plane images. Of course, the template request parameters may also include other types of parameters, such as color combination styles, plant types, and game character identifiers. Specifically, the present invention does not limit the specific parameters of the template request parameters.
[0162] A third obtaining unit 103 is used to obtain at least one image template based on the template request parameter, each image template including at least one template element component;
[0163] Specifically, the present invention can obtain the corresponding number and type of picture templates based on the template request parameters. Optionally, the present invention can obtain the picture template in the local storage based on the template request parameters; Optionally, the present invention can also obtain the picture template from the server storing a large number of picture templates based on the template request parameters.
[0164] It is understandable that the picture template may also be a graphic design work consisting of multiple parts such as pictures, text, QR code, embedded frame, date signature and / or background. Each part in the picture template may be referred to as a template element component.
[0165] Optionally, when the template request parameter includes the number N of application scenario identifiers, the number M of plane image requirements, and the number Z of image template identifiers, the third obtaining unit 103 includes: a first image template obtaining unit, a second image template obtaining unit, a third image template obtaining unit, a fourth image template obtaining unit, a fifth image template obtaining unit, and a sixth image template obtaining unit; wherein:
[0166] If the sum of Z and N is not greater than M, the first picture template obtaining unit, the second picture template obtaining unit and the third picture template obtaining unit are triggered;
[0167] If Z is not less than M, the fourth picture template obtaining unit is triggered;
[0168] If Z is less than M, and the sum of Z and N is greater than M, the fifth image template obtaining unit and the sixth image template obtaining unit are triggered; wherein:
[0169] A first picture template obtaining unit, configured to obtain Z picture templates based on the Z picture template identifiers;
[0170] A second picture template obtaining unit, configured to obtain N picture templates based on N application scenario identifiers;
[0171] The third picture template obtaining unit is used to randomly obtain X1 picture templates, wherein the sum of Z, N and X1 is M;
[0172] a fourth picture template obtaining unit, configured to obtain corresponding M picture templates based on M picture template identifiers among the Z picture template identifiers;
[0173] a fifth picture template obtaining unit, configured to obtain Z picture templates based on the Z picture template identifiers;
[0174] The sixth picture template obtaining unit is used to obtain corresponding X2 picture templates based on X application scenario identifiers among the N application scenario identifiers, and the sum of Z and X2 is M.
[0175] Specifically, when the template request parameter includes the number of application scenario identifiers, the number of plane image requirements, and the number of image template identifiers, the present invention can first determine the number of image templates to be obtained based on the number of plane image requirements. After that, the present invention can preferentially obtain the corresponding number of image templates based on the image template identifiers. If the number of image templates obtained does not reach the required number, the corresponding number of image templates is obtained based on the application scenario identifiers to meet the required number of image templates.
[0176] If the number of image templates obtained based on the image template identifier and the application scenario identifier does not reach the required number, the present invention can randomly obtain the remaining number of image templates. Optionally, if the template request parameter only includes the required number of plane images, the present invention can obtain the corresponding number of image templates by random acquisition.
[0177] A first determining unit 104, configured to determine a picture template as a target picture template;
[0178] Specifically, the present invention can use each picture template as a target picture template, perform subsequent processing, and obtain a corresponding plane picture.
[0179] The first searching unit 105 is used to search for a target template element component carrying a predefined tag among the template element components of the target image template;
[0180] The predefined tag may be a predefined special tag of a certain type, which can be used to identify the target template element component. Specifically, the predefined tag may be composed of one or more characters such as numbers, letters and symbols.
[0181] For example, the predefined tag may be "template element component of component content data to be replaced".
[0182] Specifically, after determining the target image template, the present invention can search for the target template element component among all template element components of the target image template. The target template element component can include one or more template element components.
[0183] The second search unit 106 is used to search for target component content data corresponding to the target template element component in the component content data of each work element component;
[0184] Specifically, the present invention can first determine the target work element component corresponding to the target template element component, and then based on the component identifier of the target work element component, find out the component content data of the target work element component in the component content data of each work element component obtained, and determine the found component content data of the target work element component as the target component content data.
[0185] Among them, the component identification (such as component name) of the target work element component and the component identification of the target template element component may correspond. For example, when the target template element component is a large title in the target picture template, the target work element component may be a large title in a single-page plane work; for another example, when the target template element component is a QR code description text, the target work element component may be a QR code description text in a single-page plane work. It is understandable that the present invention can determine the corresponding target work element component based on the component identification of the target template element component.
[0186] Specifically, when the target template element component includes only one template element component, the present invention can determine a work element component corresponding to the target template element component, and determine the determined work element component as the target work element component. At this time, the target component content data can be the component content data of a certain work element component.
[0187] Specifically, when the target template element component includes multiple template element components, the present invention can determine a work element component accordingly based on each template element component in the target template element component, and determine each determined work element component as the target work element component. For example, when the target template element component includes a QR code and a QR code description text, the present invention can determine the QR code in a single-page plane work based on the QR code in the target template element component, determine the QR code description text in the single-page plane work based on the QR code description text in the target template element component, and determine the QR code and QR code description text in the determined single-page plane work as the target work element component. At this time, the target work element component can include multiple work element components. At this time, the target component content data can include component content data of multiple work element components in the target work element component.
[0188] A replacement processing unit 107, configured to perform replacement processing on component content data in a target template element component based on target component content data;
[0189] Specifically, when the target template element component only includes a certain template element component, the target component content data may be the component content data of a certain work element component. At this time, the present invention can directly replace the component content data in the target template element component with the target component content data during the process of replacing the component content data in the target template element component.
[0190] Specifically, when the target template element component includes multiple template element components, the target component content data may include component content data of multiple work element components in the target work element component. At this time, in the process of replacing the component content data in the target template element component, the present invention may replace the component content data of each template element component in the target template element component with the component content data of the corresponding work element component in the target component content data. For example, when the target template element component includes a QR code and a QR code description text, the target component content data may include the component content data of the corresponding QR code and the QR code description text. The present invention may replace the component content data of the QR code in the target template element component with the component content data of the QR code in the target component content data, and replace the component content data of the QR code description text in the target template element component with the component content data of the QR code description text in the target work element component.
[0191] The fourth obtaining unit 108 is used to obtain a processed target image template;
[0192] Specifically, the present invention may determine the target image template after the replacement process is completed as the processed target image template.
[0193] A fifth obtaining unit 109, configured to render the processed target image template onto a canvas to obtain a rendered canvas;
[0194] Specifically, after obtaining the processed target image template, the present invention can render the processed target image template onto a canvas of a plane editor or an image editor to obtain a rendered canvas.
[0195] It can be understood that what is presented in the rendered canvas is the component content data in the processed target image template after the replacement process has been completed.
[0196] The conversion unit 110 is used to convert the rendered canvas into a corresponding target plane image.
[0197] Specifically, the present invention can convert the rendered canvas into the corresponding target plane image through the existing technology. Figure 2 The device shown can convert a single-page planar work into a corresponding planar picture.
[0198] Optionally, in other planar artwork processing devices proposed in this embodiment, it may further include: a first triggering unit;
[0199] The first triggering unit is used to trigger the first determining unit 104 until a target plane image corresponding to each image template is obtained.
[0200] It is understandable that the present invention can obtain a required number of target plane images by using each image template as a target image template to obtain a target plane image corresponding to the target image template.
[0201] The planar work processing device proposed in this embodiment can convert a single-page planar work into a planar picture.
[0202] based on Figure 2 , this embodiment proposes a second device for processing a planar work. The device further includes: a verification unit;
[0203] A verification unit, configured to verify the template request parameters according to a predefined verification method after obtaining the template request parameters, and trigger the third obtaining unit 103 after the verification passes;
[0204] Wherein: the predefined verification method includes: a first verification method, a second verification method and / or a third verification method;
[0205] The first verification method is: verify whether the template request parameters contain required parameters;
[0206] The second verification method is: verify whether the parameter type of each parameter in the template request parameter is correct;
[0207] The third verification method is: verifying whether the parameter value of each parameter in the template request parameter satisfies the predefined conditions.
[0208] The required parameters may be parameters that must be included in the template request parameters. For example, the required parameters may be the required number of plane images.
[0209] It should be noted that, if the verification fails, the present invention may prohibit triggering the unit for executing the subsequent process, such as the third obtaining unit 103, to avoid unnecessary consumption of resources.
[0210] The planar work processing device proposed in this embodiment can verify the template request parameters when obtaining the template request parameters. If the verification passes, the subsequent processing process can be executed. If the verification fails, the subsequent processing process can be prohibited to avoid unnecessary consumption of resources.
[0211] based on Figure 2This embodiment proposes a third planar work processing device. The device can be applied to a planar editor. At this time, in the device, the first obtaining unit 101 is used to obtain component content data of at least one work element component in a single-page planar work sent by a non-planar editor;
[0212] The second obtaining unit 102 is used to obtain the template request parameters sent by the non-planar editor;
[0213] The device also includes: a sending unit; the sending unit is used to send the target plane image to the non-plane editor for display.
[0214] Among them, the non-planar editor may be an H5 editor, a form editor, and the like.
[0215] Specifically, after the non-planar editor generates a single-page planar work, the present invention can obtain component content data and template request parameters of each work element component in the single-page planar work sent by the non-planar editor.
[0216] It is understandable that the present invention can simultaneously obtain the component content data and template request parameters of each work element component sent by the non-planar editor.
[0217] Specifically, after generating the target plane image, the present invention can send the target plane image to the non-plane editor, and perform image preview in the non-plane editor.
[0218] It should be noted that, in the process of communicating with the non-planar editor, the present invention can identify the communication data by carrying different types of messages. The present invention can implement the process of converting a planar work into a planar image on a planar editor. Specifically, through the communication between the non-planar editor and the planar editor, and the planar work processing process of the planar editor, the present invention can convert the planar work generated by the non-planar editor into a planar image, and display it on the non-planar editor, thereby realizing the output function of the non-planar editor.
[0219] Optionally, in other plane work processing devices proposed in this embodiment, the present invention can also be applied to non-plane editors. At this time, the non-plane editor can establish communication with the plane editor, and the present invention can send the component content data and template request parameters of each work element component in the generated single-page plane work to the plane editor, and the plane editor performs the plane work processing process, obtains the target plane image returned by the plane editor, and displays the target plane image, which can also realize the output function of the non-plane editor.
[0220] It should be noted that, in the present invention, the user can select and use the generated target plane image on the non-plane editor.
[0221] The planar work processing device proposed in this embodiment can convert the planar work generated by the non-planar editor into a planar picture through the communication between the non-planar editor and the planar editor, as well as the planar work processing process of the planar editor, and display it on the non-planar editor, thereby realizing the output function of the non-planar editor.
[0222] The above-mentioned graphic work processing device includes a processor and a memory. The above-mentioned first obtaining unit 101, the second obtaining unit 102, the third obtaining unit 103, the first determining unit 104, the first searching unit 105, the second searching unit 106, the replacement processing unit 107, the fourth obtaining unit 108, the fifth obtaining unit 109 and the conversion unit 110 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0223] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the plane work processing can be realized by adjusting the kernel parameters.
[0224] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the above-mentioned planar work processing method is implemented.
[0225] An embodiment of the present invention provides a processor, which is used to run a program, wherein the above-mentioned planar work processing method is executed when the program is run.
[0226] like Figure 3 As shown, an embodiment of the present invention provides an electronic device 100, which includes at least one processor 200, at least one memory 300 connected to the processor 200, and a bus 400; wherein the processor 200 and the memory 300 communicate with each other through the bus 400; the processor 200 is used to call the program instructions in the memory 300 to execute the above-mentioned planar work processing method. The electronic device in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0227] The present invention also provides a computer program product, which, when executed on an electronic device, is suitable for executing a program for initializing the following method steps:
[0228] Obtaining component content data of at least one work element component in a single-page graphic work;
[0229] Obtaining template request parameters, and obtaining at least one image template based on the template request parameters, each image template including at least one template element component;
[0230] Determine an image template as a target image template;
[0231] Find the target template element component carrying the predefined tag in each template element component of the target image template;
[0232] In the component content data of each work element component, the target component content data corresponding to the target template element component is searched;
[0233] Based on the target component content data, the component content data in the target template element component is replaced to obtain a processed target image template;
[0234] Render the processed target image template onto the canvas to obtain the rendered canvas;
[0235] Convert the rendered canvas to a corresponding target plane image.
[0236] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatuses, electronic devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0237] In a typical configuration, an electronic device includes one or more processors (CPU), a memory, and a bus. The electronic device may also include an input / output interface, a network interface, and the like.
[0238] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
[0239] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0240] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0241] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0242] The above are only embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A method for processing a planar work, characterized in that: include: Obtaining component content data of at least one work element component in a single-page planar work; Obtaining template request parameters, and obtaining at least one image template based on the template request parameters, each of the image templates including at least one template element component, the template request parameters including: the number N of application scenario identifiers, the number M of plane image requirements, and the number Z of image template identifiers; Determine one of the picture templates as a target picture template; Finding a target template element component carrying a predefined tag among the template element components of the target image template; In the component content data of each of the work element components, searching for target component content data corresponding to the target template element component; Based on the target component content data, the component content data in the target template element component is replaced to obtain a processed target image template; Rendering the processed target image template onto a canvas to obtain a rendered canvas; Convert the rendered canvas into a corresponding target plane image; The obtaining at least one image template based on the template request parameter includes: If the sum of Z and N is not greater than M, then obtain Z picture templates based on the Z picture template identifiers, obtain N picture templates based on the N application scenario identifiers, and randomly obtain X1 picture templates, where the sum of Z, N and X1 is M; If Z is not less than M, then based on M picture template identifiers among the Z picture template identifiers, obtain corresponding M picture templates; If Z is less than M, and the sum of Z and N is greater than M, then Z picture templates are obtained based on the Z picture template identifiers, and corresponding X2 picture templates are obtained based on X application scenario identifiers among the N application scenario identifiers, where the sum of Z and X2 is M.
2. The method for processing a planar work according to claim 1, characterized in that: After converting the rendered canvas into a corresponding target plane image, the method further includes: Return to the step of determining one of the picture templates as the target picture template until the target plane pictures corresponding to each of the picture templates are obtained.
3. The method for processing a planar work according to claim 1, characterized in that: After obtaining the template request parameters, the method further includes: Verifying the template request parameters according to a predefined verification method, and then executing the step of obtaining at least one image template based on the template request parameters after the verification passes; Wherein: the predefined verification method includes: a first verification method, a second verification method and / or a third verification method; The first verification method is: verifying whether the template request parameters contain required parameters; The second verification method is: verifying whether the parameter type of each parameter in the template request parameter is correct; The third verification method is: verifying whether the parameter value of each parameter in the template request parameter meets the predefined conditions.
4. The method for processing a planar work according to claim 1, characterized in that: The method is applied to a plane editor, and obtaining component content data of at least one work element component in a single-page plane work includes: Obtaining component content data of at least one work element component in the single-page planar work sent by the non-planar editor; The obtaining of template request parameters includes: Obtaining template request parameters sent by the non-planar editor; The method further includes: sending the target plane image to the non-plane editor for display.
5. A device for processing a planar work, characterized in that: include: a first obtaining unit, a second obtaining unit, a third obtaining unit, a first determining unit, a first searching unit, a second searching unit, a replacement processing unit, a fourth obtaining unit, a fifth obtaining unit and a conversion unit; wherein: The first obtaining unit is used to obtain component content data of at least one work element component in a single-page plane work; The second obtaining unit is used to obtain template request parameters, where the template request parameters include: the number N of application scenario identifiers, the number M of required plane images, and the number Z of image template identifiers; The third obtaining unit is used to obtain at least one image template based on the template request parameter, each of the image templates includes at least one template element component; The first determining unit is used to determine one of the picture templates as a target picture template; The first search unit is used to search for a target template element component carrying a predefined tag among the template element components of the target image template; The second search unit is used to search for target component content data corresponding to the target template element component in the component content data of each of the work element components; The replacement processing unit is used to perform replacement processing on the component content data in the target template element component based on the target component content data; The fourth obtaining unit is used to obtain a processed target image template; The fifth obtaining unit is used to render the processed target image template onto a canvas to obtain a rendered canvas; The conversion unit is used to convert the rendered canvas into a corresponding target plane image; The third obtaining unit includes: a first picture template obtaining unit, a second picture template obtaining unit, a third picture template obtaining unit, a fourth picture template obtaining unit, a fifth picture template obtaining unit and a sixth picture template obtaining unit; wherein: If the sum of Z and N is not greater than M, the first picture template obtaining unit, the second picture template obtaining unit and the third picture template obtaining unit are triggered; If Z is not less than M, the fourth picture template obtaining unit is triggered; If Z is less than M, and the sum of Z and N is greater than M, the fifth image template obtaining unit and the sixth image template obtaining unit are triggered; wherein: A first picture template obtaining unit, configured to obtain Z picture templates based on the Z picture template identifiers; A second picture template obtaining unit, configured to obtain N picture templates based on N application scenario identifiers; The third picture template obtaining unit is used to randomly obtain X1 picture templates, wherein the sum of Z, N and X1 is M; a fourth picture template obtaining unit, configured to obtain corresponding M picture templates based on M picture template identifiers among the Z picture template identifiers; a fifth picture template obtaining unit, configured to obtain Z picture templates based on the Z picture template identifiers; The sixth picture template obtaining unit is used to obtain corresponding X2 picture templates based on X application scenario identifiers among the N application scenario identifiers, and the sum of Z and X2 is M.
6. The device for processing a planar work according to claim 5, characterized in that: The device further comprises: a first trigger unit; The first triggering unit is used to trigger the first determining unit until a target plane image corresponding to each of the image templates is obtained.
7. An electronic device, characterized in that: The electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the graphic work processing method as described in any one of claims 1 to 4.
8. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the planar work processing method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Image template and image generating methods and related devices
CN107025676A
Picture generation method and device, equipment and medium
CN110008450A