CN112164127A - Picture generation method and device, electronic equipment and readable storage medium - Google Patents

Picture generation method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN112164127A
CN112164127A CN202011030360.8A CN202011030360A CN112164127A CN 112164127 A CN112164127 A CN 112164127A CN 202011030360 A CN202011030360 A CN 202011030360A CN 112164127 A CN112164127 A CN 112164127A
Authority
CN
China
Prior art keywords
picture
elements
picture elements
advertisement
size
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011030360.8A
Other languages
Chinese (zh)
Inventor
陈宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dafang Zhongzhi Creative Advertising Zhuhai Co ltd
Original Assignee
Dafang Zhongzhi Creative Advertising Zhuhai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dafang Zhongzhi Creative Advertising Zhuhai Co ltd filed Critical Dafang Zhongzhi Creative Advertising Zhuhai Co ltd
Priority to CN202011030360.8A priority Critical patent/CN112164127A/en
Publication of CN112164127A publication Critical patent/CN112164127A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes

Abstract

The application provides a picture generation method and device, electronic equipment and a readable storage medium. The method comprises the following steps: acquiring a target size of a pre-generated advertisement picture, a plurality of picture elements and a first relative position relationship of the plurality of picture elements, wherein the picture elements comprise at least one of image elements and text elements, and the target size is within a preset size range; determining second relative position relations of the plurality of picture elements and frame positions of the plurality of picture elements in a background canvas with the target size according to the target size and the first relative position relations, wherein the relative position relations of the plurality of picture elements in the background canvas are the same as the second relative position relations; pasting each picture element to a corresponding frame position in the background canvas; each picture element pasted in the background canvas is extended through an extension algorithm to obtain a target advertisement picture with a target size, the efficiency of generating the advertisement picture can be improved, and the flexibility of adjusting the size of the advertisement picture is improved.

Description

