Image editing method and device, electronic equipment and storage medium

By calculating the compression coefficient of the puzzle canvas, dynamically match the fill image resolution, and generating the puzzle image, the problem of blurred image and poor display effect during the puzzle image generation is solved, and high-definition display is achieved.

CN119130796APending Publication Date: 2024-12-13BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411155443.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the prior art, there are problems of blurred image and poor display effect when generating puzzle images. This is mainly due to the limitation of fixed resolution, which leads to excessive use of computing resources, resulting in excessive compression of images, affecting clarity and display effect.

Method used

By obtaining the puzzle template and fill image, calculate the canvas compression coefficient of the puzzle canvas, dynamically match the resolution of the fill image, and generate the export resolution to generate the puzzle image, so that it improves clarity without exceeding the maximum resolution.

Benefits of technology

It effectively reduces image blur, improves the display effect of puzzle images, and ensures high-definition display of puzzle images without exceeding the maximum resolution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119130796A_ABST
    Figure CN119130796A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image editing method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a jigsaw template and a corresponding filling image, the jigsaw template represents the layout of at least two jigsaw canvases, and the jigsaw canvases are used for bearing the corresponding filling image; according to the image resolution of the filling image and the canvas resolution of the corresponding puzzle canvas, a canvas compression coefficient of the puzzle canvas is obtained, and the canvas compression coefficient represents a resolution compression ratio of the puzzle canvas; and according to the canvas compression coefficient of the jigsaw canvas, obtaining the export resolution of the jigsaw template, and generating a jigsaw image based on the export resolution. The canvas compression coefficient of each puzzle canvas is obtained based on the canvas resolution of the puzzle canvas and the image resolution of each filling image, so that the derived resolution is obtained and the puzzle image based on the derived resolution is generated, the image resolution of each filling image is dynamically matched, and the display effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of image processing technology, and in particular to an image editing method, device, electronic device, and storage medium. Background Art

[0002] Currently, using the puzzle template in the video editing application (Application, APP), multiple pictures can be spliced ​​into a puzzle image according to a certain layout, thereby realizing personalized multi-picture design and display, which is often used in video production scenarios to generate video covers, video illustrations, etc.

[0003] In the prior art, in order to control the computational resource overhead of the generated puzzle image, a fixed resolution is usually set for the puzzle template, and the puzzle image is generated based on the resolution.

[0004] However, the jigsaw puzzle images generated by the solutions in the prior art have the problems of blurred images and poor display effects. Summary of the invention

[0005] The embodiments of the present disclosure provide an image editing method, device, electronic device and storage medium to overcome the problems of blurred images and poor display effects of puzzle images.

[0006] In a first aspect, an embodiment of the present disclosure provides an image editing method, comprising:

[0007] A puzzle template and a corresponding fill image are obtained, wherein the puzzle template represents a layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding fill images; a canvas compression coefficient of the puzzle canvas is obtained according to an image resolution of the fill image and a canvas resolution of the corresponding puzzle canvas, and the canvas compression coefficient represents a resolution compression ratio of the puzzle canvas; an exported resolution of the puzzle template is obtained according to the canvas compression coefficient of the puzzle canvas, and a puzzle image is generated based on the exported resolution, wherein the exported resolution is less than or equal to the maximum resolution.

[0008] In a second aspect, an embodiment of the present disclosure provides an image editing device, comprising:

[0009] An acquisition module, used to acquire a puzzle template and a corresponding filling image, wherein the puzzle template represents a layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding filling image;

[0010] A processing module, configured to obtain a canvas compression coefficient of the puzzle canvas according to an image resolution of the filling image and a canvas resolution of the corresponding puzzle canvas, wherein the canvas compression coefficient represents a resolution compression ratio of the puzzle canvas;

[0011] An output module is used to obtain an export resolution of the puzzle template according to a canvas compression coefficient of the puzzle canvas, and generate a puzzle image based on the export resolution, wherein the export resolution is less than or equal to the maximum resolution.

[0012] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;

[0013] The memory stores computer-executable instructions;

[0014] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the image editing method as described in the first aspect and the possible design of the first aspect above.

[0015] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the image editing method described in the first aspect and the possible design of the first aspect is implemented.

[0016] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the image editing method described in the first aspect and the possible design of the first aspect.

[0017] The image editing method, device, electronic device and storage medium provided in the present embodiment obtain a puzzle template and a corresponding filling image, wherein the puzzle template represents the layout of at least two puzzle canvases, and the puzzle canvas is used to carry the corresponding filling image; according to the image resolution of the filling image and the canvas resolution of the corresponding puzzle canvas, a canvas compression coefficient of the puzzle canvas is obtained, and the canvas compression coefficient represents the resolution compression ratio of the puzzle canvas; according to the canvas compression coefficient of the puzzle canvas, an export resolution of the puzzle template is obtained, and a puzzle image is generated based on the export resolution, wherein the export resolution is less than or equal to the maximum resolution. After obtaining the puzzle template and the corresponding filling image, the canvas compression coefficient of the puzzle canvas is obtained based on the canvas resolution of the puzzle canvas and the image resolution of the filling image, and then the export resolution is obtained and a puzzle image based on the export resolution is generated, so that the puzzle image based on the export resolution can dynamically match the image resolution of the filling image without exceeding the maximum resolution, so that its clarity reaches a high level, thereby reducing image blur and improving display effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0019] Figure 1 An application scenario diagram of the image editing method provided by the embodiment of the present disclosure;

[0020] Figure 2 Schematic diagram of the process of the image editing method provided by the embodiment of the present disclosure Figure 1 ;

[0021] Figure 3 for Figure 2 A flowchart of a specific implementation method of step S102 in the illustrated embodiment;

[0022] Figure 4 A schematic diagram of a process for determining a canvas weight provided by an embodiment of the present disclosure;

[0023] Figure 5 for Figure 3 A flowchart of a specific implementation method of step S1022 in the illustrated embodiment;

[0024] Figure 6 A schematic diagram of the distribution of a jigsaw puzzle canvas in a jigsaw puzzle template provided in an embodiment of the present disclosure;

[0025] Figure 7 for Figure 2 A flowchart of a specific implementation method of step S103 in the illustrated embodiment;

[0026] Figure 8 Schematic diagram of the process of the image editing method provided by the embodiment of the present disclosure Figure 2 ;

[0027] Fig. 9 A schematic diagram of a process for obtaining an export resolution of a picture template provided by an embodiment of the present disclosure;

