Picture material processing method and device, storage medium and electronic equipment
1. A method for processing picture material, the method comprising:
acquiring initial picture data;
analyzing the initial picture data, and determining main drawing board data of the initial picture data according to layer structure information obtained by analysis, wherein the layer structure information comprises layer information of each layer in the initial picture data and layer grouping information of each layer;
in response to a selection operation of a plurality of picture material templates with different sizes, creating a drawing board area with the same size as each picture material template;
and synthesizing the main drawing board data to a drawing board area corresponding to each picture material template to generate a plurality of target pictures with the same picture size as the corresponding picture material templates.
2. The method according to claim 1, wherein the determining the main drawing board data of the initial picture data according to the layer structure information obtained by the parsing includes:
determining whether the initial picture data comprises one or more layer groups and whether each layer group comprises one or more layers according to the layer information of each layer and the layer group information of each layer;
when it is determined that the initial picture data comprises one or more layer groups and each layer group comprises one or more layers, determining picture data of a first layer group in the initial picture data as the main drawing board data;
when it is determined that the initial picture data includes one or more layers and each layer does not belong to any layer group, determining the picture data of the one or more layers as the main drawing board data.
3. The method according to claim 1, wherein after determining the main palette data of the initial picture data according to the layer structure information obtained by parsing, the method further comprises:
converting the main drawing board data into data in a Base64 format, and generating an acquisition link of the data in the Base64 format, wherein the acquisition link comprises a CDN link;
before synthesizing the main drawing board data to the drawing board area corresponding to each picture material template, the method further includes:
and acquiring the main drawing board data through the acquisition link.
4. The method of claim 1, wherein in creating a palette area that is the same size as each of the picture material templates, the method comprises:
determining whether the picture material template has a custom layer;
when the picture material template has a self-defined layer, determining the size of the self-defined layer as a target size;
when the picture material template does not have a self-defined layer, determining the maximum size of each layer in the picture material template as the target size;
and setting the size of the drawing board area corresponding to the picture material template as the target size.
5. The method according to claim 1, wherein when the main palette data is synthesized to the palette region corresponding to each of the picture material templates to generate a plurality of target pictures having the same picture size as the corresponding picture material template, the method comprises:
determining the target position and/or the target size of the picture element in the main drawing board data in the drawing board area corresponding to the picture material template according to the drawing board information in the main drawing board data and the area information of the picture material template;
synthesizing picture elements in the main drawing board data to the drawing board area according to the target position and/or the target size so as to generate a target picture with the same picture size as the picture material template;
the drawing board information in the main drawing board data comprises size information of the main drawing board, and position information and/or size information of picture elements in each layer.
6. The method according to claim 5, wherein the determining, according to the palette information in the main palette data and the area information of the picture material template, the target position and/or the target size of the picture element in the main palette data in the palette area corresponding to the picture material template includes:
calculating the target position and/or the target size of the picture element in the main drawing board data in the drawing board area corresponding to the picture material template by adopting a preset rule;
wherein the preset rules include any one or more of:
calculating the width proportion and the height proportion of the main drawing board and the drawing board area, and setting the width of each layer in the main drawing board data as the width of the drawing board area when the width proportion is larger than the height proportion; or when the width proportion is not larger than the height proportion, setting the height of each layer in the main drawing board data as the height of the drawing board area;
and determining a minimum distance value from a picture element in any layer in the main drawing board data to the edge of any layer in a preset direction, so as to set the coordinate value of the picture element in the preset direction as the minimum distance value.
7. The method of claim 6, further comprising:
when the width proportion is larger than the height proportion, multiplying the font value of the text element in the main drawing board data by the width proportion to obtain a target font value of the text element in the drawing board area;
when the width proportion is not larger than the height proportion, multiplying the font value of the text element in the main drawing board data by the height proportion to obtain a target font value of the text element in the drawing board area;
and setting the font value of the text element in the drawing board area as the target font value.
8. The method of claim 1, wherein when generating a plurality of target pictures having the same picture size as the corresponding picture material template, the method further comprises:
and adjusting the position and/or size of the target picture in response to the adjustment operation on the position and/or size of the target picture.
9. A device for processing a pictorial material, the device comprising:
the acquisition module is used for acquiring initial picture data;
the determining module is used for analyzing the initial picture data and determining main drawing board data of the initial picture data according to layer structure information obtained through analysis, wherein the layer structure information comprises layer information of each layer in the initial picture data and layer grouping information of each layer;
the creating module is used for responding to the selection operation of a plurality of picture material templates with different sizes, and creating a drawing board area with the same size as that of each picture material template;
and the generating module is used for synthesizing the main drawing board data to the drawing board area corresponding to each picture material template so as to generate a plurality of target pictures with the same picture size as the corresponding picture material templates.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 8.
11. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1-8 via execution of the executable instructions.
Background
With the development of the internet and the like, channels and modes of information delivery are also gradually diversified. And the size requirements of each delivery channel on the picture information in the delivery information are different. Therefore, in order to meet the information delivery requirements of different delivery channels, a manufacturer needs to design a picture with a corresponding size for each delivery channel.
However, with the increasing amount of information, manual design of picture materials with different sizes cannot meet the timeliness requirement of information delivery, and a large amount of labor cost and time cost are required. For example, in the delivery of hot spot information, the operation material is required to respond quickly, and the artificially produced picture material has low production efficiency and is difficult to meet the operation requirement. Therefore, a method for improving the production efficiency of the picture material is needed.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The disclosure provides a processing method of picture materials, a processing device of picture materials, a computer readable storage medium and an electronic device, and further solves the problem that the efficiency of generating multi-size picture materials is low in the prior art at least to a certain extent.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a method for processing picture material, the method including: acquiring initial picture data; analyzing the initial picture data, and determining main drawing board data of the initial picture data according to layer structure information obtained by analysis, wherein the layer structure information comprises layer information of each layer in the initial picture data and layer grouping information of each layer; in response to a selection operation of a plurality of picture material templates with different sizes, creating a drawing board area with the same size as each picture material template; and synthesizing the main drawing board data to a drawing board area corresponding to each picture material template to generate a plurality of target pictures with the same picture size as the corresponding picture material templates.
In an exemplary embodiment of the present disclosure, the determining, according to the layer structure information obtained through parsing, main drawing board data of the initial picture data includes: determining whether the initial picture data comprises one or more layer groups and whether each layer group comprises one or more layers according to the layer information of each layer and the layer group information of each layer; when it is determined that the initial picture data comprises one or more layer groups and each layer group comprises one or more layers, determining picture data of a first layer group in the initial picture data as the main drawing board data; when it is determined that the initial picture data includes one or more layers and each layer does not belong to any layer group, determining the picture data of the one or more layers as the main drawing board data.
In an exemplary embodiment of the present disclosure, after determining main drawing board data of the initial picture data according to the layer structure information obtained by parsing, the method further includes: converting the main drawing board data into data in a Base64 format, and generating an acquisition link of the data in the Base64 format, wherein the acquisition link comprises a CDN link; before synthesizing the main drawing board data to the drawing board area corresponding to each picture material template, the method further includes: and acquiring the main drawing board data through the acquisition link.
In an exemplary embodiment of the present disclosure, in creating a palette area having the same size as each of the picture material templates, the method includes: determining whether the picture material template has a custom layer; when the picture material template has a self-defined layer, determining the size of the self-defined layer as a target size; when the picture material template does not have a self-defined layer, determining the maximum size of each layer in the picture material template as the target size; and setting the size of the drawing board area corresponding to the picture material template as the target size.
In an exemplary embodiment of the present disclosure, when the main drawing board data is synthesized to the drawing board area corresponding to each of the picture material templates to generate a plurality of target pictures having the same picture size as the corresponding picture material template, the method includes: determining the target position and/or the target size of the picture element in the main drawing board data in the drawing board area corresponding to the picture material template according to the drawing board information in the main drawing board data and the area information of the picture material template; synthesizing picture elements in the main drawing board data to the drawing board area according to the target position and/or the target size so as to generate a target picture with the same picture size as the picture material template; the drawing board information in the main drawing board data comprises size information of the main drawing board, and position information and/or size information of picture elements in each layer.
In an exemplary embodiment of the present disclosure, the determining, according to the palette information in the main palette data and the area information of the picture material template, a target position and/or a target size of a picture element in the main palette data in a palette area corresponding to the picture material template includes: calculating the target position and/or the target size of the picture element in the main drawing board data in the drawing board area corresponding to the picture material template by adopting a preset rule; wherein the preset rules include any one or more of: calculating the width proportion and the height proportion of the main drawing board and the drawing board area, and setting the width of each layer in the main drawing board data as the width of the drawing board area when the width proportion is larger than the height proportion; or when the width proportion is not larger than the height proportion, setting the height of each layer in the main drawing board data as the height of the drawing board area; and determining a minimum distance value from a picture element in any layer in the main drawing board data to the edge of any layer in a preset direction, so as to set the coordinate value of the picture element in the preset direction as the minimum distance value.
In an exemplary embodiment of the present disclosure, the method includes: when the width proportion is larger than the height proportion, multiplying the font value of the text element in the main drawing board data by the width proportion to obtain a target font value of the text element in the drawing board area; when the width proportion is not larger than the height proportion, multiplying the font value of the text element in the main drawing board data by the height proportion to obtain a target font value of the text element in the drawing board area; and setting the font value of the text element in the drawing board area as the target font value.
In an exemplary embodiment of the present disclosure, when generating a plurality of target pictures having the same picture size as the corresponding picture material template, the method further includes: and adjusting the position and/or size of the target picture in response to the adjustment operation on the position and/or size of the target picture.
According to a second aspect of the present disclosure, there is provided a processing apparatus for picture material; the processing device of the picture material comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring initial picture data; the determining module is used for analyzing the initial picture data and determining main drawing board data of the initial picture data according to layer structure information obtained through analysis, wherein the layer structure information comprises layer information of each layer in the initial picture data and layer grouping information of each layer; the creating module is used for responding to the selection operation of a plurality of picture material templates with different sizes, and creating a drawing board area with the same size as that of each picture material template; and the generating module is used for synthesizing the main drawing board data to the drawing board area corresponding to each picture material template so as to generate a plurality of target pictures with the same picture size as the corresponding picture material templates.
In an exemplary embodiment of the present disclosure, the determining module is configured to determine, according to the layer information of each layer and the layer grouping information of each layer, whether the initial picture data includes one or more layer groups and whether each of the layer groups includes one or more layers, when it is determined that the initial picture data includes one or more layer groups and each of the layer groups includes one or more layers, determine, as the main drawing board data, picture data of a first layer group in the initial picture data, and when it is determined that the initial picture data includes one or more layers and each of the layers does not belong to any layer group, determine, as the main drawing board data, picture data of the one or more layers.
In an exemplary embodiment of the disclosure, after determining main drawing board data of the initial picture data according to the layer structure information obtained by parsing, the determining module is further configured to convert the main drawing board data into Base64 format data, and generate an obtaining link of the Base64 format data, where the obtaining link includes a CDN link; before synthesizing the main drawing board data to the drawing board area corresponding to each picture material template, the generation module is further configured to obtain the main drawing board data through the obtaining link.
In an exemplary embodiment of the disclosure, when creating a drawing board area having the same size as each picture material template, the creating module is configured to determine whether the picture material template has a custom layer; when the picture material template has a self-defined layer, determining the size of the self-defined layer as a target size, when the picture material template does not have the self-defined layer, determining the maximum size of each layer in the picture material template as the target size, and setting the size of a drawing board area corresponding to the picture material template as the target size.
In an exemplary embodiment of the disclosure, when the main drawing board data is synthesized to the drawing board area corresponding to each drawing material template, when a plurality of target pictures with the same picture size as the corresponding picture material template are generated, the generation module is used for determining the target position and/or the target size of the picture element in the main drawing board data in the drawing board area corresponding to the picture material template according to the drawing board information in the main drawing board data and the area information of the picture material template, synthesizing picture elements in the main drawing board data to the drawing board area according to the target position and/or the target size to generate a target picture with the same picture size as the picture material template, the drawing board information in the main drawing board data comprises size information of the main drawing board, and position information and/or size information of picture elements in each layer.
In an exemplary embodiment of the disclosure, the generating module is further configured to calculate, by using a preset rule, a target position and/or a target size of a picture element in the main drawing board data in a drawing board area corresponding to a picture material template, where the preset rule includes any one or more of the following: calculating the width proportion and the height proportion of the main drawing board and the drawing board area, setting the width of each layer in the main drawing board data as the width of the drawing board area when the width proportion is larger than the height proportion, or setting the height of each layer in the main drawing board data as the height of the drawing board area when the width proportion is not larger than the height proportion, and determining the minimum distance value between a picture element in any layer in the main drawing board data and the edge of any layer in a preset direction so as to set the coordinate value of the picture element in the preset direction as the minimum distance value.
In an exemplary embodiment of the disclosure, the generating module is further configured to, when the width ratio is greater than the height ratio, multiply a font value of a text element in the main palette data by the width ratio to obtain a target font value of the text element in the palette area, and when the width ratio is not greater than the height ratio, multiply the font value of the text element in the main palette data by the height ratio to obtain a target font value of the text element in the palette area, and set the font value of the text element in the palette area as the target font value.
In an exemplary embodiment of the disclosure, when generating a plurality of target pictures having the same picture size as the corresponding picture material template, the generation module is further configured to adjust the position and/or size of the target picture in response to an adjustment operation on the position and/or size of the target picture.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements any one of the above-mentioned methods for processing picture material.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above processing methods of picture material via executing the executable instructions.
The present disclosure has the following beneficial effects:
according to the processing method of the picture material, the processing apparatus of the picture material, the computer-readable storage medium, and the electronic device in the exemplary embodiment, the acquired initial picture data may be analyzed, main drawing board data of the initial picture data may be determined according to layer structure information obtained by the analysis, a drawing board region having the same size as that of each picture material template is created in response to a selection operation on a plurality of picture material templates having different sizes, and the main drawing board data is synthesized to the drawing board region corresponding to each picture material template to generate a plurality of target pictures having the same picture size as that of the corresponding picture material template. On one hand, the exemplary embodiment synthesizes the main drawing board data into the drawing board area corresponding to each picture material template, so that target pictures with different sizes can be generated, and target pictures with various sizes do not need to be manufactured manually, thereby improving the output efficiency of picture resources, and saving the cost in the aspects of manpower, resources and the like; on the other hand, by analyzing the layer structure information of the initial picture data, the main drawing board data can be extracted from the initial picture data, so that only the main drawing board data needs to be processed when the target picture is synthesized, and the data processing efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is apparent that the drawings in the following description are only some embodiments of the present disclosure, and that other drawings can be obtained from those drawings without inventive effort for a person skilled in the art.
Fig. 1 shows a flowchart of a processing method of picture material in one of the present exemplary embodiments;
FIG. 2 shows a schematic diagram of a picture material template in the present exemplary embodiment;
FIG. 3 illustrates a sub-flow diagram of a method of processing picture material in the present exemplary embodiment;
FIG. 4 shows a schematic diagram of a parameter adjustment interface in the exemplary embodiment;
fig. 5 is a flowchart showing another processing method of picture material in the present exemplary embodiment;
fig. 6 is a block diagram showing a configuration of a processing apparatus of picture material in the present exemplary embodiment;
FIG. 7 illustrates a computer-readable storage medium for implementing the above-described method in the present exemplary embodiment;
fig. 8 shows an electronic device for implementing the above method in the present exemplary embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
In view of the foregoing problems, exemplary embodiments of the present disclosure first provide a method for processing picture material. The method can be applied to terminal equipment, and can be used for processing the acquired initial picture data to generate a plurality of picture materials with different sizes. The terminal device may be a computer, a smart phone, a tablet computer, and the like, which is not limited in this disclosure.
Fig. 1 shows a flow of the present exemplary embodiment, which may include the following steps S110 to S140:
and S110, acquiring initial picture data.
The initial picture data may generally include basic information of the picture data, layer information, such as a layer name, layer attributes, grouping information of the layer, and the like, and the layer attributes may include a position, a size, a layer picture, layer characters, a transparency, a layer style, a mixed mode, and the like of the layer; the grouping information of the layers can be used to indicate which layer group the layers belong to, and information such as the number of layers of the layer group, the layer size, and the like. In terms of data Format, the initial picture data may be picture data in a PSD (photo Document Format) Format, or may also be picture data in a TIFF (Tag Image File Format) Format, which is not specifically limited in this exemplary embodiment.
In the present exemplary embodiment, the initial picture data may be picture data generated by an artist, or may be picture data acquired by other means, such as picture data acquired from a network resource or a public picture set. After obtaining the initial picture data, the user may import the initial picture data into the terminal device or a picture application running on the terminal device for processing.
To facilitate processing of the initial picture data, in an optional implementation, after the initial picture data is acquired, the initial picture data may be converted into JSON (JSON Object Notation) format data. By the method, the initial picture data can be converted into a lightweight data exchange format, so that data reading and analysis are facilitated, and the data transmission efficiency is improved.
And S120, analyzing the initial picture data, and determining main drawing board data of the initial picture data according to the layer structure information obtained through analysis.
The layer structure information may include layer information of each layer and layer grouping information of each layer in the initial picture data, for example, the layer structure information may include picture elements of each layer, layer names of layers, layer attributes, groups to which layers belong, attribute information of the groups, and the like; the main drawing board is a first drawing board generated by default on a page, and only one main drawing board is used for presenting main content for initial picture data; the main drawing board data may include picture data included in the main drawing board, and may include, for example, layers included in the main drawing board and information such as picture elements and layer attributes of each layer. In the present exemplary embodiment, the picture elements of each layer may include pictures, texts, tables, and the like.
After the initial picture data is obtained, layer structure analysis can be performed on the initial picture data, and main drawing board data of the initial picture is determined according to layer structure information obtained after analysis. For example, layer structure analysis may be performed on the initial picture data, which layers are included in the initial picture data and the layer group to which each layer belongs are determined, and picture data corresponding to the layer group with the largest number of layers is determined as main drawing board data.
In an alternative embodiment, the main palette data of the initial picture data may be determined by the following method:
determining whether the initial picture data comprises one or more layer groups and whether each layer group comprises one or more layers according to the layer information of each layer and the layer group information of each layer;
when the initial picture data is determined to comprise one or more layer groups and each layer group comprises one or more layers, determining the picture data of a first layer group in the initial picture data as main drawing board data;
when the initial picture data is determined to comprise one or more layers and each layer does not belong to any layer group, determining the picture data of the one or more layers as main drawing board data.
Specifically, when it is determined that the initial picture data includes one or more layer groups according to layer structure information obtained after the initial picture data is analyzed, that is, layer information of each layer and layer group information of each layer, and each layer group includes one or more layers, that is, the data structure of the initial picture data conforms to: when the initial picture data-layer grouping-layer are generated, determining the picture data of the first layer grouping in the initial picture data as main drawing board data; when it is determined that the initial picture data includes one or more layers according to the layer structure information obtained after the initial picture is analyzed, and each layer does not belong to any layer group, that is, the data structure of the initial picture data conforms to: when the picture data-layer is initialized, the picture data of the one or more layers may be determined as main drawing board data.
In addition, in an optional implementation manner, when the initial picture data includes a plurality of layer groups, there may be some layer groups that include layer information of one or more layers, and other layer groups that do not have layer information are empty layer groups, and at this time, in the layer group with layer information, the picture data of the first layer group with layer information may be determined as the main drawing board data according to the order of each layer group. The layer grouping sequence may be a default layer grouping sequence when the initial picture data is generated, or may be a grouping sequence labeled by a manufacturer when the initial picture data is generated.
By the method, the main drawing board data used for generating the multi-size pictures can be extracted from the initial picture data, the picture data volume can be reduced, and the data processing efficiency is improved.
Further, in an optional implementation, after obtaining the main drawing board data of the initial picture data, the main drawing board data may be converted into Base64 (binary data is represented based on 64 printable characters), and an acquisition link of the Base64 format data is generated, for example, the acquisition link may be a CDN (Content Delivery Network) link. Compared with the main drawing board data, the data in the Base64 format is a data format for representing binary data based on 64 printable characters, and is more beneficial to storage of the main drawing board data; a CDN link is a link generated based on a content delivery network.
Step S130, in response to the selection operation of the plurality of picture material templates with different sizes, creating a drawing board area with the same size as each picture material template.
The picture material template can be a template file which is generated in advance and used for generating picture materials with different sizes, and can be manufactured and generated by art workers according to actual requirements. In this exemplary embodiment, each picture material template may include one or more layers, and each layer may be used to display a specific picture element, such as a picture, a text, a table, and the like.
The user can select the picture material templates with different sizes through the terminal device, and the terminal device can respond to the selection operation of the plurality of picture material templates with different sizes to create the drawing board area with the same size as each picture material template. For example, when a user enters a picture processing interface as shown in fig. 2 through a picture application installed on a terminal device, etc., any one or more picture material templates may be clicked to create a drawing board area corresponding to each picture material template.
When the drawing board area the same as the size of each picture material template is created, the drawing board size can be set according to the size of the corresponding picture material template to obtain the drawing board area the same as the size of the picture material template. Specifically, in an alternative embodiment, the size of each picture material template may be determined by the following method, and the drawing board area is created according to the size of each picture material template:
determining whether the picture material template has a custom layer;
when the picture material template has a self-defined layer, determining the size of the self-defined layer as a target size;
when the picture material template does not have the self-defined layer, determining the maximum size of each layer in the picture material template as a target size;
and setting the size of the drawing board area corresponding to the picture material template as a target size.
The self-defined layer can be a layer preset or appointed by a manufacturer in the picture material template, and the self-defined layer has a fixed size; the target size refers to the size of the drawing board of the picture material template, such as length, width and the like, and is generally a fixed size.
In this exemplary embodiment, the terminal device may obtain layer information of the picture material template, and determine whether the picture material template has a custom layer according to the layer information, and when the picture material template has the custom layer, the size of the custom layer may be determined as a target size, otherwise, when the picture material template does not have the custom layer, the maximum size of each layer in the picture material template may be determined as the target size. Therefore, when the drawing board area corresponding to the picture material template is created, the size of the drawing board area can be set to be the target size.
By the method, the plurality of drawing board areas can be created at one time, each drawing board area is the same as the corresponding picture material template in size, and the operation is simple, convenient and quick.
And S140, synthesizing the main drawing board data to a drawing board area corresponding to each picture material template to generate a plurality of target pictures with the same picture size as the corresponding picture material template.
Specifically, each layer in the main drawing board data, such as a picture layer, a text layer, a table layer, and the like, may be synthesized to the drawing board area corresponding to each picture material template, so as to generate a plurality of target pictures having the same picture size as the corresponding picture material template. Therefore, target pictures with different sizes related to initial picture data can be generated, rapid generation of the pictures with multiple sizes is achieved, time for manually making the picture materials is greatly shortened, and the production efficiency of the picture materials is improved.
Since the main drawing board data can be stored through the acquisition link, in an optional implementation manner, before the main drawing board data is synthesized to the drawing board area corresponding to each picture material template, the main drawing board data can be acquired through the acquisition link. In this way, the terminal device can acquire the main drawing board data through the acquisition link without storing the main drawing board data to the local, so that the memory resource of the terminal device can be saved.
Specifically, in an alternative embodiment, referring to fig. 3, step S140 may be implemented by the following steps S310 to S320:
and S310, determining the target position and/or the target size of the picture element in the main drawing board data in the drawing board area corresponding to the picture material template according to the drawing board information in the main drawing board data and the area information of the picture material template.
The drawing board information in the main drawing board data may include size information of the main drawing board, position information and/or size information of picture elements in each layer. The size information of the main drawing board may be the width, the height, and the like of the main drawing board, the position information of the picture element in each layer may be the distance from the edge of the corresponding layer to the picture element in the layer, and the size information may be the size of the picture element in the layer, and the like. The area information may be position information and/or size information of a drawing board area corresponding to the picture material template, or position information and/or size information of an effective area in the drawing board area corresponding to the picture material template, and the like, and the effective area may be an area in the drawing board area for displaying main drawing board data, such as picture elements or text elements, and particularly, all the drawing board areas may also be set as effective areas thereof. The following tables 1 and 2 respectively show examples of the palette information of the main palette data and the area information of the picture material template, as follows:
TABLE 1
Drawing board information
Description of the invention
Main drawing board _ width
Width of main drawing board
Main palette _ height
Height of main drawing board
Main drawing board layer _ width
Width of picture layer in main drawing board
Main drawing board layer _ height
Height of picture layer in main drawing board
Main drawing board layer _ left
Distance between picture element of layer in main drawing board and left side of layer
Main drawing board layer _ right
Distance between picture element of layer in main drawing board and right side of layer
Main drawing board layer _ top
Distance between picture element of layer in main drawing board and top of layer
Main drawing board layer _ bottom
Distance between picture element of layer in main drawing board and bottom of layer
The main drawing board layer may be a target layer in each layer of the main drawing board data, that is, a layer currently processed. The drawing board information in the main drawing board data can be obtained by analyzing the main drawing board data. For example, the main drawing board data may be saved by variable mainBoard, and when the drawing board information is acquired, the width and height of the main drawing board may be taken out from the mainBoard and saved by variable width and height, respectively. The position information and/or the size information of the drawing board area corresponding to the picture material template can be obtained by traversing the variable tempsparedata for storing the picture material template data. Specifically, some position data of the main drawing board layer may also be calculated according to the position data of the main drawing board and the layers in the main drawing board, for example, a distance between a picture element in the main drawing board layer and the right edge of the layer — a distance between the picture element and the left edge of the layer — a width of the main drawing board layer; the distance from the picture element in the main drawing board layer to the bottom edge of the layer is main drawing board layer _ bottom ═ the height of the main drawing board-the distance from the picture element to the top edge of the layer-the height of the main drawing board layer.
TABLE 2
After the main drawing board data and the picture material template are obtained, the target position and/or the target size of the picture elements of each layer in the main drawing board data in the drawing board area corresponding to the picture material template can be calculated according to the drawing board information in the main drawing board data and the area information of the picture material template. For example, the scaling of the picture element in the drawing board region corresponding to the picture material template and the position of the picture element in the drawing board region may be calculated according to the position information and the size information of the picture element in any layer of the main drawing board data, so as to obtain the target position and the target size of the picture element in the drawing board region corresponding to the picture material template.
Specifically, in an optional implementation manner, the target position and/or the target size of the picture element in the main drawing board data in the drawing board area corresponding to the drawing board material template may be determined by the following method:
calculating the target position and/or the target size of the picture element in the main drawing board data in the drawing board area corresponding to the picture material template by adopting a preset rule;
wherein the preset rules include any one or more of:
calculating the width proportion and the height proportion of the main drawing board and the drawing board area, and setting the width of each layer in the main drawing board data as the width of the drawing board area when the width proportion is larger than the height proportion; or when the width proportion is not larger than the height proportion, setting the height of each layer in the main drawing board data as the height of the drawing board area;
and determining a minimum distance value from a picture element in any layer in the main drawing board data to any layer edge in a preset direction, so as to set the coordinate value of the picture element in the preset direction as the minimum distance value.
When a target picture is generated, the width proportion and the height proportion of the main drawing board and the drawing board area can be calculated, and according to the size relation between the width proportion and the height proportion, when the width proportion is larger than the height proportion, the widths of all layers in the main drawing board data are set as the widths of the drawing board area, so that the scaling of all layers in the main drawing board data in the width direction is realized; correspondingly, when the width proportion is not larger than the height proportion, the heights of all layers in the main drawing board data are set to be the heights of the drawing board areas, and scaling of all layers in the main drawing board data in the height direction is achieved. By the method, the direction, namely the width direction or the height direction, of the main drawing board relative to the drawing board area can be determined to be the largest, so that the attribute value in the direction with the largest change amplitude is set as the attribute value corresponding to the drawing board area, the size of the main drawing board can be scaled to the size meeting the size requirement of the drawing board area at one time, and the possibility that the main drawing board exceeds the drawing board area in a certain direction in the drawing board area is avoided.
Furthermore, the coordinate value of the picture element in the preset direction may be set as the minimum distance value according to the minimum distance value from the picture element, such as a picture element, a text element, a table element, and the like in any layer of the main drawing board data to the edge of any layer in the preset direction. The preset direction may be a left-right direction or an up-down direction of the drawing board area relative to a user of the terminal device. For example, in the left-right direction, according to a distance from a picture element in any layer in the main drawing board data to the left and right edges of the layer, that is, a main drawing board layer _ left and a main drawing board layer _ right, when the main drawing board layer _ left < the main drawing board layer _ right, a coordinate value of the picture element in the main drawing board layer in the direction is set to a value of the main drawing board layer _ left; and when the main drawing board layer _ left is larger than or equal to the main drawing board layer _ right, setting the coordinate value of the picture element in the main drawing board layer in the direction as the value of the main drawing board layer _ right. For another example, in the up-down direction, according to a distance between a picture element in any layer of the main drawing board data and the upper and lower edges of the layer, that is, a main drawing board layer _ top and a main drawing board layer _ bottom, when the main drawing board layer _ top > the main drawing board layer _ bottom, a coordinate value of the picture element in the main drawing board layer in the direction is set as a value of the main drawing board layer _ bottom; and when the main drawing board layer _ top is not more than the main drawing board layer _ bottom, setting the coordinate value of the picture element in the main drawing board layer in the direction as the value of the main drawing board layer _ top.
Further, in an optional implementation manner, after determining a target position and/or a target size of a picture element in the main drawing board data in a drawing board area corresponding to the picture material template, the position parameter and/or the size parameter of the picture element may be displayed in a display screen of the terminal device. Referring to table 3 below, an example of one location parameter and size parameter in the present exemplary embodiment is shown, as follows:
TABLE 3
In an alternative embodiment, the main palette layer _ right and the main palette layer _ bottom may also be obtained by other methods, for example: the main drawing board layer _ right is the width of the drawing board area, the layer width of the layer in the main drawing board data and the distance between the picture element in the layer in the main drawing board data and the right edge of the layer; the height of the main drawing board layer _ bottom is the height of the drawing board area, the layer height of the layer in the main drawing board data, and the distance between the picture element in the layer in the main drawing board data and the bottom edge of the layer.
By the method, the user can determine the size, the position and the like of each picture element displayed in the picture board area according to the displayed size parameters, so that whether the size parameters, the position parameters and the like of the picture elements need to be adjusted can be further determined.
And step S320, synthesizing picture elements in the main drawing board data into the drawing board area according to the target position and/or the target size so as to generate a target picture with the same picture size as the picture material template.
For example, the positions of the picture elements may be set according to the position information of the picture elements in the main drawing board data in the drawing board area, such as the distance between the picture elements and the left edge of the drawing board area, so as to synthesize the picture elements to the drawing board area, thereby generating a target picture with the same picture size as the picture material template.
Further, when generating the target picture, in an optional embodiment, the following method may be further performed:
and adjusting the position and/or size of the target picture in response to the adjustment operation on the position and/or size of the target picture.
For example, referring to fig. 4, the user may input a location or size parameter for the modified area in the picture processing interface to set the location or size of the target picture in the palette area. By the method, after the target picture is generated, the user can further finely adjust the position or the size of the target picture, and the display effect of the target picture is optimized.
Fig. 5 shows another processing flow of the picture material in the present exemplary embodiment, as shown, the following steps S510 to S590 may be included:
in step S510, initial picture data is acquired.
Specifically, the initial picture data may be picture data generated by an artist, or may be picture data acquired by other means, such as a public data set or other network resources.
Step S520, parsing the initial picture data, and converting the parsed data into JSON format data.
Compared with the initial picture data, the JSON format data has smaller data size and is easier to read and store.
Step S530, converting the main drawing board data of the initial picture data into Base64 format data, and uploading the Base64 format data to a server to generate a CDN link.
After the CDN link is generated, the terminal device can obtain the main drawing board data through the CDN link without storing the main drawing board data to the local, so that the memory resource of the terminal device is saved.
And step S540, creating a main drawing board according to the main drawing board data.
For example, the user may select to open the main drawing board data in the picture processing interface to trigger the display of the main drawing board, and at this time, the size of the main drawing board displayed in the picture processing interface may be the same as the size of the main drawing board in the initial picture data.
In step S550, in response to a selection operation on picture material templates having different sizes, a drawing board area having the same size as each picture material template is created.
For example, when a user selects a plurality of picture material templates through a terminal device, the terminal device may create drawing board areas through Canvas, and the size of each drawing board area is the same as that of the corresponding picture material template.
Step S560, calculating the target position and/or target size of the picture element in the main drawing board data in the drawing board area corresponding to the picture material template according to a preset rule;
and step S570, synthesizing picture elements in the main drawing board data into the drawing board area according to the target position and/or the target size so as to generate a target picture with the same picture size as the picture material template.
In step S580, in response to the adjustment operation on the position and/or size of the target picture, the position and/or size of the target picture is adjusted.
For example, the user may set a position parameter or a size parameter of any picture element in the target picture in the picture processing interface to adjust the position or the size of the target picture.
In step S590, a target picture is derived.
When the user selects to export the target picture, all the target pictures with different sizes can be exported at one time, and the rapid conversion from the initial picture data to the target pictures with various sizes is realized.
In summary, according to the method for processing a picture material in the exemplary embodiment, the obtained initial picture data may be analyzed, main drawing board data of the initial picture data is determined according to the layer structure information obtained through the analysis, a drawing board region having the same size as that of each picture material template is created in response to a selection operation on a plurality of picture material templates having different sizes, and the main drawing board data is synthesized to the drawing board region corresponding to each picture material template to generate a plurality of target pictures having the same picture size as that of the corresponding picture material template. On one hand, the exemplary embodiment synthesizes the main drawing board data into the drawing board area corresponding to each picture material template, so that target pictures with different sizes can be generated, and target pictures with various sizes do not need to be manufactured manually, thereby improving the output efficiency of picture resources, and saving the cost in the aspects of manpower, resources and the like; on the other hand, by analyzing the layer structure information of the initial picture data, the main drawing board data can be extracted from the initial picture data, so that only the main drawing board data needs to be processed when the target picture is synthesized, and the data processing efficiency is improved.
The present exemplary embodiment further provides a processing apparatus for a picture material, and as shown in fig. 6, the processing apparatus 600 for a picture material may include an obtaining module 610, which may be configured to obtain initial picture data; the determining module 620 may be configured to analyze the initial picture data, and determine main drawing board data of the initial picture data according to layer structure information obtained through the analysis, where the layer structure information includes layer information of each layer in the initial picture data and layer grouping information of each layer; a creating module 630, which may be configured to create a drawing board area having the same size as that of each of the plurality of picture material templates in response to a selection operation on the plurality of picture material templates having different sizes; the generating module 640 may be configured to synthesize the main drawing board data into a drawing board area corresponding to each picture material template, so as to generate a plurality of target pictures with the same picture size as the corresponding picture material template.
In an exemplary embodiment of the disclosure, the determining module 620 may be configured to determine, according to the layer information of each layer and the layer grouping information of each layer, whether the initial picture data includes one or more layer groups and whether each layer group includes one or more layers, when it is determined that the initial picture data includes one or more layer groups and each layer group includes one or more layers, determine the picture data of a first layer group in the initial picture data as the main drawing board data, and when it is determined that the initial picture data includes one or more layers and each layer does not belong to any layer group, determine the picture data of one or more layers as the main drawing board data.
In an exemplary embodiment of the disclosure, after determining the main drawing board data of the initial picture data according to the layer structure information obtained by parsing, the determining module 620 may be further configured to convert the main drawing board data into Base64 format data, and generate an obtaining link of the Base64 format data, where the obtaining link may include a CDN link; before synthesizing the main drawing board data into the drawing board region corresponding to each picture material template, the generating module 640 may also be configured to obtain the main drawing board data through the obtaining link.
In an exemplary embodiment of the present disclosure, when creating a palette area having the same size as each picture material template, the creating module 630 may be configured to determine whether the picture material template has a custom layer; when the picture material template has the self-defined layer, the size of the self-defined layer is determined as a target size, when the picture material template does not have the self-defined layer, the maximum size of each layer in the picture material template is determined as a target size, and the size of a drawing board area corresponding to the picture material template is set as the target size.
In an exemplary embodiment of the disclosure, when the main drawing board data is synthesized to the drawing board region corresponding to each picture material template to generate a plurality of target pictures having the same picture size as the corresponding picture material template, the generating module 640 may be configured to determine a target position and/or a target size of a picture element in the main drawing board data in the drawing board region corresponding to the picture material template according to the drawing board information in the main drawing board data and the region information of the picture material template, and synthesize the picture element in the main drawing board data to the drawing board region according to the target position and/or the target size to generate a target picture having the same picture size as the picture material template, where the drawing board information in the main drawing board data includes size information of the main drawing board, and position information and/or size information of the picture element in each layer.
In an exemplary embodiment of the disclosure, the generating module 640 may be further configured to calculate a target position and/or a target size of a picture element in the main drawing board data in a drawing board area corresponding to the drawing board material template by using a preset rule, where the preset rule includes any one or more of the following: calculating the width proportion and the height proportion of the main drawing board and the drawing board area, setting the width of each layer in the main drawing board data as the width of the drawing board area when the width proportion is larger than the height proportion, or setting the height of each layer in the main drawing board data as the height of the drawing board area when the width proportion is not larger than the height proportion, determining the minimum distance value between a picture element in any layer in the main drawing board data and the edge of any layer in the preset direction, and setting the coordinate value of the picture element in the preset direction as the minimum distance value.
In an exemplary embodiment of the disclosure, the generating module 640 may be further configured to, when the width ratio is greater than the height ratio, multiply the font value of the text element in the main palette data by the width ratio to obtain a target font value of the text element in the palette area, and when the width ratio is not greater than the height ratio, multiply the font value of the text element in the main palette data by the height ratio to obtain a target font value of the text element in the palette area, and set the font value of the text element in the palette area as the target font value.
In an exemplary embodiment of the disclosure, when generating a plurality of target pictures having the same picture size as the corresponding picture material template, the generating module 640 may be further configured to adjust the position and/or size of the target picture in response to an adjustment operation on the position and/or size of the target picture.
The specific details of each module in the above apparatus have been described in detail in the method section, and details of an undisclosed scheme may refer to the method section, and thus are not described again.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the terminal device.
Referring to fig. 7, a program product 700 for implementing the above method according to an exemplary embodiment of the present disclosure is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
Program product 700 may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The exemplary embodiment of the present disclosure also provides an electronic device capable of implementing the method, which may be a terminal device executing the processing method of the picture material in the exemplary embodiment. An electronic device 800 according to such an exemplary embodiment of the present disclosure is described below with reference to fig. 8. The electronic device 800 shown in fig. 8 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 8, electronic device 800 may take the form of a general purpose computing device. The components of the electronic device 800 may include, but are not limited to: the at least one processing unit 810, the at least one memory unit 820, a bus 830 connecting the various system components (including the memory unit 820 and the processing unit 810), and a display unit 840.
Wherein the storage unit 820 stores program code that may be executed by the processing unit 810 to cause the processing unit 810 to perform the steps according to various exemplary embodiments of the present disclosure described in the above section "exemplary method" of this specification. For example, processing unit 810 may perform the method steps shown in fig. 1, 3, 5, etc.
The storage unit 820 may include readable media in the form of volatile storage units, such as a random access storage unit (RAM)821 and/or a cache storage unit 822, and may further include a read only storage unit (ROM) 823.
Storage unit 820 may also include a program/utility 824 having a set (at least one) of program modules 825, such program modules 825 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 830 may be any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 800 may also communicate with one or more external devices 900 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 800, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 800 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 850. Also, the electronic device 800 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 860. As shown, the network adapter 860 communicates with the other modules of the electronic device 800 via the bus 830. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit, according to exemplary embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the exemplary embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to make a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the exemplary embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.