Picture generation method and device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of computer image processing technologies, and in particular, to a method and an apparatus for generating a picture, an electronic device, and a readable storage medium.
Background
In the image advertisement design industry, the requirement of applying advertisement pictures with the same theme to different scenes exists. The sizes of the advertisement pictures in different scenes usually differ, so that the sizes of the advertisement pictures need to be adjusted. Currently, the size of an advertisement picture can be manually adjusted based on an initial advertisement picture to meet the size requirement of a corresponding scene. In the manual adjustment method, the adjustment efficiency is low. If the device is adopted to automatically generate the advertisement picture, the size of the currently generated advertisement picture is usually a fixed size, and the size cannot be flexibly adjusted according to the user requirements.
Disclosure of Invention
An object of the embodiments of the present application is to provide a picture generating method, an apparatus, an electronic device, and a readable storage medium, which can solve the problems of low efficiency and inflexible size of generated advertisement pictures.
In order to achieve the above object, embodiments of the present application are implemented as follows:
in a first aspect, an embodiment of the present application provides a method for generating an image, where the method includes:
acquiring a target size of a pre-generated advertisement picture, a plurality of picture elements and a first relative position relationship of the plurality of picture elements, wherein the picture elements comprise at least one of image elements and text elements, and the target size is within a preset size range;
determining second relative position relations of the plurality of picture elements and frame positions of the plurality of picture elements in a background canvas with the target size according to the target size and the first relative position relations, wherein the relative position relations of the plurality of picture elements in the background canvas are the same as the second relative position relations;
pasting each picture element to a corresponding frame position in the background canvas;
and extending each picture element attached in the background canvas by an extension algorithm to obtain the target advertisement picture with the target size.
In the above embodiment, in the preset size range, the picture element can be extended in the background canvas, and the advertisement picture with the corresponding target size can be automatically generated, so that the generation efficiency of the advertisement picture can be improved, and the flexibility of adjusting the size of the advertisement picture can be improved.
With reference to the first aspect, in some optional embodiments, the frame positions of the plurality of picture elements in the background canvas comprise a plurality of sets of relative positions, each set of relative positions comprising one frame position of each picture element of the plurality of picture elements in the background canvas, each set of relative positions corresponding to one background canvas;
pasting each picture element to a corresponding frame position in the background canvas, comprising:
for each of the background canvases, pasting each of the picture elements to a frame position in the background canvases corresponding to each of the plurality of sets of relative positions;
extending each picture element pasted in the background canvas by an extension algorithm to obtain a target advertisement picture with a target size, including:
and aiming at each background canvas, extending each picture element attached in the background canvas through an extension algorithm to obtain the target advertisement picture corresponding to each group of relative positions.
In the above embodiment, based on the plurality of sets of relative positions, one target advertisement picture corresponding to each set of relative positions can be obtained, so that a plurality of advertisement pictures with similar styles but different styles can be generated at one time.
With reference to the first aspect, in some optional embodiments, extending each of the picture elements attached to the background canvas by an extension algorithm to obtain the target advertisement picture of the target size includes:
when the picture elements are text elements, zooming each text element pasted in the background canvas through the extension algorithm, wherein the character space in the zoomed text elements is matched with the size of the corresponding frame position;
when the picture elements are image elements, zooming each image element pasted in the background canvas through the extension algorithm, wherein the size of the zoomed image element is matched with the size of the corresponding frame position;
and obtaining the target advertisement picture with the target size.
With reference to the first aspect, in some optional implementations, before obtaining the target size of the pre-generated advertisement picture, the plurality of picture elements, and the first relative positional relationship of the plurality of picture elements, the method further includes:
acquiring a historical advertisement picture comprising the plurality of picture elements;
extracting the plurality of picture elements from the historical advertisement pictures, and the first relative position relation of the plurality of picture elements in the historical advertisement pictures.
In the above embodiment, the plurality of picture elements and the first relative position relationship can be obtained quickly by the historical advertisement picture, so that there is an advertisement picture that can quickly convert the size of the historical advertisement picture into a target size.
With reference to the first aspect, in some optional embodiments, extracting the plurality of picture elements from the historical advertisement picture, and the first relative position relationship of the plurality of picture elements in the historical advertisement picture, includes:
extracting the plurality of picture elements from the historical advertisement pictures;
converting each picture element in the plurality of picture elements into scatter points at corresponding positions in the historical advertisement picture respectively;
and determining a relative position relation corresponding to each scattered point through a triangulation algorithm to serve as the first relative position relation.
With reference to the first aspect, in some optional implementations, determining, according to the target size and the first relative positional relationship, a second relative positional relationship of the plurality of picture elements and a frame position of the plurality of picture elements in a background canvas of the target size includes:
according to the target size and the first relative position relation, taking each picture element as a scatter point, and determining an adjacent size corresponding to each scatter point;
and in the background canvas, according to the adjacent size corresponding to each picture element, determining a second relative position relation of each picture element and the frame position of each picture element in the background canvas by a triangular interpolation algorithm.
In combination with the first aspect, in some alternative embodiments, the predetermined size range has an aspect ratio in a range of 0.2 to 13.
In a second aspect, an embodiment of the present application further provides an image generating apparatus, where the apparatus includes:
the device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a target size of a pre-generated advertisement picture, a plurality of picture elements and a first relative position relationship of the plurality of picture elements, the picture elements comprise at least one of image elements and text elements, and the target size is within a preset size range;
a determining unit, configured to determine, according to the target size and the first relative positional relationship, a second relative positional relationship of the multiple picture elements and frame positions of the multiple picture elements in a background canvas of the target size, where the relative positional relationship of the multiple picture elements in the background canvas is the same as the second relative positional relationship;
the pasting unit is used for pasting each picture element to a corresponding frame position in the background canvas;
and the extension unit is used for extending each picture element attached in the background canvas through an extension algorithm to obtain the target advertisement picture with the target size.
In a third aspect, an embodiment of the present application further provides an electronic device, where the electronic device includes a processor and a memory coupled to each other, and a computer program is stored in the memory, and when the computer program is executed by the processor, the electronic device is caused to perform the method described above.
In a fourth aspect, the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program runs on a computer, the computer is caused to execute the above method.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Fig. 2 is a schematic flow chart of a picture generation method according to an embodiment of the present application.
Fig. 3 is a schematic layout diagram of historical advertisement pictures according to an embodiment of the present application.
Fig. 4a is a schematic layout diagram of a target advertisement picture according to an embodiment of the present application.
Fig. 4b is a second layout diagram of a target advertisement picture according to the embodiment of the present application.
Fig. 5 is a schematic layout diagram of a picture generating device according to an embodiment of the present application.
Icon: 10-an electronic device; 11-a processing module; 12-a storage module; 100-picture generation means; 110-an obtaining unit; 120-a determination unit; 130-sticking unit; 140-extension unit.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. It should be noted that the terms "first," "second," and the like are used merely to distinguish one description from another, and are not intended to indicate or imply relative importance.
The applicant finds that in the advertisement design industry, when an advertisement picture of a theme needs to be applied to places with different aspect ratios, manual composition needs to be performed again, so that the efficiency of advertisement design is low.
In view of the above problems, the applicant of the present application proposes the following embodiments to solve the above problems. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, an embodiment of the present application provides an electronic device 10, which can automatically generate an advertisement picture with a target size from a plurality of picture elements according to a target size of a pre-generated advertisement picture set by a user.
In this embodiment, the electronic device 10 may include a processing module 11 and a storage module 12. The memory module 12 stores therein a computer program which, when executed by the processing module 11, enables the electronic device 10 to perform the steps of the method described below.
Of course, the electronic device 10 may also include other modules, for example, the electronic device 10 may also include a display screen and the picture generation apparatus 100. The processing module 11, the storage module 12, the display screen and the elements of the picture generation apparatus 100 are directly or indirectly electrically connected to each other, so as to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
In the present embodiment, the electronic device 10 may be, but is not limited to, a personal computer, a server, a tablet computer, and the like.
Referring to fig. 2, an embodiment of the present application further provides a picture generating method, which can be applied to the electronic device 10, and each step in the method is executed or implemented by the electronic device 10. The method may comprise the steps of:
step S210, acquiring a target size of a pre-generated advertisement picture, a plurality of picture elements and a first relative position relationship of the plurality of picture elements, wherein the picture elements comprise at least one of image elements and text elements, and the target size is within a preset size range;
step S220, determining second relative position relations of the plurality of picture elements and frame positions of the plurality of picture elements in a background canvas with the target size according to the target size and the first relative position relations, wherein the relative position relations of the plurality of picture elements in the background canvas are the same as the second relative position relations;
step S230, pasting each picture element to a corresponding frame position in the background canvas;
and step S240, extending each picture element pasted in the background canvas through an extension algorithm to obtain the target advertisement picture with the target size.
In the above embodiment, in the preset size range, the picture element can be extended in the background canvas, and the advertisement picture with the corresponding target size can be automatically generated, so that the generation efficiency of the advertisement picture can be improved, and the flexibility of adjusting the size of the advertisement picture can be improved.
The individual steps of the process are explained in detail below, as follows:
in step S210, when an advertisement picture of a target size needs to be generated, the user may input the target size of the pre-generated advertisement picture through the electronic device 10, so that the electronic device 10 acquires the target size of the pre-generated advertisement picture. In addition, the electronic device 10 may also acquire a plurality of picture elements used for generating an advertisement picture, and a relative positional relationship between the plurality of picture elements.
Understandably, the manner of obtaining the relative position relationship between the plurality of picture elements and the plurality of picture elements may be: the electronic device 10 may store a plurality of picture elements and a first relative position relationship between the plurality of picture elements, which are prepared by a user, in advance, and when an advertisement picture with a target size needs to be generated, the electronic device 10 may automatically acquire the plurality of picture elements and the first relative position relationship between the plurality of picture elements.
Alternatively, the electronic device 10 stores a history advertisement picture, the history advertisement picture includes a plurality of picture elements, and when an advertisement picture of a target size needs to be generated, the electronic device 10 may extract the plurality of picture elements and the relative position relationship of the plurality of picture elements in the history advertisement picture from the history picture, and use the relative position relationship as the first relative position relationship.
The historical advertisement picture can be understood as an advertisement picture which is designed according to a plurality of picture elements after the designer creates the plurality of picture elements in advance.
In the present embodiment, the picture element includes at least one of an image element and a text element. An image element can be understood as a relatively independent pattern in the advertisement picture, and a text element can be understood as a relatively independent piece of text content in the advertisement picture. In the process of designing an advertisement picture, a designer usually presents one image element by using one layer, and different image elements can be presented by using different layers.
The advertisement picture may be an image file having a layer attribute format. For example, the advertisement picture is a picture in a PSD format, and may include a plurality of layers.
Generally, an advertisement picture may include at least one image element and at least one text element at the same time, and the number of the included image elements and the number of the included text elements may be determined according to actual situations, which is not limited specifically herein.
In this embodiment, the advertisement picture may be rectangular in shape. The target size is within a preset size range. The predetermined size range is understood to be a ratio range of aspect ratios of the rectangle, which may be set according to practical situations, for example, the ratio range of the aspect ratio may be 0.2 to 13.
When the ratio range of the aspect ratio of the preset size range is 0.2 to 13, the user can determine the aspect ratio of the target size according to the requirement in the range of the aspect ratio of 0.2 to 13, which is beneficial to improving the flexibility of the size of the generated advertisement picture.
In step S220, after obtaining the target size, the plurality of picture elements and the first relative position relationship, the electronic device 10 may automatically construct a background canvas with the target size, then re-determine the relative position relationship of the plurality of picture elements in the background canvas as the second relative position relationship, and determine the frame position of each of the plurality of picture elements in the background canvas based on the determined second relative position relationship. One frame position may be used to affix a picture element. The relative positional relationship may include an adjacent positional relationship between the respective picture elements.
The second relative positional relationship may be understood as determining the layout of text elements and the layout of image elements in the advertisement picture, which may be a process of laying out picture elements according to the underlying layout logic. The frame position can be understood as further adjustment after the preliminary layout, and can be used as a process for laying out the picture elements according to the business layout logic. For example, for a text element, the process of determining the frame position may include: determining the font size, the font interval, the font alignment mode and the like in the text elements. For an image element, the process of determining the frame position may include: determining the center of gravity of the pattern, determining the alignment of the pattern in the image elements, the spacing between text elements and image elements, etc.
In step S230, after obtaining the frame position of each picture element on the background canvas, the electronic device 10 may automatically paste each picture element of the plurality of picture elements on the corresponding frame position on the background canvas.
In step S240, when the electronic device 10 posts each picture element, the posted picture element may be scaled to fit the current target size of the background canvas.
For example, when scaling a picture element, if the picture element is an image element, the electronic device 10 may scale the pattern in the image element in a manner of maintaining the aspect ratio unchanged, so that it may be avoided that the effect presented by the image element is affected by changing the aspect ratio during the scaling process.
If the picture element is a text element, the electronic device 10 may adjust the font size and the font distance of the text element to adapt to the target size of the current background canvas.
As an optional implementation, the frame positions of the plurality of picture elements in the background canvas comprise a plurality of sets of relative positions, each set of relative positions comprising one frame position of each picture element in the plurality of picture elements in the background canvas, each set of relative positions corresponding to one background canvas.
Understandably, the electronic device 10 can obtain multiple sets of relative positions based on one relative position relationship, so as to generate multiple advertisement pictures. The relative position relation of the generated advertisement pictures is approximate, but the specific positions and sizes of the picture elements in the background canvas can be slightly different, so that the styles of the generated advertisement pictures can be enriched.
When there are multiple sets of relative positions, step S230 may include:
for each of the background canvases, pasting each of the picture elements to a frame position in the background canvases corresponding to each of the plurality of sets of relative positions;
step S240 may include:
and aiming at each background canvas, extending each picture element attached in the background canvas through an extension algorithm to obtain the target advertisement picture corresponding to each group of relative positions.
In the above embodiment, the electronic device 10 may obtain one target advertisement picture corresponding to each group of relative positions based on a plurality of groups of relative positions, so as to be beneficial to generating a plurality of advertisement pictures with similar styles but different styles at one time, so that the styles of the generated advertisement pictures may be enriched, and the efficiency of generating the advertisement pictures may be improved. The user can select one or more advertisement pictures as adopted advertisement pictures in a plurality of advertisement pictures with the same target size according to actual conditions.
The adopted advertising picture can be presented on an advertising screen in an electronic version. Alternatively, the user may present the advertising picture in the form of a poster, banner, or the like by printing the advertising picture.
As an alternative implementation, step S240 may include:
when the picture elements are text elements, zooming each text element pasted in the background canvas through the extension algorithm, wherein the character space in the zoomed text elements is matched with the size of the corresponding frame position;
when the picture elements are image elements, zooming each image element pasted in the background canvas through the extension algorithm, wherein the size of the zoomed image element is matched with the size of the corresponding frame position;
and obtaining the target advertisement picture with the target size.
In this embodiment, the text element may be scaled by an extension algorithm, or the size of the fonts, the space between the fonts, the line space between each line of fonts, and the like in the text element may be adjusted to implement scaling of the text element, so that the size of the region occupied by the scaled text element does not exceed the size of the frame position. The manner of adjusting the size of the fonts in the text element, the space between the fonts, the line space between each line of fonts, and the like may be determined by the electronic device 10 in the background canvas according to the size of the frame position of the planned text element, which is not specifically limited herein.
And when the size of the region occupied by the zoomed text element in the background canvas is equal to or slightly smaller than the size of the frame position, confirming that the character spacing in the zoomed text element is matched with the size of the corresponding frame position.
When scaling an image element, scaling may be performed in a manner that maintains an aspect ratio of a pattern of the image element, and when a size of the scaled pattern in the background canvas is equal to or slightly smaller than a size of a frame position of the image element, it is confirmed that the size of the scaled image element matches the size of the corresponding frame position.
As an optional implementation manner, before step S210, the method may further include:
acquiring a historical advertisement picture comprising the plurality of picture elements;
extracting the plurality of picture elements from the historical advertisement pictures, and the first relative position relation of the plurality of picture elements in the historical advertisement pictures.
In the above embodiment, the plurality of picture elements and the first relative position relationship can be obtained quickly by the historical advertisement picture, so that there is an advertisement picture that can quickly convert the size of the historical advertisement picture into a target size.
Understandably, the designer of the advertisement picture can design an advertisement picture as a historical advertisement picture according to the advertisement theme in advance. The historical advertisement picture may generally include a plurality of picture elements. When the advertisement picture of the advertisement topic needs to be applied to scenes with different aspect ratios, the electronic device 10 may extract all picture elements in the history advertisement picture from the history advertisement picture based on the history advertisement picture, and extract the relative position relationship between the picture elements as the first relative position relationship. In this way, the electronic device 10 can automatically generate a target advertisement picture with a target size according to the extracted picture element and the first relative position relationship, and by combining the corresponding aspect ratio.
Referring to fig. 3, fig. 4a and fig. 4b, fig. 3 can be understood as a layout diagram of historical advertisement pictures. Fig. 4a and 4b can be understood as two layout diagrams generated by the electronic device 10 based on the target size on the basis of fig. 3. The advertisement pictures each include a picture element A, B, C, D. The boxes of image element A, B may be referred to as frame positions of image elements, and C, D boxes may be understood as frame positions of text elements.
Understandably, the electronic device 10 can acquire all picture elements A, B, C, D in the historical advertisement pictures and the relative position relationship among the picture elements from fig. 3. Then, the electronic device 10 generates a background canvas with a target size according to the target size input by the user and by combining each picture element and the relative position relationship of the historical advertisement pictures, and then determines a new relative position relationship of each image element in the background canvas and a specific frame position of each picture element in the background canvas. Fig. 4a and 4b may be understood as two sets of relative positions of picture element A, B, C, D in the background canvas, respectively. Each set of relative positions includes one frame position of picture element A, B, C, D in the background canvas, each set of relative positions corresponding to one background canvas.
Based on the design, when historical advertisement pictures exist, designers can process the historical advertisement pictures through the electronic equipment 10 and then input corresponding target sizes, so that advertisement images with different aspect ratios can be obtained quickly. In addition, multiple advertisement pictures of different styles may be generated in the same aspect ratio size.
For example, when an advertisement picture with inconsistent aspect ratio is displayed on the online or offline of the real estate company or in other different scenes, after uploading the historical advertisement picture in PSD format to the electronic device 10, the user can input different aspect ratios (target sizes), and then the electronic device 10 can generate various advertisement pictures with target sizes by one key by using the above method, so as to save the time for frequently modifying the picture size by the designer and improve the picture making efficiency. Under the condition that the internal rules of the pictures are the same, the one-key expansion of all the advertisement pictures can be completed by simple layer replacement and applying the same layer marking strategy, and the efficiency of producing the advertisement pictures is improved.
In this embodiment, extracting the plurality of picture elements from the historical advertisement picture, and the first relative position relationship of the plurality of picture elements in the historical advertisement picture may include:
extracting the plurality of picture elements from the historical advertisement pictures;
converting each picture element in the plurality of picture elements into scatter points at corresponding positions in the historical advertisement picture respectively;
and determining a relative position relation corresponding to each scattered point through a triangulation algorithm to serve as the first relative position relation.
When the historical advertisement pictures are image files having layer attributes (e.g., images in PSD format), each layer typically includes only one pattern as an image element. The text element may be a text box inserted on the layer, or one text element may be presented by using one layer alone. Electronic device 10 may read each layer and text box in the historical advertisement pictures to extract a plurality of picture elements from the historical advertisement pictures.
Each picture element is then converted into a scatter, e.g. the center of gravity of the picture element as the scatter indicating the position of the picture element. The center of gravity of a picture element can be understood as the center of gravity of a pattern in the picture element or the center of gravity of a box region where text is located in the text element. By converting the picture elements into the scatter points, the relative position relation among the picture elements can be calculated through a triangulation algorithm. That is, the calculation of converting the positional relationship between the picture elements into the positional relationship between the scatter points.
When the triangulation algorithm is used for calculating the relative position relationship, corresponding connecting lines can be constructed for each scattered point to form a triangular network. Then, in the triangular network, the scatter points adjacent to each scatter point and the shortest-circuit segment number between any two scatter points are determined. Then, the relative positional relationship between the scattered points can be expressed by the adjacent relationship between the scattered points, the shortest-circuited stage number. The way of determining the relative position relationship by triangulation is well known to those skilled in the art and will not be described herein.
As an alternative implementation, step S220 may include:
according to the target size and the first relative position relation, taking each picture element as a scatter point, and determining an adjacent size corresponding to each scatter point;
and in the background canvas, according to the adjacent size corresponding to each picture element, determining a second relative position relation of each picture element and the frame position of each picture element in the background canvas by a triangular interpolation algorithm.
Understandably, the adjacent dimension of each scatter point can be understood as a line segment directly connected to the scatter point. The electronic device 10 may select one picture element from the plurality of picture elements as a reference element, paste the selected picture element in the background canvas, then, based on the position of the reference element in the background canvas, find 2 to 3 other picture elements nearest to the selected picture element in a manner of neighboring point matching according to the first relative position relationship, then paste the picture element adjacent to the selected reference element in other blank portions in the background canvas, and use the pasted picture element as a new reference element. Then, from the picture elements which are not selected, 2 to 3 picture elements which are nearest to the new reference element are found out by utilizing an adjacent point matching mode, and are pasted at other blank positions in the background canvas, and through cyclic interpolation, all the picture elements are pasted in the background canvas, so that the frame position and the second relative position relation of each picture element in the background canvas are obtained.
In this embodiment, when a plurality of advertisement pictures of different sizes need to be generated, the user may input different target sizes at one time, and then the advertisement pictures corresponding to each target size are automatically generated by the electronic device 10 according to the different target sizes. Or, each time the user inputs a target size, the electronic device 10 generates an advertisement picture of one target size according to the target size, then the user inputs another target size, and the electronic device 10 generates a new advertisement picture based on the new target size, and the process is repeated until the electronic device 10 generates a plurality of advertisement pictures of different sizes required by the user.
In this embodiment, the electronic device 10 may also make the generated advertisement pictures have diversity. For example, the electronic device 10 may change the alignment of the image elements and text elements in the background canvas, or change the spatial order of the image elements and text elements in the background canvas, and change the scaling of the image elements and text elements in the background canvas,
based on the above design, the electronic device 10 can generate corresponding advertisement pictures according to the user's requirements quickly, so that the generated advertisement pictures have the characteristics of various sizes, various types of layouts and the like, the generation efficiency of the advertisement pictures can be improved, and the types of the advertisement pictures are enriched, so that the user can select the advertisement pictures conveniently.
Referring to fig. 5, an image generating apparatus 100 is further provided in an embodiment of the present application, which can be applied to the electronic device 10 for executing steps of the method. The picture generating apparatus 100 includes at least one software functional module which can be stored in the storage module 12 in the form of software or Firmware (Firmware) or solidified in an Operating System (OS) of the electronic device 10. The processing module 11 is used for executing executable modules stored in the storage module 12, such as software functional modules and computer programs included in the picture generation apparatus 100.
The picture generating apparatus 100 may include an acquisition unit 110, a determination unit 120, a pasting unit 130, and an extension unit 140.
An obtaining unit 110, configured to obtain a target size of a pre-generated advertisement picture, a plurality of picture elements, and a first relative position relationship between the plurality of picture elements, where the picture elements include at least one of an image element and a text element, and the target size is within a preset size range;
a determining unit 120, configured to determine, according to the target size and the first relative positional relationship, a second relative positional relationship of the plurality of picture elements and frame positions of the plurality of picture elements in a background canvas of the target size, where the relative positional relationship of the plurality of picture elements in the background canvas is the same as the second relative positional relationship;
a pasting unit 130, configured to paste each picture element to a corresponding frame position in the background canvas;
the extending unit 140 is configured to extend each picture element attached to the background canvas by an extending algorithm, so as to obtain a target advertisement picture with the target size.
Optionally, the frame positions of the plurality of picture elements in the background canvas comprise a plurality of sets of relative positions, each set of relative positions comprising one frame position of each of the plurality of picture elements in the background canvas, each set of relative positions corresponding to one of the background canvas. The pasting unit 130 may be further configured to, for each of the background canvases, paste each of the picture elements to a frame position in the background canvases corresponding to each of the plurality of sets of relative positions. The extending unit 140 may be further configured to extend, for each of the background canvases, each of the picture elements attached to the background canvases by using an extending algorithm, so as to obtain the target advertisement picture corresponding to each group of relative positions.
Optionally, the extension unit 140 may be further configured to:
when the picture elements are text elements, zooming each text element pasted in the background canvas through the extension algorithm, wherein the character space in the zoomed text elements is matched with the size of the corresponding frame position;
when the picture elements are image elements, zooming each image element pasted in the background canvas through the extension algorithm, wherein the size of the zoomed image element is matched with the size of the corresponding frame position;
and obtaining the target advertisement picture with the target size.
Optionally, the picture generation apparatus 100 may further include an extraction unit. Before the obtaining unit 110 performs step S210, the obtaining unit 110 may be further configured to obtain a history advertisement picture including the plurality of picture elements; the extraction unit is used for: extracting the plurality of picture elements from the historical advertisement pictures, and the first relative position relation of the plurality of picture elements in the historical advertisement pictures.
Optionally, the extraction unit may be further configured to:
extracting the plurality of picture elements from the historical advertisement pictures;
converting each picture element in the plurality of picture elements into scatter points at corresponding positions in the historical advertisement picture respectively;
and determining a relative position relation corresponding to each scattered point through a triangulation algorithm to serve as the first relative position relation.
Optionally, the determining unit 120 may be further configured to:
according to the target size and the first relative position relation, taking each picture element as a scatter point, and determining an adjacent size corresponding to each scatter point;
and in the background canvas, according to the adjacent size corresponding to each picture element, determining a second relative position relation of each picture element and the frame position of each picture element in the background canvas by a triangular interpolation algorithm.
In this embodiment, the processing module 11 may be an integrated circuit chip having signal processing capability. The processing module 11 may be a general-purpose processor. For example, the Processor may be a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Network Processor (NP), or the like; the method, the steps and the logic block diagram disclosed in the embodiments of the present Application may also be implemented or executed by a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
The memory module 12 may be, but is not limited to, a random access memory, a read only memory, a programmable read only memory, an erasable programmable read only memory, an electrically erasable programmable read only memory, and the like. In this embodiment, the storage module 12 may be configured to store a target size, a plurality of picture elements, a first relative position relationship of the plurality of picture elements, a historical advertisement picture, and the like. Of course, the storage module 12 may also be used to store a program, and the processing module 11 executes the program after receiving the execution instruction.
It is understood that the configuration shown in fig. 1 is only a schematic configuration of the electronic device 10, and that the electronic device 10 may further include more components than those shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working process of the electronic device described above may refer to the corresponding process of each step in the foregoing method, and will not be described in detail herein.
The embodiment of the application also provides a computer readable storage medium. The computer-readable storage medium has stored therein a computer program which, when run on a computer, causes the computer to execute the picture generation method as described in the above embodiments.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by hardware, or by software plus a necessary general hardware platform, and based on such understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments of the present application.
In summary, the present application provides a picture generation method, an apparatus, an electronic device and a readable storage medium. The method comprises the following steps: acquiring a target size of a pre-generated advertisement picture, a plurality of picture elements and a first relative position relationship of the plurality of picture elements, wherein the picture elements comprise at least one of image elements and text elements, and the target size is within a preset size range; determining second relative position relations of the plurality of picture elements and frame positions of the plurality of picture elements in a background canvas with the target size according to the target size and the first relative position relations, wherein the relative position relations of the plurality of picture elements in the background canvas are the same as the second relative position relations; pasting each picture element to a corresponding frame position in the background canvas; and extending each picture element pasted in the background canvas by an extension algorithm to obtain a target advertisement picture with a target size. In the scheme, the picture elements can be extended in the background canvas within the preset size range, and the advertisement picture with the corresponding target size can be automatically generated, so that the generation efficiency of the advertisement picture can be improved, and the flexibility of adjusting the size of the advertisement picture is improved.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus, system, and method may be implemented in other ways. The apparatus, system, and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A picture generation method, characterized in that the method comprises:
acquiring a target size of a pre-generated advertisement picture, a plurality of picture elements and a first relative position relationship of the plurality of picture elements, wherein the picture elements comprise at least one of image elements and text elements, and the target size is within a preset size range;
determining second relative position relations of the plurality of picture elements and frame positions of the plurality of picture elements in a background canvas with the target size according to the target size and the first relative position relations, wherein the relative position relations of the plurality of picture elements in the background canvas are the same as the second relative position relations;
pasting each picture element to a corresponding frame position in the background canvas;
and extending each picture element attached in the background canvas by an extension algorithm to obtain the target advertisement picture with the target size.
2. The method of claim 1, wherein the frame positions of the plurality of picture elements in the background canvas comprise a plurality of sets of relative positions, each set of relative positions comprising one frame position of each picture element of the plurality of picture elements in the background canvas, each set of relative positions corresponding to one of the background canvas;
pasting each picture element to a corresponding frame position in the background canvas, comprising:
for each of the background canvases, pasting each of the picture elements to a frame position in the background canvases corresponding to each of the plurality of sets of relative positions;
extending each picture element pasted in the background canvas by an extension algorithm to obtain a target advertisement picture with a target size, including:
and aiming at each background canvas, extending each picture element attached in the background canvas through an extension algorithm to obtain the target advertisement picture corresponding to each group of relative positions.
3. The method of claim 1, wherein extending each of the picture elements attached to the background canvas by an extension algorithm to obtain the target advertising picture of the target size comprises:
when the picture elements are text elements, zooming each text element pasted in the background canvas through the extension algorithm, wherein the character space in the zoomed text elements is matched with the size of the corresponding frame position;
when the picture elements are image elements, zooming each image element pasted in the background canvas through the extension algorithm, wherein the size of the zoomed image element is matched with the size of the corresponding frame position;
and obtaining the target advertisement picture with the target size.
4. The method according to claim 1, wherein before acquiring the target size of the pre-generated advertisement picture, the plurality of picture elements, and the first relative positional relationship of the plurality of picture elements, the method further comprises:
acquiring a historical advertisement picture comprising the plurality of picture elements;
extracting the plurality of picture elements from the historical advertisement pictures, and the first relative position relation of the plurality of picture elements in the historical advertisement pictures.
5. The method according to claim 4, wherein extracting the plurality of picture elements from the historical advertisement picture, and wherein the first relative position relationship of the plurality of picture elements in the historical advertisement picture comprises:
extracting the plurality of picture elements from the historical advertisement pictures;
converting each picture element in the plurality of picture elements into scatter points at corresponding positions in the historical advertisement picture respectively;
and determining a relative position relation corresponding to each scattered point through a triangulation algorithm to serve as the first relative position relation.
6. The method of claim 1, wherein determining the second relative positional relationship of the plurality of picture elements and the frame positions of the plurality of picture elements in the background canvas of the target size according to the target size and the first relative positional relationship comprises:
according to the target size and the first relative position relation, taking each picture element as a scatter point, and determining an adjacent size corresponding to each scatter point;
and in the background canvas, according to the adjacent size corresponding to each picture element, determining a second relative position relation of each picture element and the frame position of each picture element in the background canvas by a triangular interpolation algorithm.
7. The method of claim 1, wherein the predetermined size range has an aspect ratio in the range of 0.2 to 13.
8. A picture generation apparatus, characterized in that the apparatus comprises:
the device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a target size of a pre-generated advertisement picture, a plurality of picture elements and a first relative position relationship of the plurality of picture elements, the picture elements comprise at least one of image elements and text elements, and the target size is within a preset size range;
a determining unit, configured to determine, according to the target size and the first relative positional relationship, a second relative positional relationship of the multiple picture elements and frame positions of the multiple picture elements in a background canvas of the target size, where the relative positional relationship of the multiple picture elements in the background canvas is the same as the second relative positional relationship;
the pasting unit is used for pasting each picture element to a corresponding frame position in the background canvas;
and the extension unit is used for extending each picture element attached in the background canvas through an extension algorithm to obtain the target advertisement picture with the target size.
9. An electronic device, characterized in that the electronic device comprises a processor and a memory coupled to each other, the memory storing a computer program which, when executed by the processor, causes the electronic device to perform the method according to any of claims 1-7.
10. A computer-readable storage medium, in which a computer program is stored which, when run on a computer, causes the computer to carry out the method according to any one of claims 1 to 7.
CN202011030360.8A 2020-09-25 2020-09-25 Picture generation method and device, electronic equipment and readable storage medium Pending CN112164127A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011030360.8A CN112164127A (en) 2020-09-25 2020-09-25 Picture generation method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011030360.8A CN112164127A (en) 2020-09-25 2020-09-25 Picture generation method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN112164127A true CN112164127A (en) 2021-01-01