[0028] Fig.10 A structural block diagram of an image editing device provided by an embodiment of the present disclosure;

[0029] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;

[0030] Fig.12 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0032] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0033] The application scenarios of the embodiments of the present disclosure are explained below:

[0034] Figure 1 This is an application scenario diagram of the image editing method provided in the embodiment of the present disclosure. The image editing method provided in the embodiment of the present disclosure can be applied to an application (APP, Application) with a puzzle function, such as a video editing application, a short video application, and the like. More specifically, it can be applied to an application scenario in which a puzzle image is generated based on a puzzle template. The execution subject of this embodiment can be a terminal device that runs the above-mentioned application with a puzzle function, or a server that deploys the service end corresponding to the above-mentioned application, or other electronic devices that perform similar functions.

[0035] Among them, in some embodiments, the terminal device or server can implement the image editing method provided by the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be program-level commands, machine instructions or software instructions. The computer program can be a native program or software module in the operating system; it can be a local application, that is, a program that needs to be installed in the operating system to run, or it can be a small program embedded in any APP, that is, a program that runs based on a browser environment. In summary, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form, and the specific implementation form can be configured as needed. Further, in some embodiments, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud storage, cloud communication, cloud database, cloud computing, cloud functions, network services, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms, wherein the cloud service can be an interactive processing service for terminal devices to call.

[0036] refer to Figure 1 As shown in , taking a terminal device as an example, after running a video editing application, by responding to user operations, a puzzle template M1 is loaded from the puzzle templates to be selected provided by the application (such as puzzle template M1, puzzle template M2, etc. shown in the figure), and puzzle template M1 includes multiple puzzle canvases, such as puzzle canvas #1, puzzle canvas #2, and puzzle canvas #3 shown in the figure. Afterwards, in further response to the user's image loading operation, corresponding filling images are filled in the above puzzle canvas #1, puzzle canvas #2, and puzzle canvas #3, respectively, and then, based on the size and layout of the above puzzle canvases, the filling images are rendered as a whole to generate a puzzle image, thereby realizing the puzzle function of multiple frames of images.

[0037] In the prior art, in the process of generating a puzzle image based on a puzzle template, in order to avoid excessive use of computing resources, resulting in problems such as terminal operation lag and excessive server load, the system usually limits the export resolution of the final exported puzzle image. At the same time, the fill images selected by the user usually have different image resolutions. In this case, when setting the image resolution of the puzzle image in the prior art, the minimum resolution of each fill image is usually used as the export resolution of the puzzle image. However, in the above-mentioned scheme in the prior art, when the minimum resolution of each fill image is used as the export resolution of the puzzle image, other fill images will be over-compressed, thereby affecting the clarity and display effect of the generated puzzle image.

[0038] The embodiment of the present disclosure provides an image editing method to solve the above-mentioned problem.

[0039] refer to Figure 2 , Figure 2 Schematic diagram of the process of the image editing method provided by the embodiment of the present disclosure Figure 1 The method of this embodiment can be applied in a terminal device. The image editing method includes:

[0040] Step S101: obtaining a puzzle template and a corresponding filling image, wherein the puzzle template represents the layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding filling image.

[0041] For example, reference Figure 1 The application scenario schematic diagram shown in the embodiment is described by taking the case where the terminal device is executed as an example. Specifically, after the terminal device runs the above-mentioned application with a puzzle function (such as a video editing application, hereinafter referred to as the application), the puzzle function can be provided to the user by means of a function control. After that, the user triggers the function control by operating the application, and selects the corresponding puzzle template, and adds a fill image to each puzzle canvas in the puzzle template. The above process and the process in which the terminal device obtains the puzzle template and the corresponding fill image. Among them, there are many user operation methods to implement the above process, for example, by clicking the puzzle function control, a plurality of puzzle templates to be selected are displayed, and each puzzle template represents a puzzle layout composed of more than two puzzle canvases, wherein the puzzle layout is information describing the canvas size of at least two puzzle canvases and the positional relationship between the canvases. The canvas is used to carry the corresponding fill image, realize the control of the image size and position of the fill image, and finally realize the purpose of controlling the layout style of the puzzle image. The above-mentioned puzzle canvas has different implementation methods under different operating systems and drawing components, but its concept is the prior art known to those skilled in the art, and will not be repeated here.

[0042] Step S102: obtaining a canvas compression coefficient of the puzzle canvas according to the image resolution of the filling image and the canvas resolution of the corresponding puzzle canvas, wherein the canvas compression coefficient represents a resolution compression ratio of the puzzle canvas.

[0043] Exemplarily, after the terminal device obtains the puzzle template and the corresponding filling image, first, the maximum resolution corresponding to the puzzle template and the image resolution of each filling image are obtained, wherein the sum of the canvas resolutions of the puzzle canvas is the maximum resolution of the puzzle template. Exemplarily, the maximum resolution is the maximum size, which is represented by two values, the horizontal size and the vertical size, such as 2048*1024. The maximum resolution corresponding to the puzzle template is the size restriction condition for the puzzle image finally generated, so that its horizontal size and vertical size do not exceed the corresponding values. For example, based on the above example, the horizontal size of the puzzle image is 2048 at most and the vertical size is 1024 at most. The canvas resolution (size) of the puzzle canvas is the result of splitting the maximum resolution. Taking the horizontal size as an example, the maximum horizontal size corresponding to the maximum resolution is 2048. Then, for example, the horizontal sizes of the two puzzle canvases can be 512 and 1536 respectively. The situation of the vertical size is similar and will not be repeated. The specific value of the canvas resolution of the puzzle canvas is a description of the layout of the puzzle canvas in the puzzle template.

[0044] Among them, the maximum resolution corresponding to the puzzle template can be a parameter value at the system level, that is, all puzzle templates correspond to a fixed maximum resolution, such as 2048*1024. The maximum resolution corresponding to the puzzle template can also be a parameter value at the template level, that is, each puzzle template corresponds to a unique maximum resolution, for example, puzzle template mod_1, the corresponding maximum resolution is 2048*1024; puzzle template mod_2, the corresponding maximum resolution is 4096*1024. The maximum resolution corresponding to the puzzle template can be recorded in a preloaded configuration file, and the specific implementation method can be set as needed. Afterwards, based on the coordinate information of the layout style of each puzzle canvas, such as the segmentation point, segmentation coordinates, and segmentation ratio coefficient recorded in the puzzle template, the canvas resolution of each puzzle canvas is determined. Among them, on the other hand, the image resolution of the fill image, that is, the resolution of the fill image itself, that is, the size of the pixel matrix constituting the fill image, after the corresponding fill image is loaded in response to the user's selection operation, the terminal device can obtain the image resolution corresponding to the fill image.

[0045] Afterwards, the terminal device obtains the corresponding canvas compression coefficient according to the image resolution of each filling image and the canvas resolution of the corresponding puzzle canvas, for example, according to the ratio of the image resolution to the maximum resolution in the horizontal direction. The canvas compression coefficient represents the resolution compression ratio of the puzzle canvas. Therefore, when the image resolution is greater than or equal to the maximum resolution in the target direction, the corresponding resolution compression ratio is greater than or equal to 1, that is, the filling image needs to be compressed; and when the image resolution is less than the maximum resolution in the target direction, the corresponding resolution compression ratio is less than 1. At this time, the filling image may need to be compressed or enlarged. The canvas compression coefficient represents the resolution compression ratio of the puzzle canvas, that is, the degree of compression of the resolution of the filling image carried by the puzzle canvas. Since different filling images have different resolutions, they are given a matching compression ratio, so that the final derived resolution can take both into account and avoid the problem of too small resolution.

[0046] In one possible implementation, Figure 3 As shown, the specific implementation of step S102 includes:

[0047] Step S1021: Obtaining a pixel filling rate corresponding to the jigsaw canvas according to a ratio of an image resolution of the filling image to a canvas resolution of the corresponding jigsaw canvas in a target direction.

[0048] Step S1022: according to the area of ​​the puzzle canvas, a corresponding canvas weight is obtained, where the canvas weight represents the area ratio of the puzzle canvas in the puzzle template.

[0049] Step S1023: Obtain a canvas compression coefficient of the puzzle canvas according to the product of the pixel filling rate and the corresponding canvas weight.

[0050] For example, Figure 3 As shown, first, according to the ratio of the image resolution of each filling image to the canvas resolution of the corresponding jigsaw canvas in the target direction, the corresponding pixel filling rate is obtained. The calculation steps have been introduced in the previous part and will not be repeated here. The pixel filling rate obtained in this step can characterize the compressible / interpolation multiple of the filling image. Usually, the image resolution of the filling image will be greater than the maximum resolution. Therefore, the ratio of the image resolution of the filling image to the maximum resolution, that is, the pixel filling rate, is a value greater than 1.

[0051] In a possible implementation, after step S101, this embodiment further includes:

[0052] Step S102A: In response to the first operation instruction, obtain at least one scaling factor of the puzzle canvas, where the scaling factor represents a scaling ratio of the filling image in the puzzle canvas.

[0053] Exemplarily, in a possible implementation, after loading the puzzle template and the corresponding filling image, the terminal device can adjust the display size of the filling image set in the puzzle canvas by responding to the first operation instruction input by the user, wherein the first operation instruction has multiple implementations, for example, for a mobile terminal, the first operation instruction is, for example, an instruction generated by the operation of "sliding two fingers toward each other", thereby changing the display size of the filling image, that is, "zooming in" or "reducing" it. After the display size of the filling image is changed, the corresponding zoom factor is obtained according to the specific value contained in the first operation instruction, such as the sliding length, and the zoom factor represents the zoom ratio of the filling image in the puzzle canvas, that is, the multiple of enlargement or reduction. Among them, the zoom factor can be the overall zoom multiple for the filling image set in the puzzle canvas, or it can be the horizontal or vertical zoom multiple for the filling image, which can be set as needed.

[0054] Accordingly, the specific implementation of step S1021 includes:

[0055] Step S1021A: obtaining an actual image resolution of at least one filling image according to the scaling factor of the puzzle canvas and the image resolution of the corresponding filling image.

[0056] Step S1021B: Obtain a corresponding pixel filling rate according to a ratio of an actual image resolution of the filling image to a canvas resolution of the corresponding jigsaw canvas in a target direction.

[0057] Exemplarily, after scaling the display size of the fill image set in the jigsaw canvas in response to the first operation instruction, the corresponding image resolution also changes. For example, after the fill image is reduced, the corresponding image resolution will also decrease. Therefore, according to the above-mentioned scaling factor and the image resolution of the fill image, the actual image resolution of the corresponding fill image after scaling can be obtained. Afterwards, the corresponding pixel fill rate is obtained according to the ratio of the actual image resolution of the fill image to the canvas resolution of the corresponding jigsaw canvas in the target direction. Among them, the calculation step of the pixel fill rate has been introduced in detail in the previous embodiment steps and will not be repeated here.

[0058] In the steps of this embodiment, by responding to the first operation instruction, the fill image set in the puzzle canvas is scaled and the corresponding scaling factor is obtained. Then, the actual image resolution of the scaled fill image is calculated by combining the scaling factor, thereby realizing the function of further modifying and adjusting the fill image after loading, thereby improving the style diversity and design flexibility of the puzzle image.

[0059] Further, exemplarily, after obtaining the pixel fill rate corresponding to each puzzle canvas, the area of ​​each puzzle canvas is obtained, and the canvas weight is obtained according to the area of ​​the filled image. Among them, the area of ​​the puzzle canvas can be the number of pixels in the pixel matrix of the filled image, and the number of pixels can be the information recorded in the puzzle template. For example, if the resolution of the puzzle canvas is 800*800, then the corresponding pixel area can be the product of 800 and 800, that is, 640000 (which can be expressed as 640k, k is approximately expressed as 1000). In a possible implementation, different area ranges can be mapped to corresponding canvas weights according to a preset area-weight mapping information table. Figure 4 A schematic diagram of a process for determining a canvas weight provided by an embodiment of the present disclosure is shown in FIG. Figure 4 As shown, according to the pre-configured area-weight mapping information table, the jigsaw canvas with an area between [640k, 1280k), such as jigsaw canvas L1, has a corresponding canvas weight of 1; the jigsaw canvas with an area between [1280k, 2560k), such as fill image L2, has a corresponding canvas weight of 2, and so on. In the above manner, the canvas weight of each jigsaw canvas in the jigsaw template can be determined.

[0060] In another possible implementation, Figure 5 As shown, the specific implementation of step S1022 includes:

[0061] Step S1022A: Obtain a first number of pixels representing the area of ​​the puzzle canvas and a second number of pixels corresponding to the maximum resolution.

[0062] Step S1022B: Obtaining a canvas weight of the corresponding puzzle canvas according to the ratio of the first pixel number to the second pixel number.