Family

ID=73864111

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011030360.8A Pending CN112164127A (en) 2020-09-25 2020-09-25 Picture generation method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112164127A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023097990A1 (en) * 2021-11-30 2023-06-08 华为云计算技术有限公司 Element layout method and related device
CN117033844A (en) * 2023-10-07 2023-11-10 之江实验室 Canvas element layout method and device, storage medium and electronic equipment
CN117576247A (en) * 2024-01-17 2024-02-20 江西拓世智能科技股份有限公司 Picture generation method and system based on artificial intelligence
WO2024051632A1 (en) * 2022-09-09 2024-03-14 北京沃东天骏信息技术有限公司 Image processing method and apparatus, medium, and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105550980A (en) * 2014-10-29 2016-05-04 阿里巴巴集团控股有限公司 Image generation method and related apparatus
CN108959303A (en) * 2017-05-22 2018-12-07 阿里巴巴集团控股有限公司 A kind of exhibiting pictures generate, layout generation method and data processing server
CN110008450A (en) * 2018-01-05 2019-07-12 阿里巴巴集团控股有限公司 Generation method, device, equipment and the medium of picture
CN110660115A (en) * 2019-08-20 2020-01-07 海南车智易通信息技术有限公司 Method, device and system for generating advertisement picture
JP2020096763A (en) * 2018-12-19 2020-06-25 株式会社日立製作所 Image processing device and magnetic resonance imaging device
CN111462280A (en) * 2019-01-22 2020-07-28 北京嘀嘀无限科技发展有限公司 Picture generation method and device, electronic equipment and computer storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105550980A (en) * 2014-10-29 2016-05-04 阿里巴巴集团控股有限公司 Image generation method and related apparatus
CN108959303A (en) * 2017-05-22 2018-12-07 阿里巴巴集团控股有限公司 A kind of exhibiting pictures generate, layout generation method and data processing server
CN110008450A (en) * 2018-01-05 2019-07-12 阿里巴巴集团控股有限公司 Generation method, device, equipment and the medium of picture
JP2020096763A (en) * 2018-12-19 2020-06-25 株式会社日立製作所 Image processing device and magnetic resonance imaging device
CN111462280A (en) * 2019-01-22 2020-07-28 北京嘀嘀无限科技发展有限公司 Picture generation method and device, electronic equipment and computer storage medium
CN110660115A (en) * 2019-08-20 2020-01-07 海南车智易通信息技术有限公司 Method, device and system for generating advertisement picture

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023097990A1 (en) * 2021-11-30 2023-06-08 华为云计算技术有限公司 Element layout method and related device
WO2024051632A1 (en) * 2022-09-09 2024-03-14 北京沃东天骏信息技术有限公司 Image processing method and apparatus, medium, and device
CN117033844A (en) * 2023-10-07 2023-11-10 之江实验室 Canvas element layout method and device, storage medium and electronic equipment
CN117033844B (en) * 2023-10-07 2024-01-16 之江实验室 Canvas element layout method and device, storage medium and electronic equipment
CN117576247A (en) * 2024-01-17 2024-02-20 江西拓世智能科技股份有限公司 Picture generation method and system based on artificial intelligence
CN117576247B (en) * 2024-01-17 2024-03-29 江西拓世智能科技股份有限公司 Picture generation method and system based on artificial intelligence