[0063] Exemplarily, for the puzzle canvas and the maximum resolution, the corresponding pixel counts, namely, a plurality of first pixel counts and a second pixel count, are counted respectively, and then the ratio of each first pixel count to the second pixel count is calculated respectively to obtain the canvas weight of the corresponding puzzle canvas. Figure 6 A schematic diagram of the distribution of a jigsaw puzzle canvas in a jigsaw puzzle template provided in an embodiment of the present disclosure, such as Figure 6As shown, exemplarily, the puzzle canvases in the puzzle template include puzzle canvas L1, puzzle canvas L2 and puzzle canvas L3, wherein the size (resolution) of puzzle canvas L1 is 1600*1500, and the corresponding first pixel number N1 is 2400k, that is, the area size is 2400k. Similarly, the size (resolution) of puzzle canvas L2 is 2400*1500, and the corresponding first pixel number N2 is, for example, 3600k, that is, the area size is 2400k; the size (resolution) of puzzle canvas L3 is 4000*1500, and the corresponding first pixel number N3 is 6000k, that is, the area size is 6000k. The maximum resolution is 4000*3000, and the corresponding second pixel number is 12000k. According to the ratio of the first pixel numbers to the second pixel numbers, the canvas weight of the puzzle canvas L1 is 0.2, the canvas weight of the puzzle canvas L2 is 0.3, and the canvas weight of the puzzle canvas L3 is 0.5.

[0064] Afterwards, the canvas compression coefficient is obtained according to the product of the pixel filling rate and the corresponding canvas weight. For example, the pixel filling rate of the puzzle canvas L1 is 1.25, the canvas weight is 0.2, and the corresponding canvas compression coefficient is 0.25.

[0065] In this embodiment, the corresponding canvas compression coefficient is obtained by respectively obtaining the area of ​​the puzzle canvas and the pixel fill rate corresponding to the puzzle canvas. Since the influence of the area of ​​the puzzle canvas and the pixel fill rate on the image display effect is taken into consideration, the obtained canvas compression coefficient can better adapt to the area size of the puzzle canvas and the resolution of the filled image it carries. Among them, the larger the area size of the puzzle canvas, the greater the influence weight, which increases the influence of the large-area puzzle canvas on the final exported resolution, so that the image in the large-area puzzle canvas (such as the main image in the puzzle image) is closer to the exported resolution of the final output puzzle image, thereby having a better display effect.

[0066] Step S103: obtaining an export resolution of the puzzle template according to the canvas compression coefficient of the puzzle canvas, and generating a puzzle image based on the export resolution.

[0067] For example, after obtaining the canvas compression coefficients of each puzzle canvas, the canvas compression coefficients of each puzzle canvas are merged and then multiplied by the maximum resolution of the puzzle template to obtain the derived resolution of the puzzle template. Figure 7 As shown, the specific implementation of step S103 includes:

[0068] Step S1031: Calculate the cumulative sum of the canvas compression coefficients of the puzzle canvas to obtain the cumulative compression coefficient.

[0069] Step S1032: Obtain the export resolution of the puzzle template according to the product of the maximum resolution and the cumulative compression coefficient.

[0070] Specifically, after obtaining the canvas compression coefficient of each puzzle canvas, the weighted sum of the canvas compression coefficients of each puzzle canvas is calculated, wherein the weighted coefficients between the canvas compression coefficients can be implemented in a variety of ways, for example, according to the position of the puzzle canvas, the corresponding position weighted coefficient is set, and when the puzzle canvas is located in the main position (such as the center position) in the puzzle template, a larger weighted coefficient is set to increase the proportion of its canvas compression coefficient in the cumulative scaling coefficient. Of course, the weighted coefficients can also be set according to other specific needs, for example, the weighted coefficients are all 1. Afterwards, the product of the canvas compression coefficient of each puzzle canvas and the weighted coefficient is calculated, and the cumulative compression coefficient is obtained by accumulating them. After that, the product of the cumulative compression coefficient and the maximum resolution of the puzzle template is calculated to obtain the ideal resolution of the puzzle image generated by the puzzle template, that is, the derived resolution. For example, the canvas compression coefficient corresponding to the jigsaw canvas L1 is 0.25, the canvas compression coefficient corresponding to the jigsaw canvas L2 is 0.375, and the canvas compression coefficient corresponding to the jigsaw canvas L3 is 0.3125. The maximum resolution is 4000*3000, and the weighting coefficients are all 1. The final exported resolution is:

[0071] Export resolution = (4000*3000)*0.9375 = (3750,2812)

[0072] After that, the above-mentioned filled image is rendered based on the export resolution to generate a puzzle image.

[0073] In this embodiment, a jigsaw puzzle template and a corresponding filling image are obtained, wherein the jigsaw puzzle template represents the layout of at least two jigsaw puzzle canvases, and each jigsaw puzzle canvas is used to carry a corresponding filling image; a canvas compression coefficient of each jigsaw puzzle canvas is obtained according to the image resolution of each filling image and the canvas resolution of the corresponding jigsaw puzzle canvas, and the canvas compression coefficient represents the resolution compression ratio of the jigsaw puzzle canvas; a derived resolution of the jigsaw puzzle template is obtained according to the canvas compression coefficient of each jigsaw puzzle canvas, and a jigsaw puzzle image is generated based on the derived resolution, wherein the derived resolution is less than or equal to the maximum resolution. After obtaining the jigsaw puzzle template and the corresponding filling image, the canvas compression coefficient of each jigsaw puzzle canvas is obtained based on the canvas resolution of the jigsaw puzzle canvas and the image resolution of each filling image, and then the derived resolution is obtained and a jigsaw puzzle image based on the derived resolution is generated, so that the jigsaw puzzle image based on the derived resolution can dynamically match the image resolution of each filling image without exceeding the maximum resolution, so that its clarity reaches a high level, thereby reducing image blur and improving display effects.

[0074] refer to Figure 8 , Figure 8 Schematic diagram of the process of the image editing method provided by the embodiment of the present disclosure Figure 2 In this embodiment Figure 2 On the basis of the embodiment shown, a step of adjusting the puzzle canvas and the filling image is further added, and the image editing method includes:

[0075] Step S201: Acquire a puzzle template and a corresponding filling image, wherein the puzzle template represents the layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding filling image.

[0076] Step S202: Based on the target side size of the puzzle canvas in the puzzle template in the target direction, scale the corresponding filling image so that the target side of the filling image is equal in length to the target side of the corresponding puzzle canvas.

[0077] Step S203: based on the non-target side size of the jigsaw canvas, the non-target side of the scaled filling image is cropped to obtain a formatted filling image.

[0078] Exemplarily, the shape of the puzzle canvas in the puzzle template is a rectangle, which has rectangular sides (edges) extending in two vertical directions, namely, long sides and short sides, or called horizontal sides and longitudinal sides, horizontal sides and vertical sides, etc. Wherein, as needed, the above-mentioned sides extending in one direction can be determined as target sides, and the sides extending in another direction can be determined as non-target sides. For example, the long side of the rectangular puzzle canvas is determined as the target side, and the short side is determined as the non-target side; or, the horizontal side of the puzzle canvas is determined as the target side, and the longitudinal side is determined as the non-target side, and so on. Based on the above settings, after loading the puzzle template and the corresponding filling image, the terminal device scales the corresponding filling image based on the target side size of each puzzle canvas in the puzzle template in the target direction, so that when the filling image is displayed in the puzzle canvas, it can be fully displayed in the direction corresponding to the target side. For example, based on the horizontal side of the puzzle canvas, the corresponding filling image is scaled so that the horizontal side of the filling image is equal to the horizontal side of the corresponding puzzle canvas, so that the filling image can fully display the corresponding image content in the direction of the horizontal side extension. On the other hand, based on the non-target side size of the puzzle canvas, such as the longitudinal side size of the puzzle canvas, the non-target side of the scaled filling image is cropped and / or cut to obtain a filling image that can fill the puzzle canvas in at least one direction, that is, a formatted filling image. After the formatted filling image is generated, since the image size of the formatted filling image has changed, the corresponding image resolution has also changed accordingly. In the subsequent steps, the derived resolution is calculated based on the image resolution of the changed filling image (formatted filling image), so that the derived resolution can be more accurate, so that the filling image displayed based on the puzzle canvas of a specific size has better clarity and display effect.

[0079] At the same time, it should be noted that the formatted fill image can be a new image obtained after performing actual pixel value fusion, interpolation, cropping and other processing steps on the fill image; the formatted fill image can also be the result of logical processing of the fill image, for example, the formatted fill image is a part of the fill image, and the representation of the formatted fill image is achieved through the fill image and the corresponding pixel position coordinates, which can be set specifically as needed.

[0080] Optionally, after step S202, the method further includes:

[0081] Step S202A: centering the scaled filling image in the corresponding puzzle canvas.

[0082] Exemplarily, after the fill image is scaled, the target edge of the scaled fill image is aligned with the target edge of the puzzle canvas, but the non-target edge may be in a non-aligned state. In this case, the fill image corresponding to the scaling can be first moved along the non-target edge direction so that it is in the center of the puzzle canvas, that is, the scaled fill image is centered in the corresponding puzzle canvas. Correspondingly, after executing step S202A, the specific implementation method of step S203 includes: based on the non-target edge size of the puzzle canvas, symmetrically cropping the non-target edges at both ends of the scaled fill image to obtain a formatted fill image. After the scaled fill image is centered in the corresponding puzzle canvas, the non-target edges of the scaled fill image are cropped at both ends so that the cropped fill image is completely set in the puzzle canvas to obtain a formatted fill image.

[0083] In this embodiment, by centering the scaled filling image, the display effect of the filling image can be further improved, and the actual image resolution can be made more accurate, thereby improving the clarity of each filling image in the finally generated puzzle image.

[0084] Step S204: Obtaining a canvas compression factor of the puzzle canvas according to the maximum resolution corresponding to the puzzle template and the image resolution of the formatted filling image.

[0085] For example, after obtaining the image resolution of each formatted filling image, the corresponding pixel filling rate is calculated using the image resolution of each formatted filling image, and then the corresponding canvas weight is obtained according to the area of ​​the puzzle canvas corresponding to each formatted filling image; then, for example, the product of the pixel filling rate and the canvas weight can be used to obtain the canvas compression coefficient of each puzzle canvas. The specific process of calculating the canvas compression coefficient can be referred to Figure 2 The process of calculating the canvas compression coefficient in the illustrated embodiment will not be described in detail here.

[0086] Step S205: obtaining an export resolution of the puzzle template according to the canvas compression coefficient of the puzzle canvas, and generating a puzzle image based on the export resolution.

[0087] Fig. 9 A schematic diagram of a process for obtaining an export resolution of an image template provided by an embodiment of the present disclosure is shown below in conjunction with Fig. 9 For a more detailed description of the above embodiments, refer to Fig. 9 As shown, first, the terminal device obtains the puzzle template Mod_1 based on the user's trigger operation, and the puzzle template Mod_1 includes puzzle canvases L1, L2 and L3 with the layout style shown in the figure, and filling images P1, P2 and P3 used to fill the above puzzle canvases. As shown in the figure, the above puzzle canvases L1, L2 and L3 correspond to the filling images P1, P2 and P3 one by one. Afterwards, the terminal device stretches, crops and centers the filling images P1, P2 and P3 based on the sizes of the puzzle canvases L1, L2 and L3, and obtains the corresponding formatted filling images Ps1, Ps2 and Ps3 (hereinafter referred to as Ps1, Ps2 and Ps3). After that, the pixel filling rates Ps1_v, Ps2_v and Ps3_v and canvas weights Ps1_w, Ps2_w and Ps3_w corresponding to the formatted filling images Ps1, Ps2 and Ps3 are calculated, and then the canvas compression coefficients Ps1_coef, Ps2_coef and Ps3_coef corresponding to each puzzle canvas are obtained according to the product of the pixel filling rate and the corresponding canvas weight. Finally, the product of the cumulative and maximum resolution of Ps1_coef, Ps2_coef and Ps3_coef is calculated to obtain the exported resolution of the puzzle template Mod_1.

[0088] In this embodiment, the implementation of step S201 and step S205 is the same as that of the present disclosure. Figure 2 The implementation methods of step S101 and step S103 in the illustrated embodiment are the same and will not be described in detail herein.

[0089] Corresponding to the image editing method of the above embodiment, Fig.10 This is a block diagram of the structure of the image editing device provided in the embodiment of the present disclosure. The method introduced in the above embodiment can be executed by the image editing device, which can be implemented by software and / or hardware, and can be integrated in an electronic device with certain data processing functions. The electronic device can include but is not limited to mobile terminals with big data processing capabilities, as well as fixed terminals with big data processing capabilities such as desktop computers and supercomputers.

[0090] For the sake of convenience, only the parts related to the embodiments of the present disclosure are shown. Fig.10 , the image editing device 3 comprises:

[0091] An acquisition module 31 is used to acquire a puzzle template and a corresponding filling image, wherein the puzzle template represents a layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding filling image;

[0092] The processing module 32 is used to obtain a canvas compression coefficient of the puzzle canvas according to the image resolution of the filling image and the canvas resolution of the corresponding puzzle canvas, wherein the canvas compression coefficient represents the resolution compression ratio of the puzzle canvas, and the sum of the canvas resolutions of the puzzle canvas is the maximum resolution of the puzzle template;

[0093] The output module 33 is used to obtain the export resolution of the puzzle template according to the canvas compression coefficient of the puzzle canvas, and generate the puzzle image based on the export resolution, wherein the export resolution is less than or equal to the maximum resolution.

[0094] According to one or more embodiments of the present disclosure, the processing module 32 is specifically used to: obtain a pixel fill rate corresponding to the puzzle canvas according to a ratio of an image resolution of a filling image to a canvas resolution of a corresponding puzzle canvas in a target direction; obtain a corresponding canvas weight according to an area of ​​the puzzle canvas, where the canvas weight represents the area ratio of the puzzle canvas in the puzzle template; and obtain a canvas compression coefficient of the puzzle canvas according to the product of the pixel fill rate and the corresponding canvas weight.

[0095] According to one or more embodiments of the present disclosure, the processing module 32 is further used to: obtain a scaling factor of at least one puzzle canvas in response to a first operation instruction, the scaling factor representing a scaling ratio of the fill image within the puzzle canvas; when the processing module 32 obtains the corresponding pixel fill rate according to the ratio of the image resolution of the fill image to the canvas resolution of the corresponding puzzle canvas in the target direction, the processing module 32 is specifically used to: obtain an actual image resolution of at least one fill image according to the scaling factor of the puzzle canvas and the image resolution of the corresponding fill image; obtain the corresponding pixel fill rate according to the ratio of the actual image resolution of the fill image to the canvas resolution of the corresponding puzzle canvas in the target direction.

[0096] According to one or more embodiments of the present disclosure, when the processing module 32 obtains the corresponding canvas weight according to the area of ​​the puzzle canvas, it is specifically used to: obtain a first number of pixels representing the area of ​​the puzzle canvas, and a second number of pixels corresponding to the maximum resolution; and obtain the corresponding canvas weight of the puzzle canvas according to the ratio of the first number of pixels to the second number of pixels.

[0097] According to one or more embodiments of the present disclosure, the output module 33 is specifically used to: calculate the cumulative sum of the canvas compression coefficients of the puzzle canvas to obtain the cumulative compression coefficient; and obtain the derived resolution of the puzzle template according to the product of the maximum resolution and the cumulative compression coefficient.

[0098] According to one or more embodiments of the present disclosure, after obtaining the puzzle template and the corresponding fill image, the processing module 32 is further used to: scale the corresponding fill image based on the target side size of the puzzle canvas in the target direction in the puzzle template so that the target side of the fill image is equal to the target side of the corresponding puzzle canvas; crop the non-target side of the scaled fill image based on the non-target side size of the puzzle canvas to obtain a formatted fill image; when obtaining the canvas compression coefficient of the puzzle canvas based on the image resolution of the fill image and the canvas resolution of the corresponding puzzle canvas, the processing module 32 is specifically used to: obtain the canvas compression coefficient of the puzzle canvas based on the image resolution of the formatted fill image and the canvas resolution of the corresponding puzzle canvas.

[0099] According to one or more embodiments of the present disclosure, before the non-target edges of the scaled filling image are cropped based on the non-target edge size of the puzzle canvas to obtain a formatted filling image, the processing module 32 is further used to: center the scaled filling image in the corresponding puzzle canvas; when the processing module 32 crops the non-target edges of the scaled filling image based on the non-target edge size of the puzzle canvas to obtain a formatted filling image, the processing module 32 is specifically used to: symmetrically crop the non-target edges at both ends of the scaled filling image based on the non-target edge size of the puzzle canvas to obtain a formatted filling image.

[0100] The acquisition module 31, the processing module 32 and the output module 33 are connected in sequence. The image editing device 3 provided in this embodiment can implement the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.

[0101] Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown in FIG. Fig.11 As shown, the electronic device 4 includes:

[0102] A processor 41, and a memory 42 communicatively connected to the processor 41;

[0103] The memory 42 stores computer executable instructions;

[0104] The processor 41 executes the computer execution instructions stored in the memory 42 to implement the following Figure 2-Figure 9 The image editing method in the illustrated embodiment.

[0105] Optionally, the processor 41 and the memory 42 are connected via a bus 43 .

[0106] For related instructions, please refer to Figure 2-Figure 9 The relevant descriptions and effects corresponding to the steps in the corresponding embodiments can be understood, and no further elaboration is made here.

[0107] The present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, which are used to implement the present invention when executed by a processor. Figure 2-Figure 9 An image editing method provided by any one of the corresponding embodiments.

[0108] The present invention provides a computer program product, including a computer program. When the computer program is executed by a processor, the present invention is realized. Figure 2-Figure 9 An image editing method provided by any one of the corresponding embodiments.

[0109] In order to implement the above embodiment, the embodiment of the present disclosure also provides an electronic device.

[0110] refer to Fig.12 , which shows a schematic diagram of the structure of an electronic device 900 suitable for implementing the embodiment of the present disclosure, and the electronic device 900 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.12 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0111] like Fig.12 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 to a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0112] Typically, the following devices may be connected to the I / O interface 905: input devices 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 908 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.12 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0113] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0114] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0115] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0116] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0117] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0118] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0119] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit or module does not, in some cases, constitute a limitation on the unit itself.

[0120] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0121] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0122] In a first aspect, according to one or more embodiments of the present disclosure, there is provided an image editing method, comprising:

[0123] A puzzle template and a corresponding fill image are obtained, wherein the puzzle template represents a layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding fill images; a canvas compression coefficient of the puzzle canvas is obtained according to an image resolution of the fill image and a canvas resolution of the corresponding puzzle canvas, wherein the canvas compression coefficient represents a resolution compression ratio of the puzzle canvas, and the sum of the canvas resolutions of the puzzle canvases is the maximum resolution of the puzzle template; an exported resolution of the puzzle template is obtained according to the canvas compression coefficient of the puzzle canvas, and a puzzle image is generated based on the exported resolution, wherein the exported resolution is less than or equal to the maximum resolution.

[0124] According to one or more embodiments of the present disclosure, obtaining a canvas compression coefficient of the puzzle canvas based on an image resolution of the filling image and a canvas resolution of the corresponding puzzle canvas includes: obtaining a pixel fill rate corresponding to the puzzle canvas based on a ratio of the image resolution of the filling image to the canvas resolution of the corresponding puzzle canvas in a target direction; obtaining a corresponding canvas weight based on an area of ​​the puzzle canvas, wherein the canvas weight represents an area ratio of the puzzle canvas in the puzzle template; and obtaining a canvas compression coefficient of the puzzle canvas based on the product of the pixel fill rate and the corresponding canvas weight.

[0125] According to one or more embodiments of the present disclosure, it also includes: in response to a first operation instruction, obtaining a scaling factor of at least one puzzle canvas, the scaling factor representing the scaling ratio of the filling image within the puzzle canvas; obtaining a corresponding pixel fill rate according to a ratio of an image resolution of the filling image to a canvas resolution of the corresponding puzzle canvas in a target direction, including: obtaining an actual image resolution of at least one filling image according to the scaling factor of the puzzle canvas and the image resolution of the corresponding filling image; obtaining a corresponding pixel fill rate according to a ratio of the actual image resolution of the filling image to the canvas resolution of the corresponding puzzle canvas in a target direction.

[0126] According to one or more embodiments of the present disclosure, obtaining a corresponding canvas weight according to the area of ​​the puzzle canvas includes: acquiring a first number of pixels representing the area of ​​the puzzle canvas and a second number of pixels corresponding to the maximum resolution; and obtaining a canvas weight of the corresponding puzzle canvas according to a ratio of the first number of pixels to the second number of pixels.

[0127] According to one or more embodiments of the present disclosure, obtaining the derived resolution of the puzzle template based on the canvas compression coefficient of the puzzle canvas includes: calculating the cumulative sum of the canvas compression coefficients of the puzzle canvas to obtain the cumulative compression coefficient; and obtaining the derived resolution of the puzzle template based on the product of the maximum resolution and the cumulative compression coefficient.

[0128] According to one or more embodiments of the present disclosure, after obtaining the puzzle template and the corresponding fill image, it also includes: scaling the corresponding fill image based on the target side size of the puzzle canvas in the target direction in the puzzle template so that the target side of the fill image is equal to the target side of the corresponding puzzle canvas; cropping the non-target side of the scaled fill image based on the non-target side size of the puzzle canvas to obtain a formatted fill image; obtaining the canvas compression coefficient of the puzzle canvas based on the image resolution of the fill image and the canvas resolution of the corresponding puzzle canvas, including: obtaining the canvas compression coefficient of the puzzle canvas based on the image resolution of the formatted fill image and the canvas resolution of the corresponding puzzle canvas.

[0129] According to one or more embodiments of the present disclosure, before the non-target side of the scaled filling image is cropped based on the non-target side size of the puzzle canvas to obtain the formatted filling image, the method further includes: centering the scaled filling image in the corresponding puzzle canvas; the cropping of the non-target side of the scaled filling image based on the non-target side size of the puzzle canvas to obtain the formatted filling image includes: symmetrically cropping the non-target sides of both ends of the scaled filling image based on the non-target side size of the puzzle canvas to obtain the formatted filling image.

[0130] In a second aspect, according to one or more embodiments of the present disclosure, there is provided an image editing device, comprising:

[0131] An acquisition module, used to acquire a puzzle template and a corresponding filling image, wherein the puzzle template represents a layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding filling image;

[0132] A processing module, configured to obtain a canvas compression coefficient of the puzzle canvas according to an image resolution of the filling image and a canvas resolution of the corresponding puzzle canvas, wherein the canvas compression coefficient represents a resolution compression ratio of the puzzle canvas, and the sum of the canvas resolutions of the puzzle canvas is the maximum resolution of the puzzle template;

[0133] An output module is used to obtain an export resolution of the puzzle template according to a canvas compression coefficient of the puzzle canvas, and generate a puzzle image based on the export resolution, wherein the export resolution is less than or equal to the maximum resolution.

[0134] According to one or more embodiments of the present disclosure, the processing module is specifically used to: obtain a pixel fill rate corresponding to the puzzle canvas according to a ratio of an image resolution of the filling image to a canvas resolution of the corresponding puzzle canvas in a target direction; obtain a corresponding canvas weight according to an area of ​​the puzzle canvas, wherein the canvas weight represents an area ratio of the puzzle canvas in the puzzle template; and obtain a canvas compression coefficient of the puzzle canvas according to the product of the pixel fill rate and the corresponding canvas weight.

[0135] According to one or more embodiments of the present disclosure, the processing module is further used to: obtain a scaling factor of at least one puzzle canvas in response to a first operation instruction, wherein the scaling factor represents a scaling ratio of the filling image within the puzzle canvas; when the processing module obtains the corresponding pixel fill rate according to the ratio of the image resolution of the filling image to the canvas resolution of the corresponding puzzle canvas in a target direction, the processing module is specifically used to: obtain an actual image resolution of at least one filling image according to the scaling factor of the puzzle canvas and the image resolution of the corresponding filling image; and obtain the corresponding pixel fill rate according to the ratio of the actual image resolution of the filling image to the canvas resolution of the corresponding puzzle canvas in the target direction.

[0136] According to one or more embodiments of the present disclosure, when the processing module obtains the corresponding canvas weight according to the area of ​​the puzzle canvas, it is specifically used to: obtain a first number of pixels representing the area of ​​the puzzle canvas, and a second number of pixels corresponding to the maximum resolution; and obtain the corresponding canvas weight of the puzzle canvas according to the ratio of the first number of pixels to the second number of pixels.

[0137] According to one or more embodiments of the present disclosure, the output module is specifically used to: calculate the cumulative sum of the canvas compression coefficients of the puzzle canvas to obtain the cumulative compression coefficient; and obtain the exported resolution of the puzzle template according to the product of the maximum resolution and the cumulative compression coefficient.

[0138] According to one or more embodiments of the present disclosure, after the puzzle template and the corresponding fill image are obtained, the processing module is further used to: scale the corresponding fill image based on the target side size of the puzzle canvas in the target direction in the puzzle template so that the target side of the fill image is equal to the target side of the corresponding puzzle canvas; crop the non-target side of the scaled fill image based on the non-target side size of the puzzle canvas to obtain a formatted fill image; when the processing module obtains the canvas compression coefficient of the puzzle canvas based on the image resolution of the fill image and the canvas resolution of the corresponding puzzle canvas, the processing module is specifically used to: obtain the canvas compression coefficient of the puzzle canvas based on the image resolution of the formatted fill image and the canvas resolution of the corresponding puzzle canvas.

[0139] According to one or more embodiments of the present disclosure, before the non-target side of the scaled filling image is cropped based on the non-target side size of the puzzle canvas to obtain the formatted filling image, the processing module is further used to: center the scaled filling image in the corresponding puzzle canvas; when the processing module crops the non-target side of the scaled filling image based on the non-target side size of the puzzle canvas to obtain the formatted filling image, the processing module is specifically used to: symmetrically crop the non-target sides of both ends of the scaled filling image based on the non-target side size of the puzzle canvas to obtain the formatted filling image.

[0140] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;

[0141] The memory stores computer-executable instructions;

[0142] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the image editing method as described in the first aspect and various possible designs of the first aspect.

[0143] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the image editing method described in the first aspect and various possible designs of the first aspect is implemented.

[0144] In a fifth aspect, according to one or more embodiments of the present disclosure, there is provided a computer program product, comprising a computer program, which, when executed by a processor, implements the image editing method as described in the first aspect and various possible designs of the first aspect.

[0145] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0146] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0147] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. An image editing method, characterized in that: include: Acquire a puzzle template and a corresponding filling image, wherein the puzzle template represents the layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding filling image; Obtaining a canvas compression coefficient of the puzzle canvas according to an image resolution of the filling image and a canvas resolution of the corresponding puzzle canvas, wherein the canvas compression coefficient represents a resolution compression ratio of the puzzle canvas; According to the canvas compression coefficient of the puzzle canvas, the derived resolution of the puzzle template is obtained, and the puzzle image is generated based on the derived resolution.

2. The method according to claim 1, characterized in that The obtaining, according to the image resolution of the filling image and the canvas resolution of the corresponding puzzle canvas, a canvas compression coefficient of the puzzle canvas comprises: Obtaining a pixel filling rate corresponding to the jigsaw canvas according to a ratio of an image resolution of the filling image to a canvas resolution of the corresponding jigsaw canvas in a target direction; According to the area of ​​the puzzle canvas, a corresponding canvas weight is obtained, where the canvas weight represents the area ratio of the puzzle canvas in the puzzle template; A canvas compression coefficient of the jigsaw canvas is obtained according to the product of the pixel filling rate and the corresponding canvas weight.

3. The method according to claim 2, characterized in that Also includes: In response to the first operation instruction, obtaining at least one scaling factor of the puzzle canvas, wherein the scaling factor represents a scaling ratio of the filling image within the puzzle canvas; The step of obtaining a corresponding pixel filling rate according to a ratio of an image resolution of the filling image to a canvas resolution of a corresponding jigsaw canvas in a target direction comprises: Obtaining an actual image resolution of at least one filled image according to a scaling factor of the jigsaw canvas and an image resolution of a corresponding filled image; The corresponding pixel filling rate is obtained according to the ratio of the actual image resolution of the filling image to the canvas resolution of the corresponding jigsaw canvas in the target direction.

4. The method according to claim 2, characterized in that: The step of obtaining a corresponding canvas weight according to the area of ​​the jigsaw canvas includes: Acquire a first number of pixels representing the area of ​​the puzzle canvas and a second number of pixels corresponding to the maximum resolution of the puzzle template; A canvas weight of the corresponding puzzle canvas is obtained according to the ratio of the first number of pixels to the second number of pixels.

5. The method according to claim 1, characterized in that The step of obtaining the derived resolution of the puzzle template according to the canvas compression coefficient of the puzzle canvas includes: Calculating the cumulative sum of canvas compression coefficients of the jigsaw canvas to obtain a cumulative compression coefficient; The derived resolution of the puzzle template is obtained according to the product of the maximum resolution of the puzzle template and the cumulative compression coefficient.

6. The method according to claim 1, characterized in that After obtaining the puzzle template and the corresponding filling image, the method further includes: Based on the target side size of the jigsaw canvas in the jigsaw template in the target direction, scaling the corresponding filling image so that the target side of the filling image is equal in length to the target side of the corresponding jigsaw canvas; Based on the non-target side size of the jigsaw canvas, the non-target side of the scaled filling image is cropped to obtain a formatted filling image; The obtaining, according to the image resolution of the filling image and the canvas resolution of the corresponding puzzle canvas, a canvas compression coefficient of the puzzle canvas comprises: A canvas compression factor of the puzzle canvas is obtained according to the image resolution of the formatted filling image and the canvas resolution of the corresponding puzzle canvas.

7. The method according to claim 6, characterized in that Before the non-target side of the scaled filling image is cropped based on the non-target side size of the jigsaw canvas to obtain the formatted filling image, the method further includes: Centering the scaled filling image in the corresponding jigsaw puzzle canvas; The step of cropping the non-target edge of the scaled filling image based on the non-target edge size of the jigsaw canvas to obtain a formatted filling image includes: Based on the non-target side size of the jigsaw canvas, the non-target sides at both ends of the scaled filling image are symmetrically cropped to obtain the formatted filling image.

8. The method according to claim 1, characterized in that The sum of the canvas resolutions of the puzzle canvas is the maximum resolution of the puzzle template, and the derived resolution is less than or equal to the maximum resolution.

9. An image editing device, characterized in that: include: An acquisition module, used to acquire a puzzle template and a corresponding filling image, wherein the puzzle template represents a layout of at least two puzzle canvases, and the puzzle canvases are used to carry the corresponding filling image; A processing module, configured to obtain a canvas compression coefficient of the puzzle canvas according to an image resolution of the filling image and a canvas resolution of the corresponding puzzle canvas, wherein the canvas compression coefficient represents a resolution compression ratio of the puzzle canvas, and the sum of the canvas resolutions of the puzzle canvas is the maximum resolution of the puzzle template; An output module is used to obtain an export resolution of the puzzle template according to a canvas compression coefficient of the puzzle canvas, and generate a puzzle image based on the export resolution, wherein the export resolution is less than or equal to the maximum resolution.

10. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the image editing method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the image editing method according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the image editing method according to any one of claims 1 to 8 is implemented.