Similar Documents

Publication Publication Date Title
CN112164127A (en) Picture generation method and device, electronic equipment and readable storage medium
US9953010B2 (en) Template-based page layout for hosted social magazines
US10769830B2 (en) Transferring vector style properties to a vector artwork
CN108038897B (en) Shadow map generation method and device
JP2010279038A (en) Method and system for electronic image real-time personalization
CN110674227A (en) Method, system, medium and terminal for generating data visualization chart and page
CN110969004A (en) Automatic typesetting method and system for image and text, server and medium
CN113849254A (en) Self-adaptive adjusting method of page layout and computing equipment
CN112717414B (en) Game scene editing method and device, electronic equipment and storage medium
CN102156688A (en) Character transforming effect processing method and device
CN109213316B (en) Automatic layout engine
CN106126140B (en) A kind of method, apparatus and electronic equipment of rendering type
CN115988170A (en) Method and device for clearly displaying Chinese and English characters in real-time video screen combination in cloud conference
CN113657396B (en) Training method, translation display method, device, electronic equipment and storage medium
US11562488B2 (en) Image content snapping guidelines
CN104516868A (en) Layout space streaming restoring method and layout space streaming restoring system
CN111161289B (en) Method and device for improving contour precision of object in image
CN112528596A (en) Rendering method and device for special effect of characters, electronic equipment and storage medium
CN115564976A (en) Image processing method, apparatus, medium, and device
US11776168B2 (en) Extracting textures from text based images
KR101651842B1 (en) Method and device for generating layout of electronic document
CN103839217A (en) Watermark image realization method
CN113626903A (en) Road curve setting method and device, electronic equipment and storage medium
CN112541954A (en) Method for intelligently producing poster according to graphic characteristics
CN110019589B (en) Electronic map display method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination