Image processing method and device

By performing anchor configuration and stretching compression processing on multi-layer pictures, the image distortion problem caused by insufficient cropable areas of the original picture is solved, and a new picture matching the terminal screen size and complete content is achieved.

CN112508785BActive Publication Date: 2025-03-21PETAL CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011363127.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-28
Publication Date
2025-03-21
Estimated Expiration
2040-11-28

AI Technical Summary

Technical Problem

In the prior art, when designing open-screen pictures, the original picture is insufficient in cropable areas, resulting in excessive cropping of the direct cropping method and image distortion problems.

Method used

By obtaining pictures containing multiple layers, configuring anchor points to determine the relative positions between layers, stretching or compressing some layers according to the size of the terminal display screen, and recombining other layers with anchor points to generate new pictures that match the terminal screen size and complete content.

Benefits of technology

It realizes the generation of pictures that match the terminal display screen size, while avoiding picture distortion and retaining complete image information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112508785B_ABST
    Figure CN112508785B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a method and device for image processing, the method comprising: obtaining a first image of at least two layers, configuring anchor points for any two layers of the at least two layers, obtaining an anchor point set, the anchor point being used to determine the relative position between the two layers; stretching or compressing the first layer according to the size of the terminal display screen, the first layer being one or more layers in which part or all of the element images of the at least two layers are blocked; reorganizing the second layer and the stretched or compressed first layer according to the anchor point set to obtain a second image, the second image matching the size of the terminal display screen when the terminal displays it, the second layer being one or more layers in which the element images of the at least two layers are not blocked. By stretching or compressing the first layer, and then reorganizing the first layer and the second layer based on the anchor point set, the second image matches the terminal display screen, and the second image includes the complete image information of the first image without distortion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method and device for image processing. Background Art

[0002] In the design of the opening screen images of applications (APPs), designers need to derive dozens of sizes of images from one or more original opening screen images to adapt to display screens of different sizes. With the explosive growth of the number of APPs, the workload of opening screen image design is increasing.

[0003] In the prior art, in order to improve the efficiency of designing splash screen images, when the terminal downloads the APP compressed file for the first time, it will send a request message to the server to obtain the APP compressed file; after receiving the request message, the server can crop the original splash screen image according to the size of the terminal display screen, so that the aspect ratio of the cropped splash screen image is the same as the aspect ratio of the terminal display screen, and then proportionally reduce or enlarge the cropped splash screen image to make the processed splash screen image match the size of the terminal display screen; thereafter, the server sends the APP compressed file including the processed splash screen image to the terminal; after receiving the APP compressed file, the terminal can decompress and install it, and when the APP is started, the terminal can display or play the processed splash screen image.

[0004] Although the existing technology can improve the efficiency of designing splash screen images, when the croppable area of ​​the original splash screen image is insufficient, direct cropping will result in over-cropping, resulting in incomplete content in the cropped splash screen image and image distortion. Summary of the invention

[0005] The embodiments of the present application provide a method and device for processing an image, so that the processed image matches the size of the terminal display screen and retains complete image information without distortion.

[0006] In a first aspect, an embodiment of the present application provides a method for image processing, and the execution subject of the method can be a server or a terminal. The method includes: obtaining a first image, the first image includes at least two layers, the first image is used to be displayed on a terminal, and the size of the first image does not match the size of the terminal display screen; configuring anchor points for any two layers of at least two layers to obtain an anchor point set, wherein the anchor point is used to determine the relative position between any two layers; stretching or compressing the first layer according to the size of the terminal display screen, the aspect ratio of the stretched or compressed first layer is the same as the aspect ratio of the terminal display screen, wherein the first layer is one or more layers in which part or all of the element images of the at least two layers are blocked; and according to the anchor point set, reorganizing the second layer and the stretched or compressed first layer to obtain a second image, when the second image is displayed on the terminal, the size of the second image matches the size of the terminal display screen, wherein the second layer is one or more layers in which the element images of the at least two layers are not blocked.

[0007] In the embodiment of the present application, the first image does not match the size of the terminal display screen. By stretching or compressing the first layer, and then reorganizing the second layer and the stretched or compressed first layer based on the anchor point set, a second image including complete image information can be obtained, and the second image matches the size of the terminal display screen. On the one hand, the first layer is a layer in which part or all of the element images in the first image are blocked, which means that the main body salient features included in the first layer are less and not easy to attract the user's attention. For example, when the solid color background element is stretched or compressed to match the size of the terminal display screen, there will be no deformation or distortion problems; on the other hand, since the anchor point is a constant coordinate relative to the image reference coordinate system, it can be used to determine the relative position between the two layers. Therefore, by reorganizing the second layer and the stretched or compressed first layer through the anchor point set, it can be ensured that the relative position between any two layers before and after the reorganization remains unchanged. From the perspective of visual perception, the relative position between any two layers does not change before and after the reorganization, thereby avoiding the distortion problem caused by the transformation of the first image.

[0008] In one possible design, any two layers include a third layer and a fourth layer, and configuring anchor points for any two layers of at least two layers includes: determining a distance between the third layer and the fourth layer; and configuring anchor points for the third layer and the fourth layer based on the distance between the third layer and the fourth layer.

[0009] In the above design, anchor points are configured for the third layer and the fourth layer by using the distance between the third layer and the fourth layer, so that the relative position between the third layer and the fourth image remains unchanged before and after the reorganization. For example, the Hessdorff distance between the third layer and the fourth layer can be calculated by using the coordinates of each pixel point in the third layer and the coordinates of each pixel point in the fourth layer, and then anchor points are configured for the third layer and the fourth layer based on the Hessdorff distance between the third layer and the fourth layer, so as to ensure that the relative position between the third layer and the fourth layer remains unchanged before and after the reorganization.

[0010] In a possible design, anchor points are configured for the third layer and the fourth layer according to the distance between the third layer and the fourth layer, including: when the distance between the third layer and the fourth layer is equal to 0, anchor points are configured for the third layer and the fourth layer according to the positional relationship between the third layer and the fourth layer; or, when the distance between the third layer and the fourth layer satisfies a first preset condition, anchor points are configured for the third layer and the fourth layer according to a first pixel pair, wherein the first pixel pair is one or more pairs of pixel points between the third layer and the fourth layer that satisfy the first preset condition, and the first preset condition is greater than 0 and less than a first threshold; or, when the distance between the third layer and the fourth layer is greater than the first threshold, a center point of the first layer and a center point of the fourth layer are determined as anchor points between the third layer and the fourth layer.

[0011] In the above design, by dividing the distance between the third layer and the fourth layer into three categories, different technical solutions are used to provide anchor points between the third layer and the fourth layer according to different distance categories, so as to ensure that the relative position between the third layer and the fourth layer remains unchanged before and after the reorganization. For example, if the distance between the third layer and the fourth layer is 0, it means that the positional relationship between the third layer and the fourth layer can be a contact relationship, an intersection relationship, or a containment relationship, so anchor points can be configured for the third layer and the fourth layer based on the positional relationship. For example, if the distance between the third layer and the fourth layer is greater than 0 and less than a first threshold value, and the first threshold value is a very small positive number, it means that the third layer and the fourth layer are close to contact but not in contact. In this case, anchor points can be configured for the third layer and the fourth layer based on the first pixel pair. For another example, if the distance between the third layer and the fourth layer is greater than the first threshold value, it means that the third layer and the fourth layer are separated by a certain distance. In this case, the center point of the third layer and the center point of the fourth layer can be used as anchor points.

[0012] In a possible design, anchor points are configured for the third layer and the fourth layer according to the positional relationship between the third layer and the fourth layer, including: when the third layer and the fourth layer are in contact, determining the contact point between the third layer and the fourth layer as the anchor point between the third layer and the fourth layer; or, when the third layer and the fourth layer intersect, determining the center point in the intersection area of ​​the third layer and the fourth layer as the anchor point between the third layer and the fourth layer; or, when the third layer contains the fourth layer, determining the center point of the third layer as the anchor point between the third layer and the fourth layer.

[0013] In the above design, in the case of the distance between the third layer and the fourth layer, anchor points can be configured for the third layer and the fourth layer based on the positional relationship between the third layer and the fourth layer to ensure that the relative positions of the two layers remain unchanged before and after the reorganization. For example, using the contact point as the anchor point can ensure that the third layer and the fourth layer after the reorganization are still in a contact relationship. For example, using the center point in the intersection area as the anchor point can ensure that the third layer and the fourth layer after the reorganization are still in an intersection relationship, and the positions of the two relative to the anchor point remain unchanged. For another example, the third layer contains the fourth layer, and using the center point of the third layer as the anchor point can ensure that the third layer still contains the fourth layer after the reorganization, and the positions of the two relative to the anchor point remain unchanged.

[0014] In one possible design, anchor points are configured for the third layer and the fourth layer according to the first pixel pair, including: when the first pixel pair is a pair of pixel points, determining the center point of the pair of pixel points as the anchor point between the third layer and the fourth layer; or, when the first pixel pair is multiple pairs of pixel points and the distance between each pair of pixel points in the multiple pairs of pixel points is different, determining the center point of a pair of pixel points with the smallest distance among the multiple pairs of pixel points as the anchor point between the third layer and the fourth layer; or, when the first pixel pair is multiple pairs of pixel points and the distance between each pair of pixel points in the multiple pairs of pixel points is the same, determining the center point of the multiple pairs of pixel points as the anchor point between the third layer and the fourth layer.

[0015] In the above design, when the distance between the third layer and the fourth layer meets the first preset condition, anchor points can be configured for the third layer and the fourth layer based on the first pixel pair to ensure that the relative position between the third layer and the fourth layer remains unchanged before and after the reorganization.

[0016] In one possible design, the stretched or compressed first layer and the second layer are reorganized according to the anchor point set to obtain a second image, including: according to the anchor point set, the stretched or compressed first layer and the second layer are reorganized to obtain a reorganized first image, and the aspect ratio of the reorganized first image is the same as the aspect ratio of the terminal display screen; the reorganized first image is proportionally reduced or enlarged according to the size of the terminal display screen to obtain the second image.

[0017] In the above design, in the reorganized first picture, the size of the second layer remains unchanged, and the aspect ratio of the stretched or compressed first layer is the same as the aspect ratio of the terminal display screen, that is, the aspect ratio of the reorganized first picture is the same as the aspect ratio of the terminal display screen. Further, the size of the reorganized first picture may be the same as or different from the size of the terminal display screen. For example, if the size of the reorganized first picture is the same as the size of the terminal display screen, the second picture may be the reorganized first picture. For another example, if the size of the reorganized first picture is different from the size of the terminal display screen, the reorganized first picture may be proportionally reduced or enlarged based on the size of the terminal display screen to obtain a second picture that matches the size of the terminal display screen. The proportional reduction or enlargement can ensure the integrity of the image information and will not introduce additional distortion or deformation.

[0018] In a possible design, the method may further include: determining a croppable area of ​​the first image, the croppable area being the area of ​​the first image excluding a minimum circumscribed horizontal rectangle, the minimum circumscribed horizontal rectangle being the minimum horizontal rectangle including the second layer; determining a first cropping area according to the size of the terminal display screen, the first cropping area being the minimum area required to be cropped so that the aspect ratio of the cropped first image is the same as the aspect ratio of the terminal display screen; and determining that the first cropping area is outside the croppable area of ​​the first image.

[0019] In the above design, through the croppable area of ​​the first image and the first cropping area, it can be determined whether the first image can be directly cropped, and the compatibility is good. Since the croppable area of ​​the first image is the area in the first image except the minimum circumscribed horizontal rectangle, the minimum circumscribed horizontal rectangle is the minimum horizontal rectangle including the second layer, and the element image of the second layer is not blocked, it means that the second layer includes more prominent features of the subject, which is easy to attract the attention of the user, that is, the croppable area of ​​the first image does not include the prominent features of the subject or includes fewer prominent features of the subject, even if the croppable area of ​​the first image is completely cropped, the image content will not be lost. The first cropping area is the minimum area that needs to be cropped to make the aspect ratio of the cropped first image the same as the aspect ratio of the terminal display screen, so if the first cropping area is located in the croppable area of ​​the first image, the first cropping area can be directly cropped in the croppable area of ​​the first image, that is, the aspect ratio of the cropped first image is the same as the aspect ratio of the terminal display screen without losing the image information. If the first cropping area is outside the croppable area of ​​the first image, if the first cropping area is directly cropped from the first image, even if the aspect ratio of the cropped first image is the same as that of the terminal display screen, image information will be lost and distortion will occur.

[0020] Among them, the first cropping area being located outside the croppable area of ​​the first image may mean that, when cropping in the width direction, the width value of the first cropping area is greater than the width value of the croppable area of ​​the first image, or, when cropping in the height direction, the height value of the first cropping area is greater than the height value of the croppable area of ​​the first image.

[0021] In a second aspect, an embodiment of the present application provides an image processing device, which may have the function of implementing the first aspect or any possible design of the first aspect. The functions of the above-mentioned image processing device can be implemented by hardware, or by hardware executing corresponding software, and the hardware or software includes one or more modules corresponding to the above-mentioned functions. The device may include: an acquisition unit, a configuration unit, a stretching unit, and a reorganization unit.

[0022] The acquiring unit is used to acquire a first picture, the first picture includes at least two layers, the first picture is used to be displayed on the terminal, and the size of the first picture does not match the size of the terminal display screen;

[0023] a configuration unit, configured to configure anchor points for any two layers of the at least two layers to obtain an anchor point set, wherein the anchor points are used to determine the relative position between any two layers;

[0024] a stretching unit, configured to stretch or compress the first layer according to the size of the terminal display screen, wherein the aspect ratio of the stretched or compressed first layer is the same as the aspect ratio of the terminal display screen, wherein the first layer is one or more layers in which part or all of the element images of at least two layers are blocked;

[0025] A reorganization unit is used to reorganize the second layer and the stretched or compressed first layer according to the anchor point set to obtain a second image. When the second image is displayed on the terminal, the size of the second image matches the size of the terminal display screen; wherein the second layer is one or more layers in which the element images of at least two layers are not blocked.

[0026] In a possible design, any two layers include a third layer and a fourth layer, and the configuration unit is specifically used for:

[0027] Determine the distance between the third layer and the fourth layer;

[0028] Configure anchor points for the third and fourth layers based on their distances.

[0029] In a possible design, the configuration unit is specifically used to:

[0030] When the distance between the third layer and the fourth layer is equal to 0, anchor points are configured for the third layer and the fourth layer according to the positional relationship between the third layer and the fourth layer; or,

[0031] When the distance between the third layer and the fourth layer meets the first preset condition, anchor points are configured for the third layer and the fourth layer according to the first pixel pair, wherein the first pixel pair is one or more pairs of pixel points between the third layer and the fourth layer that meet the first preset condition, and the first preset condition is greater than 0 and less than a first threshold; or

[0032] When the distance between the third layer and the fourth layer is greater than the first threshold, the center point of the first layer and the center point of the fourth layer are determined as anchor points between the third layer and the fourth layer.

[0033] In a possible design, the configuration unit is specifically used to:

[0034] When the third layer and the fourth layer are in contact, a contact point between the third layer and the fourth layer is determined as an anchor point between the third layer and the fourth layer; or,

[0035] When the third layer intersects with the fourth layer, a center point in the intersection area of ​​the third layer and the fourth layer is determined as an anchor point between the third layer and the fourth layer; or,

[0036] When the third layer includes the fourth layer, a center point of the third layer is determined as an anchor point between the third layer and the fourth layer.

[0037] In a possible design, the configuration unit is specifically used to:

[0038] In the case where the first pixel pair is a pair of pixel points, a center point of the pair of pixel points is determined as an anchor point between the third layer and the fourth layer; or,

[0039] When the first pixel pair is a plurality of pairs of pixel points, and the distance between each pair of pixel points in the plurality of pairs of pixel points is different, a center point of a pair of pixel points with the smallest distance among the plurality of pairs of pixel points is determined as the anchor point between the third layer and the fourth layer; or,

[0040] When the first pixel pair is a plurality of pairs of pixel points, and the distance between each pair of pixel points in the plurality of pairs of pixel points is the same, the center point of the plurality of pairs of pixel points is determined as the anchor point between the third layer and the fourth layer.

[0041] In one possible design, the recombinant unit is specifically used to:

[0042] Recombining the stretched or compressed first layer and the second layer according to the anchor point set to obtain a recombined first image, wherein the aspect ratio of the recombined first image is the same as the aspect ratio of the terminal display screen;

[0043] The reorganized first picture is reduced or enlarged in proportion to the size of the terminal display screen to obtain the second picture.

[0044] In a possible design, the image processing device further includes a determining unit, which is configured to:

[0045] Determine a croppable area of ​​the first image, where the croppable area is an area of ​​the first image excluding a minimum circumscribed horizontal rectangle, where the minimum circumscribed horizontal rectangle is a minimum horizontal rectangle including the second layer;

[0046] Determine a first cropping area according to the size of the terminal display screen, where the first cropping area is the minimum area that needs to be cropped so that the aspect ratio of the cropped first image is the same as the aspect ratio of the terminal display screen;

[0047] It is determined that the first cropping area is outside the croppable area of ​​the first picture.

[0048] Among them, the beneficial effects of the second aspect or any design of the second aspect can refer to the beneficial effects of the first aspect or any design of the first aspect, and will not be repeated here.

[0049] In a third aspect, an embodiment of the present application provides an image processing device, which may have the function of implementing the first aspect or any possible design of the first aspect. The functions of the above-mentioned image processing device can be implemented by hardware, or by hardware executing corresponding software, and the hardware or software includes one or more modules corresponding to the above-mentioned functions.

[0050] The structure of the image processing device may include at least one processor and may also include at least one memory. The at least one processor is coupled to the at least one memory and may be used to execute computer program instructions stored in the memory so that the image processing device performs the method in the first aspect or any possible design of the first aspect.

[0051] In one possible design, the image processing device may further include a communication interface, and the processor is coupled to the communication interface. When the image processing device is a server, the communication interface may be a transceiver or an input / output interface; when the image processing device is a chip included in the server, the communication interface may be an input / output interface of the chip.

[0052] In one possible design, the image processing device may further include a communication interface, and the processor is coupled to the communication interface. When the image processing device is a terminal, the communication interface may be a transceiver or an input / output interface; when the image processing device is a chip included in the terminal, the communication interface may be an input / output interface of the chip.

[0053] In one possible design, the transceiver may be a transceiver circuit, and the input / output interface may be an input / output circuit.

[0054] In a fourth aspect, an embodiment of the present application provides a chip system, comprising: a processor, the processor being coupled to a memory, the memory being used to store programs or instructions, and when the programs or instructions are executed by the processor, the chip system implements the method in the above-mentioned first aspect or any possible design of the first aspect.

[0055] In one possible design, the chip system may further include an interface circuit for receiving code instructions and transmitting them to the processor.

[0056] In a possible design, there may be one or more processors in the chip system, and the processor may be implemented by hardware or software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.

[0057] In a possible design, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately provided with the processor, which is not limited in this application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be provided on different chips. This application does not specifically limit the type of memory and the arrangement of the memory and the processor.

[0058] In a fifth aspect, an embodiment of the present application provides a readable storage medium having a computer program or instruction stored thereon. When the computer program or instruction is executed, the computer executes the method in the above-mentioned first aspect or any possible design of the first aspect.

[0059] In a sixth aspect, an embodiment of the present application provides a computer program product. When a computer reads and executes the computer program product, the computer executes the method in the above-mentioned first aspect or any possible design of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 A schematic diagram of the architecture of a communication system applicable to an embodiment of the present application;

[0061] Figure 2 A schematic diagram of the structure of a server provided in an embodiment of the present application;

[0062] Figure 3 A schematic diagram of the structure of a terminal provided in an embodiment of the present application;

[0063] Figure 4 Another schematic diagram of the structure of a terminal provided in an embodiment of the present application;

[0064] Figure 5 A schematic diagram of image cropping in an embodiment of the present application;

[0065] Figure 6 A schematic diagram of another type of image cropping in an embodiment of the present application;

[0066] Figure 7 A schematic diagram of a process flow of an image processing method provided in an embodiment of the present application;

[0067] Figure 8 A schematic diagram of the first picture in the embodiment of the present application;

[0068] Fig. 9 A schematic diagram of a first cropping area in an embodiment of the present application;

[0069] Fig.10 Another schematic diagram of the first cropping area in an embodiment of the present application;

[0070] Fig.11A A schematic diagram of the minimum circumscribed horizontal rectangle of the first image in an embodiment of the present application;

[0071] Fig. 11B A schematic diagram of a croppable area of ​​a first image in an embodiment of the present application;

[0072] Fig.12 A flowchart of an anchor point configuration method provided in an embodiment of the present application;

[0073] Fig.13 A schematic diagram of an anchor point configuration in an embodiment of the present application;

[0074] Fig.14 This is another schematic diagram of the anchor point configuration in the embodiment of the present application;

[0075] Fig.15A This is another schematic diagram of the anchor point configuration in the embodiment of the present application;

[0076] Fig. 15B Another schematic diagram of anchor point configuration in an embodiment of the present application;

[0077] Fig. 15C Another schematic diagram of anchor point configuration in an embodiment of the present application;

[0078] Fig.16 Another schematic diagram of anchor point configuration in an embodiment of the present application;

[0079] Fig.17 A schematic diagram of stretching the first layer in an embodiment of the present application;

[0080] Fig.18 A schematic diagram of the second picture in an embodiment of the present application;

[0081] Fig.19 A schematic diagram of a picture processing device provided in an embodiment of the present application;

[0082] Fig. 20 Another schematic diagram of the image processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0083] For ease of understanding, some examples of concepts related to the embodiments of the present application are provided for reference, as shown below:

[0084] (1) Anchor point refers to a coordinate that remains unchanged relative to the image reference coordinate system and can be used to determine the relative position between a pair of pixels in the image. For example, after the image is transformed (such as cropped, stretched, reduced, or enlarged), the position of a pair of pixels relative to the anchor point remains unchanged.

[0085] (2) The element type of the layer may include background elements and main elements. Among them, the background element may refer to a layer in which most or all of the element images in multiple layers are blocked (or covered) by element images in other layers. Usually, the layer corresponding to the background element is generally located at the bottom of the multiple layers or close to the bottom (such as the second layer from the bottom). The main element may refer to a layer in which most or all of the element images in multiple layers are not blocked (or covered) by element images in other layers. Usually, the layer corresponding to the main element is generally located at the top of the multiple layers or close to the top (such as the second layer from the top).

[0086] Optionally, background elements can be divided into main background elements and other background elements. The main background element can refer to a large area of ​​pure color layer covering the entire original image. Usually, the main background element can be located at the bottom of multiple layers and can be the reference coordinate system of the original image. Other background elements can refer to background elements other than the main background element. Usually, other background elements can partially cover the original image.

[0087] (3) The minimum circumscribed horizontal rectangle may be the minimum horizontal rectangle including all main elements in the original image.

[0088] (4) The croppable area may refer to the area of ​​the original image except for the minimum circumscribed horizontal rectangle. Since the croppable area does not include the main element, even if the croppable area of ​​the original image is cropped, the image content will not be lost.

[0089] (5) Opening screen picture, which may refer to one or more pictures displayed after the APP is started. For example, a user starts an APP installed on a terminal. In response, the terminal first displays the opening screen picture of the APP and then displays the user interface of the APP. If there is only one opening screen picture, the terminal may directly display the opening screen picture; if there are multiple opening screen pictures, the terminal may play them in the order in which they are played.

[0090] The terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to be limiting of the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the embodiments of the present application, "one or more" refers to one, two or more; "and / or" describes the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0091] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0092] The at least one involved in the embodiments of the present application includes one or more; wherein, more means greater than or equal to two. In addition, it should be understood that in the description of the present application, the words "first", "second", etc. are only used for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.

[0093] The application (application, app) involved in the embodiments of the present application can be referred to as application, which is a software program that can realize one or more specific functions. Usually, multiple applications can be installed in the terminal, for example, instant messaging applications, video applications, audio applications, image shooting applications, etc. Among them, instant messaging applications, for example, may include text messaging applications, WeChat, WhatsApp Messenger, Line, photo sharing (instagram), Kakao Talk, DingTalk, etc. Image shooting applications, for example, may include camera applications (system camera or third-party camera applications). Video applications, for example, may include Youtube, Twitter, Douyin, iQiyi, Tencent Video, etc. Audio applications, for example, may include Kugou Music, Xiami, QQ Music, etc. The applications mentioned in the following embodiments may be applications installed when the terminal leaves the factory, or they may be applications downloaded from the Internet or obtained from other terminals by the user during the use of the terminal.

[0094] The technical solutions in the embodiments of the present application will be described in detail below in conjunction with the drawings in the following embodiments of the present application.

[0095] Figure 1 FIG. 1 is a schematic diagram showing an exemplary scenario of the image processing method provided in an embodiment of the present application. Figure 1 As shown, the scenario may include a server 200 and multiple terminals 300 (two mobile phones are used as an example in the figure). After the server 200 and the terminal 300 are connected, the server 200 can provide network services for the terminal 300.

[0096] As an example, when the terminal 300 downloads the APP compressed file for the first time, the terminal 300 can send a request message to the server 200 to obtain the APP compressed file through the application market or browser. Accordingly, the server 200 maintains a large number of APP compressed files. When the server 200 receives the request message from the terminal 300 to obtain the APP compressed file, the server 200 can crop, stretch, shrink or enlarge the original opening screen picture of the APP according to the size of the display screen of the terminal 300, so that the processed opening screen picture can match the size of the display screen of the terminal 300. The server 200 sends the APP compressed file to the terminal 300, and the APP compressed file includes the processed opening screen picture. The terminal 300 receives the APP compressed file, decompresses it and installs it. After the user starts the APP, the terminal 300 can display or play the processed opening screen picture.

[0097] The number of opening screen pictures of the APP may be one or more. For example, when the number of opening screen pictures is one, the terminal may display the opening screen picture of the APP. For another example, when the number of opening screen pictures is multiple, the terminal may play the opening screen pictures of the APP in the order in which they are played.

[0098] As another example, when the terminal 300 downloads the APP compressed file for the first time, the terminal 300 can send a request message to the server 200 to obtain the APP compressed file through the application market or browser. Accordingly, the server 200 maintains a large number of APP compressed files. When the server 200 receives the request message from the terminal 300 to obtain the APP compressed file, the APP compressed file can be sent to the terminal 300. The terminal 300 receives the APP compressed file, decompresses it and installs it. Among them, the terminal 300 can obtain the original opening screen picture of the APP by decompressing the APP compressed file. Furthermore, the terminal 300 can crop, stretch, reduce or enlarge the original opening screen picture of the APP according to the size of its own display screen, so that the processed opening screen picture can match the size of its own display screen. After the user starts the APP, the terminal 300 can display or play the processed opening screen picture.

[0099] It is understandable that the terminal 300 can store the processed opening screen picture locally. That is, the terminal 300 or the server 200 processes the original opening screen picture of the APP only when the terminal 300 downloads and installs the APP for the first time, so that the processed opening screen picture matches the size of the display screen of the terminal 300. After the APP is installed, the terminal 300 can directly display the processed opening screen picture without processing the original opening screen picture.

[0100] It should be noted that the server 200 can send the APP compressed file to the terminal 300 after receiving the request message for obtaining the APP compressed file from the terminal 300, or can actively send the APP compressed file to the terminal 300, which is not limited by the embodiment of the present application. For example, the server 200 can push the updated APP compressed file to the terminal 300 so that the terminal 300 updates the local APP version.

[0101] It should be noted that the image processing method provided in the embodiment of the present application can be used to process the opening screen image of the APP, can also be used to process the screen saver image, can also be used to process the advertising image in the APP, etc. The embodiment of the present application does not limit the type of image to be processed. For the convenience of description, the following will take the processing of the opening screen image of the APP as an example to introduce the embodiment of the present application.

[0102] For example, a large number of screen saver images are maintained in the server 200. The server 200 can push the screen saver images to the terminal 300, or after the terminal 300 requests the server to send the screen saver images, the server 200 can send the screen saver images to the terminal 300. Before the server 200 sends the screen saver images to the terminal 300, the server 200 can perform processing such as cropping, stretching, shrinking or enlarging the original screen saver images according to the size of the display screen of the terminal 300, so that the processed screen saver images can match the size of the display screen of the terminal 300. Afterwards, the server 200 can send the processed screen saver images to the terminal 300. The terminal 300 receives the processed screen saver images and displays or plays the processed screen saver images.

[0103] For another example, a large number of screen saver images are maintained in the server 200. The server 200 can push the screen saver images to the terminal 300, or after the terminal 300 requests the server to send the screen saver images, the server 200 can send the screen saver images to the terminal 300. The terminal 300 receives the original screen saver images from the server 200, and can perform processing such as cropping, stretching, shrinking or enlarging the original screen saver images according to the size of its own display screen, so that the processed screen saver images can match the size of its own display screen. Afterwards, the terminal 300 can display or play the processed screen saver images.

[0104] In another exemplary scenario, the image processing method provided in the embodiment of the present application can be applied in the local image processing scenario of the server 200 or the local image processing scenario of the terminal 300. For example, when displaying a locally stored image, the server 200 (or terminal 300) can perform processing such as cropping, stretching, reducing or enlarging the locally stored image according to the image processing method provided in the embodiment of the present application, so that the processed image can match the size of its own display screen. For another example, the user can input a picture (such as selecting a picture from the locally stored pictures) and a target size, and the server 200 (or terminal 300) can perform processing such as cropping, stretching, reducing or enlarging the picture according to the target size, so that the processed picture can reach the target size. Among them, the locally stored pictures can be pictures in locations such as a local media center, a gallery, or a cache center.

[0105] Among them, the server 200 and the terminal 300 can be interconnected through a communication network, and the communication network can be a local area network or a wide area network transferred through a relay device. When the communication network is a local area network, exemplarily, the communication network can be a short-range communication network such as a wifi hotspot network, a wifi P2P network, a Bluetooth network, a zigbee network, or a near-field communication (NFC) network. When the communication network is a wide area network, exemplarily, the communication network can be a third-generation wireless telephone technology (3G) network, a fourth-generation mobile communication technology (4G) network, a fifth-generation mobile communication technology (5G) network, a future-evolved public land mobile network (PLMN) or the Internet, etc. Figure 1 In the scenario shown, different electronic devices can exchange data through a communication network. For example, the terminal 300 sends a request message for obtaining an APP compressed file to the server 200, and the server 200 sends the APP compressed file to the terminal 300, etc.

[0106] The following is an exemplary description of the server 200 and the terminal 300 respectively:

[0107] 1. Server 200:

[0108] Specifically, in one scenario, if the server 200 can process the original opening screen image according to the size of the terminal 300 display screen so that the processed opening screen image can match the size of the terminal 300 display screen, the server 200 can be a single server, a server cluster, or a cloud server storing application code related to image processing. Figure 2 Shown is a block diagram of a partial structure of a server 200 related to various embodiments of the present application.

[0109] like Figure 2 As shown, the server 200 may include: a processor 201 , a memory 202 , and a transceiver 203 . One or more computer programs are stored in the memory 202 and configured to be executed by the one or more processors 201 .

[0110] The processor 201 may be a central processing unit (CPU) or a digital processing unit, etc. The processor 201 may be the control center of the server 200, and uses various interfaces and lines to connect various parts of the entire server 200, and executes various functions related to image processing by running or executing computer programs stored in the memory 202, and calling computer programs related to image processing stored in the memory 202, so as to perform various functions related to image processing, such as rendering, cropping, stretching, compressing, etc. of images.

[0111] The transceiver 203 can be used to receive a request message sent by the terminal 300 to obtain an APP compressed file, and to send the opening screen image processed by the processor 201 to the terminal 300, etc.

[0112] Exemplarily, the server 200 may further include a database 204. The database 204 may be used to store a large number of APP compressed files, original opening screen pictures corresponding to each APP, or processed opening screen pictures, etc.

[0113] The specific connection medium between the processor 201 and the memory 202, the processor 201 and the database 204, etc. is not limited in the embodiment of the present application. Figure 2 In the embodiment, the processor 210, the memory 202, the transceiver 203 and the database 204 are connected via a bus 205. Figure 2 The connections between other components are shown in bold lines, which are only for schematic illustration and are not intended to be limiting. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0114] The memory 202 may be a volatile memory, such as a random-access memory (RAM); the memory 202 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 202 may be any other medium that can be used to carry or store program codes in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 202 may be a combination of the above memories.

[0115] 2. Terminal 300:

[0116] The terminal 300 may be a portable electronic device that also includes other functions such as a personal digital assistant and / or a music player, such as a mobile phone, a tablet computer, a wearable device with a wireless communication function (such as a smart watch), etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with iOS, Android, Microsoft or other operating systems. The above-mentioned portable electronic devices may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (such as a touch panel). The following description takes the terminal 300 as a mobile phone as an example, Figure 3 Shown is a block diagram of a partial structure of a terminal 300 related to various embodiments of the present application.

[0117] like Figure 3 As shown, the terminal 300 can be a mobile phone, which may include a processor 1110, an external memory interface 1120, an internal memory 1121, a USB interface 1130, a charging management module 1140, a power management module 1141, a battery 1142, an antenna 1, an antenna 2, a mobile communication module 1150, a wireless communication module 1160, an audio module 1170, a speaker 1170A, a receiver 1170B, a microphone 1170C, an earphone interface 1170D, a sensor module 1180, a button 1190, a motor 1191, an indicator 1192, a camera 1193, a display screen 1194, and a SIM card interface 1195, etc.

[0118] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the terminal 300. In other embodiments of the present application, the terminal 300 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0119] The processor 1110 may include one or more processing units, for example, the processor 1110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0120] The controller may be the nerve center and command center of the terminal 300. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0121] A memory may also be provided in the processor 1110 for storing instructions and data. In some embodiments, the memory in the processor 1110 is a cache memory. The memory may store instructions or data that the processor 1110 has just used or cyclically used. If the processor 1110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 1110, and thus improves the efficiency of the system.

[0122] In some embodiments, the processor 1110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0123] The wireless communication function of the terminal 300 can be implemented through the antenna 1, the antenna 2, the mobile communication module 1150, the wireless communication module 1160, the modem processor, and the baseband processor. For example, the terminal 300 can send a request message for obtaining an APP compressed file to the server 200, and receive an APP compressed file from the server 200, etc., through the antenna 1, the antenna 2, the mobile communication module 1150, the wireless communication module 1160, the modem processor, and the baseband processor.

[0124] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal 300 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, a cellular network antenna can be reused as a wireless local area network diversity antenna. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0125] The mobile communication module 1150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the terminal 300. The mobile communication module 1150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 1150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 1150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 1150 can be set in the processor 1110. In some embodiments, at least some of the functional modules of the mobile communication module 1150 can be set in the same device as at least some of the modules of the processor 1110.

[0126] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 1170A, a receiver 1170B, etc.), or displays an image or video through a display screen 1194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 1110 and be set in the same device as the mobile communication module 1150 or other functional modules.

[0127] The wireless communication module 1160 can provide wireless communication solutions including wireless local area networks (WLAN), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the terminal 300. The wireless communication module 1160 can be one or more devices integrating at least one communication processing module. The wireless communication module 1160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 1110. The wireless communication module 1160 can also receive the signal to be sent from the processor 1110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0128] In some embodiments, the antenna 1 of the terminal 300 is coupled to the mobile communication module 1150, and the antenna 2 is coupled to the wireless communication module 1160, so that the terminal 300 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0129] The terminal 300 implements the display function through a GPU, a display screen 1194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 1194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 1110 may include one or more GPUs that execute program instructions to generate or change display information. In an embodiment of the present application, the terminal 300 implements the display or playback of the opening screen picture through a GPU, a display screen 1194, and an application processor.

[0130] The display screen 1194 is used to display pictures, videos, etc. The display screen 1194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal 300 may include 1 or N display screens, where N is a positive integer greater than 1. In an embodiment of the present application, the display screen 1194 can be used to display or play a processed opening screen picture.

[0131] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the terminal 300 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0132] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the terminal 300 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0133] The external memory interface 1120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal 300. The external memory card communicates with the processor 1110 through the external memory interface 1120 to implement a data storage function, such as storing files such as pictures and videos in the external memory card.

[0134] The internal memory 1121 can be used to store computer executable program codes, which include instructions. The processor 1110 executes various functional applications and data processing of the terminal 300 by running the instructions stored in the internal memory 1121. The memory 1121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a video playback function, a picture display function, etc.), etc. The data storage area may store data created during the use of the terminal 300 (such as audio data, a phone book, etc.), etc. In addition, the memory 1121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0135] The embodiment of the present application takes the Android system with a layered architecture as an example to exemplify the software structure of the terminal 300 .

[0136] Figure 4 It is a software structure block diagram of the terminal 300 according to an embodiment of the present invention.

[0137] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

[0138] The application layer can include a series of application packages.

[0139] like Figure 4 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.

[0140] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0141] like Figure 4 As shown, the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, and the like.

[0142] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0143] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0144] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0145] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0146] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0147] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0148] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0149] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0150] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0151] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0152] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0153] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0154] A 2D graphics engine is a drawing engine for 2D drawings.

[0155] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0156] At present, in order to improve the efficiency of designing the opening screen picture, one method is that the server can crop the original opening screen picture according to the size of the terminal display screen, and the aspect ratio of the cropped opening screen picture is the same as the aspect ratio of the terminal display screen. Furthermore, the server can proportionally reduce or enlarge the cropped opening screen picture, and the processed opening screen picture can match the size of the terminal display screen. However, when the croppable area of ​​the original opening screen picture is insufficient, the direct cropping method will over-crop, resulting in incomplete content of the cropped opening screen picture and distortion.

[0157] For example, the aspect ratio of the original splash screen image is 7:3, and the aspect ratio of the terminal display screen is 5:3. The croppable area of ​​the original splash screen image accounts for 8% of the width of the original splash screen image, while the width value that needs to be cropped should be 28.6% of the width of the original splash screen image. Obviously, the croppable area of ​​the original splash screen image is insufficient. In this case, the server directly crops the original splash screen image according to the aspect ratio of the terminal display screen, and will crop 28.6% of the width of the original splash screen image. The aspect ratio of the cropped splash screen image is the same as that of the terminal display screen. However, since the actual cropping area is larger than the croppable area, part of the content of the main element will be cropped during the actual cropping, resulting in over-cropping, making the content of the cropped splash screen image incomplete and distorted, such as Figure 5 shown.

[0158] Another way is that the server can identify the main elements of the original opening screen picture, and crop the original opening screen picture according to the identified main elements, and the cropped opening screen picture includes the identified main elements. Furthermore, the server can stretch or shrink the cropped opening screen picture according to the size of the terminal display screen, and the processed opening screen picture can match the size of the terminal display screen. However, in the case where the main element is not single, the server may only identify part of the main elements in the opening screen picture when identifying the main elements of the entire original opening screen picture. Then the server crops the original opening screen picture according to the identified main elements, which will result in the cropped opening screen picture only including the identified part of the main elements, making the content of the cropped opening screen picture incomplete. In addition, when the server stretches or shrinks the cropped picture, the subject elements in the processed opening screen picture will be severely deformed, resulting in distortion.

[0159] For example, the original opening screen image includes main element 1 and main element 2, wherein main element 1 includes people and text, and main element 2 includes products and text. The server identifies the main elements of the original opening screen image, and identifies main element 1, but does not identify main element 2. On the one hand, the server crops the original opening screen image according to main element 1, and the cropped opening screen image includes main element 1 but does not include main element 2, which makes the content of the cropped opening screen image incomplete and distorted. On the other hand, in order to make the opening screen image cover the entire display screen of the terminal, the server stretches the cropped opening screen image, which causes serious deformation of the people and text in the opening screen image, and also causes distortion. Figure 6 shown.

[0160] In view of this, an embodiment of the present application provides a method for processing an image, which can process an image, and the processed image can match the target size, and the processed image retains complete image information without distortion.

[0161] It should be noted that the execution subject of the image processing method provided in the embodiment of the present application can be a server or a terminal, and the embodiment of the present application does not limit this. For ease of understanding, the image processing method provided in the embodiment of the present application is introduced below by taking the server as the execution subject as an example.

[0162] Figure 7 The following is a flow chart of a method for image processing provided by an embodiment of the present application. The method can be applied to Figure 1 In the application scenario shown, for example, the server in the embodiment of the present application can be Figure 1The server 200 shown. It is understandable that in the embodiment of the present application, the steps performed by the server may also be specifically performed by a module or component of the server, such as a chip or chip system in the server. Figure 7 As shown, the process of the method can be as follows.

[0163] S701: The server obtains the first picture.

[0164] Exemplarily, the first picture may include two or more layers. For example, the format of the first picture may be PSD format or PDD format, etc. The number of first pictures may be one or more. For example, when the number of first pictures is multiple, the multiple first pictures may be played in order.

[0165] Exemplarily, the size of the first picture does not match the target size. The target size may include a target width value and a target height value. The size of the first picture does not match the target size may mean that the width value of the first picture is less than or greater than the target width value, and / or the height value of the first picture is less than or greater than the target height value.

[0166] As an example, the target size may be the size of the terminal display screen. For example, before S801, the server may receive a request message from the terminal to obtain a first APP compressed file, and the request message may include an identifier of the first APP. The server may determine the first APP compressed file from multiple APP compressed files maintained locally according to the identifier of the first APP, and the first APP compressed file includes a first picture, such as the first picture may be the original opening screen picture of the first APP or the original advertisement picture in the first APP. Since the first picture does not match the size of the terminal display screen, such as the first picture cannot cover the entire display screen of the terminal, or the display screen of the terminal cannot fully display the first picture, the server may obtain the first picture in the first APP compressed file after determining the first APP compressed file, such as by decompressing the first APP compressed file to obtain the first picture, and use the picture processing method provided in the embodiment of the present application to process the first picture so that the processed first picture can match the size of the terminal display screen. Among them, the processed first picture matches the size of the terminal display screen, which means that the width value of the processed first picture is equal to the width value of the terminal display screen, and the height value of the processed first picture is equal to the height value of the terminal display screen.

[0167] As another example, the target size may be a size input by a user. For example, a user may input a first picture to a server, or select a first picture from a plurality of pictures locally on the server, and input a target size. In response, after obtaining the first picture and the target size, the server may process the first picture using the picture processing method provided in an embodiment of the present application, so that the processed first picture matches the target size. Among them, matching the processed first picture with the target size may mean that the width value of the processed first picture is equal to the target width value, and the height value of the processed first picture is equal to the target height value.

[0168] S702: The server determines the element type of each layer in the first picture.

[0169] Exemplarily, the server may divide at least two layers in the first image into a first layer and a second layer according to the element type, wherein the first layer is one or more layers of the at least two layers whose element type is a background element, and the second layer is one or more layers of the at least two layers whose element type is a main element.

[0170] Exemplarily, the server may parse the first image to obtain at least two layers, and determine the element type of each layer by identifying the content of the at least two layers. For example, the server may determine the element type of each layer in the first image by using an RGB component distribution statistics algorithm, a Laplace algorithm, or a subject saliency recognition algorithm. For example, the server may parse the first image to obtain five layers, which are respectively recorded as layer 1, layer 2, layer 3, layer 4, and layer 5. Furthermore, the server may identify the content of each of the five layers by using a subject saliency recognition algorithm, determine the element type of each layer, and divide the five layers into a first layer and a second layer. Figure 8 As shown, layer 1 is a pure color picture, and most of the element images of layer 1 are blocked by other layers (such as layer 2, layer 3, layer 4, and layer 5), so the element type of layer 1 can be the main background element in the background elements, recorded as background element 1; layer 2 is not a pure color picture, but some element images of layer 2 are partially covered by other layers (such as layer 5), so the element type of layer 2 can be other background elements in the background elements, recorded as background element 2; the element images in layers 3, 4, and 5 are not blocked or covered by the element images of other layers, so layers 3, 4, and 5 are all main elements, recorded as main element 1, main element 2, and main element 3 respectively; among them, the first layer includes layer 1 and layer 2, and the second layer includes layer 3, layer 4, and layer 5.

[0171] S803: The server determines a first cropping area.

[0172] Exemplarily, the first cropping area may be the minimum area that needs to be cropped so that the aspect ratio of the cropped first image is the same as the aspect ratio of the target size. That is, the server crops the first cropping area of ​​the first image to obtain the cropped first image, and the aspect ratio of the cropped first image is the same as the aspect ratio of the target size.

[0173] Exemplarily, the first cropping area may be one area or multiple areas. For example, the first cropping area may be the minimum width value that needs to be cropped in the width direction so that the aspect ratio of the cropped first image is the same as the aspect ratio of the terminal display screen. Alternatively, the first cropping area may be the minimum height value that needs to be cropped in the height direction so that the aspect ratio of the cropped first image is the same as the aspect ratio of the terminal display screen.

[0174] Exemplarily, the server may determine the first cropping area of ​​the first image according to the size of the first image and the target size. Specifically, the server may determine the width value and / or height value of the first cropping area of ​​the first image according to the aspect ratio of the first image and the aspect ratio of the target size. For example, the server may determine the width value and / or height value of the first cropping area of ​​the first image according to the following formula (1).

[0175]

[0176] Wherein, max(·) can be used to represent a maximum value operation. Δw can represent the width value of the first cropping area, and Δh can represent the height value of the first cropping area. s Can represent the width value of the first picture, h s It can represent the height value of the first picture. t Can represent the target width value, h t Can represent the target height value.

[0177] For example, the server may crop the width of the first image without cropping the height, and the aspect ratio of the cropped first image is the same as the aspect ratio of the target size. Assume that the aspect ratio of the first image is w s / h s , the aspect ratio of the target size is w t / h t , then the proportion of the first image that needs to be cropped is (w t / h t -w s / h s ), converted to absolute crop size can be h s *(w t / h t -w s / h s), which is the width value of the first cropping area. For another example, the server can crop the height of the first image without cropping the width, and the aspect ratio of the cropped first image is the same as the aspect ratio of the target size. Assume that the aspect ratio of the first image is h s / w s , the aspect ratio of the target size is h t / w t , then the proportion of the first image that needs to be cropped is (h t / w t -h s / w s ), which can be converted to absolute crop size w s *(h t / w t -h s / w s ), which is the height of the first clipping area.

[0178] For example, the width value of the first image is 450 millimeters (mm), and the height value of the first image is 360 mm. The target width value is 400 mm, and the target height value is 300 mm. The server can determine the width value of the first cropping area as Δw=max(30,0), and the height value of the first cropping area as Δh=max(-22.5,0) according to formula (1), that is, the width value of the first cropping area is 30 mm, and the height value is 360 mm, which means that the server needs to crop the first image in the width direction, and the width value to be cropped is 30 mm, and there is no need to crop in the height direction, so as to ensure that the aspect ratio of the cropped first image is the same as the aspect ratio of the target size, such as Fig. 9 As shown. It is understandable that the server can crop one side of the first image, cutting off the width value of 30 mm, such as Fig. 9 As shown, you can also crop the two sides of the first picture, and crop a total of 30mm width value, such as Fig.10 shown.

[0179] S704: The server determines whether the first cropping area is located in the croppable area of ​​the first image. If the server determines that the first cropping area is located in the croppable area of ​​the first image, the server executes the content shown in S705; if the server determines that the first cropping area is not located in the croppable area of ​​the first image, the server executes the content shown in S706.

[0180] Exemplarily, the first cropping area being located within the croppable area of ​​the first image may mean that, when cropping in the width direction, the width value of the first cropping area is less than or equal to the width value of the croppable area of ​​the first image, or, when cropping in the height direction, the height value of the first cropping area is less than or equal to the height value of the croppable area of ​​the first image. For example, if the height value of the first cropping area is less than or equal to the height value of the croppable area, the server may execute the content shown in step S705; otherwise, the server may execute the content shown in step S706. For another example, if the width value of the first cropping area is less than or equal to the width value of the croppable area, the server may execute the content shown in step S705; otherwise, the server may execute the content shown in step S706.

[0181] The croppable area may refer to the area in the first image except for the minimum circumscribed horizontal rectangle. The minimum circumscribed horizontal rectangle includes all the main elements of the first image. For example, the server may traverse the coordinates of the pixel points of all the main elements in the first image, and the coordinates of the pixel points may be recorded as (x, y). Then the horizontal coordinates of the pixel points of all the main elements in the first image may constitute a set X, and the vertical coordinates of the pixel points of all the main elements in the first image may constitute a set Y. Since the minimum circumscribed horizontal rectangle of the first image includes all the main elements in the first image, the coordinates of the four vertices of the minimum circumscribed horizontal rectangle of the first image may be {min(X), min(Y)}, {min(X), max(Y)}, {max(X), min(Y)} and {max(X, max(Y)}, respectively. Fig.11A As shown, since the main element of the first image is not included in the croppable area, the image information will not be lost even if the croppable area is cropped, which means that when the server crops the croppable area, the integrity of the content of the cropped image can be guaranteed.

[0182] Exemplarily, the server may determine the croppable area of ​​the first image based on the first image and the minimum horizontal rectangle of the first image. For example, the server may determine the width of the croppable area based on the width of the first image and the width of the minimum horizontal rectangle of the first image, and / or the server may determine the height of the croppable area based on the height of the first image and the height of the minimum horizontal rectangle of the first image. Fig.11AFor example, the coordinates of the four vertices of the first image may be {0, y1}, {0, min(Y)}, {max(X), min(Y)} and {max(X), y1} respectively. The coordinates of the four vertices of the minimum circumscribed horizontal rectangle of the first image may be {min(X), min(Y)}, {min(X), max(Y)}, {max(X), min(Y)} and {max(X, max(Y)} respectively. Further, the server determines that the width value of the croppable area is {max(X)-min(X)} based on the width value of the first image and the width value of the minimum circumscribed horizontal rectangle of the first image; the server may determine that the height value of the croppable area is {y1-max(Y)} based on the height value of the first image and the height value of the minimum circumscribed horizontal rectangle of the first image, such as Fig. 11B shown.

[0183] In another possible implementation, in step S804, the server may determine whether the first cropping area satisfies a preset condition. If the server determines that the first cropping area satisfies the preset condition, the server may execute the content shown in S705. If the server determines that the first cropping area does not satisfy the preset condition, the server may execute the content shown in S706. For example, the preset condition may be that the first cropping area is greater than or equal to 10 percent of the first image and less than or equal to 20 percent of the first image. The preset condition may be pre-configured.

[0184] For example, the server crops the first image in the width direction. When the width value of the first cropped area is greater than or equal to 10% of the width value of the first image and less than or equal to 20% of the width value of the first image, the server may determine that the first cropped area meets the preset condition and execute the content shown in step S705; otherwise, the server may determine that the first cropped area does not meet the preset condition and execute the content shown in step S706. Fig.10 For example, the server crops the first image in width. According to step S703, the width of the first cropped area is 30 mm, which accounts for 6.7% of the width of the first image, and is obviously not within the range of 10% to 20%. Therefore, Fig.10 The first cropping area in does not meet the preset conditions.

[0185] S705: The server crops the first image according to the first cropping area to obtain a second image.

[0186] Exemplarily, when the first cropping area is located in the croppable area of ​​the first image, the server can directly crop the first cropping area, and the aspect ratio of the cropped first image is the same as the aspect ratio of the target size. Further, if the size of the cropped first image matches the target size, the cropped first image is the second image. If the size of the cropped first image does not match the target size, the server can proportionally reduce or enlarge the cropped first image according to the target size to obtain the second image. Among them, the size of the second image matches the target size, that is, the length value of the second image is equal to the length value of the target size, and the width value of the second image is equal to the width value of the target size. Since the first cropping area is located in the croppable area of ​​the first image, the main element is not included in the first cropping area, that is, the second image includes complete image information.

[0187] S706: The server configures anchor points for any two layers in the first image to obtain an anchor point set.

[0188] Exemplarily, the server can configure anchor points for any two layers in the first image to obtain an anchor point set, and the anchor point can be used to determine the relative position between the two layers. For example, the server can configure anchor points for the third layer and the fourth layer according to the distance between the third layer and the fourth layer, such as the server can configure anchor points for the third layer and the fourth layer according to the Hesdorff distance between the third layer and the fourth layer, wherein the third layer and the fourth layer are any two layers in the first image. Since the anchor point is a coordinate that does not change relative to the image reference coordinate system, when the server configures anchor points for any two layers in the first image, the positions of the third layer and the fourth layer relative to the anchor point remain unchanged after the first image is stretched, compressed, reduced or enlarged. From a visual perspective, the relative position between the third layer and the fourth layer does not change before and after the first image is transformed, thereby avoiding the distortion problem caused by the transformation of the first image.

[0189] The following describes the specific implementation process of step S706 by taking the third layer as layer A and the fourth layer as layer B as an example. Layer A and layer B can be any two layers in the first image. For example, layer A is Figure 8 Layer 1 and Layer B in Figure 8 Layer 2 in , or layer A is Figure 8 Layer 2 and Layer B in Figure 8 Layer 3 in , or layer A is Figure 8 Layer 2 and Layer B in Figure 8 Layer 4 in, etc.

[0190] Fig.12The schematic diagram of the process of configuring anchor points for layer A and layer B provided by the server in the embodiment of the present application is shown. The pixel points of layer A can be recorded as pixel point a, the pixel point set of layer A can be recorded as set A, the pixel points of layer B can be recorded as pixel point b, and the pixel point set of layer B can be recorded as set B. Fig.12 As shown, the process may include:

[0191] Step S1201: the server may traverse set A and set B to determine the Hosdorff distance between layer A and layer B.

[0192] Exemplarily, the server may determine the Hessdorff distance between layer A and layer B according to formula (2). Formula (2) may be as follows:

[0193] d H (A,B)=max{sup a∈A infd b∈B (a,b),sup b∈B infd a∈A (a,b)} (Formula 2)

[0194] Among them, d H (A,B) represents the Hochsdorff distance between layer A and layer B, sup(·) represents the supremum operation, and inf(·) represents the infimum operation.

[0195] Step S1202: The server determines whether the Hesdorff distance between layer A and layer B satisfies a first preset condition.

[0196] The first preset condition is greater than 0 and less than a first threshold.

[0197] Exemplarily, if the Hessdorff distance between layer A and layer B does not meet the first preset condition and is greater than or equal to the first threshold, the server may execute the content described in step S1203. If the Hessdorff distance between layer A and layer B meets the first preset condition, the server may execute the content shown in step S1204. If the Hessdorff distance between layer A and layer B does not meet the first preset condition and is equal to 0, the server may execute the content shown in step S1205. The first threshold may be preset, and the first threshold may be a very small positive number.

[0198] Step S1203: The server determines the center point of layer A and the center point of layer B as the anchor points between layer A and layer B.

[0199] Exemplarily, the Hosdorff distance between layer A and layer B is greater than or equal to the first threshold, which means that layer A and layer B are non-intersecting in positional relationship, and the Hosdorff distance between layer A and layer B is greater than or equal to the first threshold. In this case, the server can configure the center point of layer A and the center point of layer B as anchor points between layer A and layer B.

[0200] by Figure 8 For example, main element 3 (i.e., layer 5) and main element 1 (i.e., layer 3) do not intersect in positional relationship, and the Hesdorff distance between the two is greater than or equal to the first threshold, the server can configure the center point of main element 3 and the center point of main element 1 as the anchor point between main element 3 and main element 1, such as the center point of main element 3 is anchor point 1, and the center point of main element 1 is anchor point 2. Similarly, main element 3 and main element 2 (i.e., layer 4) do not intersect in positional relationship, and there is a certain distance between them. The server can configure the center point of main element 3 and the center point of main element 2 as the anchor point between main element 3 and main element 2, such as the center point of main element 2 is anchor point 3, such as Fig.13 shown.

[0201] Step S1204: The server configures anchor points for layer A and layer B according to the first pixel pair.

[0202] The first pixel pair is one or more pairs of pixel points in set A and set B that meet a first preset condition.

[0203] Exemplarily, the Hosdorff distance between layer A and layer B is greater than 0 and less than a first threshold, and the first threshold may be a very small positive number, which means that layer A and layer B are close to but not in contact. In this case, the server may configure anchor points for layer A and layer B based on one or more pairs of pixel points in set A and set B that satisfy a Hosdorff distance greater than 0 and less than the first threshold.

[0204] For example, each pair of one or more pairs of pixels may include a pixel a and a pixel b. For example, the server may determine one or more pairs of pixels satisfying a Hesdorff distance less than the first threshold and greater than 0 according to formula (3).

[0205] 0<argmax a,b {d H (A,B)}<ε (Formula 3)

[0206] Wherein, ε may represent a first threshold, and argmax(·) may be used to determine one or more pairs of pixel points satisfying a Hosdorff distance that is less than the first threshold and greater than 0.

[0207] The following introduces three anchor point configuration methods.

[0208] In method 1, when the first pixel pair is a pair of pixel points, the server may determine the center point of the pair of pixel points as the anchor point between layer A and layer B. For example, the coordinates of pixel point a are (x1, y1), and the coordinates of pixel point b are (x2, y2), then the coordinates of the anchor point between layer A and layer B may be ((x1+x2) / 2, (y1+y2) / 2).

[0209] Method 2: When the first pixel pair is multiple pairs of pixel points and the Hochdorff distances corresponding to the multiple pairs of pixel points are different, the server can determine the center point of a pair of pixel points corresponding to the smallest Hochdorff distance among the multiple pairs of pixel points as the anchor point between layer A and layer B.

[0210] Mode 3: When the first pixel pair is a plurality of pairs of pixel points, and the Hesdorff distances corresponding to the plurality of pairs of pixel points are the same, the server may determine the center point of the plurality of pairs of pixel points as the anchor point of layer A and layer B. For example, the server may first obtain the center point of each pair of pixel points respectively to obtain a plurality of center points, and then perform an average operation on the plurality of center points to obtain the coordinates of the anchor points of layer A and layer B. For another example, the server may directly perform an average operation on the coordinates of the plurality of pairs of pixel points to obtain the coordinates of the anchor points of layer A and layer B.

[0211] by Figure 8 For example, if the Hesdorff distance between layer 2 (i.e., background element 2) and layer 3 (i.e., main element 1) is greater than 0 and less than the first threshold, the server can configure anchor points for layer 2 and layer 3 based on one or more pairs of pixel points in layer 2 and layer 3 that satisfy the Hesdorff distance greater than 0 and less than the first threshold. For example, if there is a pair of pixel points in layer 2 and layer 3 whose corresponding Hesdorff distance is greater than 0 and less than the first threshold, the server can configure the center point of the pair of pixel points as the anchor point between layer 2 and layer 3, recorded as anchor point 4. Similarly, if the Hesdorff distance between layer 2 and layer 4 (i.e., main element 2) is greater than 0 and less than the first threshold, the server can configure anchor points for layer 2 and layer 4 based on one or more pairs of pixel points in layer 2 and layer 4 that satisfy the Hesdorff distance greater than 0 and less than the first threshold. Configurable anchor points between layer 2 and layer 4. For example, if there are multiple pairs of pixel points in layer 2 and layer 4, the corresponding Hesdorff distances are greater than 0 and less than the first threshold value, the server can configure the center point of a pair of pixel points corresponding to the smallest Hesdorff distance among the multiple pairs of pixel points as the anchor point between layer 2 and layer 4, recorded as anchor point 5, such as Fig.14 shown.

[0212] S1205: When layer A is in contact with layer B, the server determines the contact point between layer A and layer B as the anchor point between layer A and layer B; when layer A is intersecting with layer B, the server determines the center point of the intersection area between layer A and layer B as the anchor point between layer A and layer B; when layer A contains layer B, the server determines the center point of layer A as the anchor point between layer A and layer B.

[0213] Exemplarily, the Hessdorff distance between layer A and layer B is 0, which means that the positional relationship between layer A and layer B can be a contact relationship, an intersection relationship, or a containment relationship. For example, the server can determine the positional relationship between layer A and layer B based on set A and set B.

[0214] For example, when the coordinates of the pixel points corresponding to some edge lines in set A are equal to the coordinates of the pixel points corresponding to some edge lines in set B, the server can determine that layer A and layer B are in contact. Further, the server can configure the contact point between layer A and layer B as an anchor point between layer A and layer B, such as Fig.15A shown.

[0215] For example, when the coordinates of some first pixel points in set A are equal to the coordinates of some second pixel points in set B, the server can determine that layer A and layer B are in an intersecting relationship. Further, the server can configure the center point in the intersecting area of ​​layer A and layer B as the anchor point between layer A and layer B, such as Fig. 15B The first pixel point may be a pixel point in set A except the pixel point corresponding to the edge line, and the second pixel point may be a pixel point in set B except the pixel point corresponding to the edge line.

[0216] For another example, when set B is a subset of set A, the server may determine that the positional relationship between layer A and layer B is a containment relationship, that is, layer A contains layer B. Further, the server may configure the center point of layer A as the anchor point between layer A and layer B, such as Fig. 15C shown.

[0217] by Figure 8For example, layer 1 includes layer 2, layer 3, layer 4, and layer 5. The server can configure the center point of layer 1 as the anchor point between layer 1 and layer 2, the anchor point between layer 1 and layer 3, the anchor point between layer 1 and layer 4, and the anchor point between layer 1 and layer 5, recorded as anchor point 6. Similarly, layer 2 includes layer 5, and the server can configure the center point of layer 2 as the anchor point between layer 2 and layer 5, recorded as anchor point 7. The positional relationship between layer 3 and layer 4 is a contact relationship, and the server can configure the contact point between layer 3 and layer 4 as the anchor point between layer 3 and layer 4, recorded as anchor point 8, such as Fig.16 shown.

[0218] At this point, the server has completed the configuration of the anchor point between layer A and layer B. The server can Fig.12 The content shown is to configure anchor points for any two layers in the first layer to obtain an anchor point set. For example, the anchor point set can be {anchor point 1, anchor point 2, anchor point 3, anchor point 4, anchor point 5, anchor point 6, anchor point 7, anchor point 8}, such as Fig.13 , Fig.14 as well as Fig.16 shown.

[0219] S707: The server determines a scaling vector of the background element according to the target size.

[0220] Exemplarily, the server may determine the scaling vector of each background element in the width direction according to the size of the first picture, the target size, and the height value of each background element. Alternatively, the server may determine the scaling vector of each background element in the height direction according to the size of the first picture, the target size, and the width value of each background element.

[0221] Exemplarily, the server may determine the scaling vector of each background element according to the following formula (4).

[0222]

[0223] Among them, Δw i It can represent the width value that the background element i can stretch or shrink, Δh i It can represent the height value that the background element i can stretch or shrink. s Can represent the width value of the first picture, h s It can represent the height value of the first picture. is Can represent the width value of background element i, h is It can represent the height value of background element i. t Can represent the target width value, h t The target height value can be identified.

[0224] S708: The server stretches or compresses the first layer in the first picture according to the scaling vector.

[0225] by Figure 8 For example, the first layer includes background element 2 and background element 1. The width value of the first image is 1600 mm, and the height value of the first image is 960 mm. The target width value is 1280 mm, and the target height value is 720 mm.

[0226] For background element 2, the width value of background element 2 is 827 mm, and the height value of background element 2 is 960 mm. The server determines the width value Δw that background element 2 needs to stretch or shrink according to the above formula (4): i = max(106.7,0), the width value Δh of the background element 2 that needs to be stretched or shrunk i =max(-31,0). That is, the server can use anchor point 4 or anchor point 5 as the starting point, stretch the background element 2 by 106.7 mm in the width direction, and keep it unchanged in the height direction, such as Fig.17 As shown in the figure, the aspect ratio of the stretched first image is the same as that of the target size.

[0227] For background element 1, the server can determine the width value of background element 1 stretched in the width direction, or the height value of background element 1 stretched in the height direction according to formula (4), and then stretch background element 1. Alternatively, since background element 1 is a main background element of a pure color, its stretching or shrinking does not affect the image information and does not cause distortion. Therefore, the server can also directly stretch or shrink background element 1. The size of background element 1 after stretching or shrinking matches the target size, thereby saving computing costs.

[0228] S709: The server combines the second layer and the stretched or compressed first layer according to the anchor point set to obtain a reconstructed first image.

[0229] Exemplarily, the server may determine the relative position between any two layers in the first image according to the anchor point set, and reorganize the second layer and the stretched or compressed first layer according to the relative position between the any two layers to obtain the reorganized first image.

[0230] by Figure 8 For example, the server can use anchor point 6 (such as Fig.16 The server can determine the relative position between the stretched background element 1 and the stretched background element 2, the relative position between the stretched background element 1 and the main element 1, the relative position between the stretched background element 1 and the main element 2, and the relative position between the stretched background element 1 and the main element 3. Fig.14As shown) determine the relative position of the stretched background element 2 and the main element 1, according to the anchor point 5 (as shown Fig.14 As shown in FIG. 1 ), determine the relative positions of the stretched background element 2 and the main element 2, and according to the anchor point 7 (as shown in FIG. Fig.16 The server can determine the relative position between the stretched background element 2 and the main element 3 according to the anchor point 8 (as shown in FIG. Fig.16 As shown) determine the relative position between main element 1 and main element 2, and according to anchor point 1 and anchor point 2 (as shown Fig.13 The server can determine the relative position between anchor point 1 and anchor point 3 (as shown in Fig.13 The server may then perform reorganization according to the relative positions of any two layers to obtain a reorganized first image. The aspect ratio of the reorganized first image is the same as the aspect ratio of the target size.

[0231] S710: The server proportionally reduces or enlarges the reorganized first image to obtain a second image.

[0232] Exemplarily, the server may proportionally reduce or enlarge the reorganized first image according to the size of the first image and the target size to obtain the second image. The size of the second image matches the target size, that is, the width value of the second image is equal to the target width value, and the height value of the second image is equal to the target height value. For example, when the second image is displayed on the terminal, the size of the second image matches the size of the terminal display screen. Optionally, if the coverage of the layer exceeds the target size, the server may crop the layer according to the target size.

[0233] For example, if the server stretches the background element in the width direction, the server may determine the scaling ratio according to the height value of the first image, the height value of the background element that can be stretched in the height direction, and the target height value. For example, the server may determine the scaling ratio according to the following formula (5). In this case, the height value of the background element that can be stretched in the height direction is 0. Further, the server may proportionally reduce or enlarge the reorganized first image according to the scaling ratio to obtain the second image.

[0234] extend_ration=(h t +Δh i ) / h s (Formula 5)

[0235] Among them, extend_ration can represent the scaling ratio.

[0236] For another example, if the server stretches the background element in the height direction, the server may determine the scaling ratio according to the width value of the first image, the width value that the background element can be stretched in the width direction, and the target width value. For example, the server may determine the scaling ratio according to the following formula (6). In this case, the width value that the background element can be stretched in the width direction is 0. Further, the server may proportionally reduce or enlarge the reorganized first image according to the scaling ratio to obtain the second image.

[0237] extend_ration=(w t +Δw i ) / w s (Formula 6)

[0238] For example, the background element in the reorganized first image is stretched 106.7 mm in the width direction. The server can determine the scaling ratio extend_ration=720 / 960=75% according to formula (5), that is, the server can proportionally reduce the reorganized first image to 75% of the reorganized first image to obtain the second image, such as Fig.18 shown.

[0239] It should be noted that Figure 7 The execution order of each step in is only an example, and the embodiments of the present application do not limit this. For example, the server may first stretch the background elements, and then proportionally reduce or enlarge the reorganized first image, or first proportionally reduce or enlarge the first image, and then stretch and reorganize the background elements in the processed first image. For another example, the server may first determine the anchor points of the first layer and the second layer, and then determine the telescopic vector of the background elements, or first determine the telescopic vector of the background elements, and then determine the anchor points of the first layer and the second layer, or simultaneously determine the anchor points and the telescopic vector of the background elements.

[0240] In the above embodiment of the present application, the first image does not match the target size. By stretching or compressing the first layer, and then reorganizing the second layer and the stretched or compressed first layer based on the anchor point set, a second image including complete image information can be obtained, and the second image matches the target size. On the one hand, the first layer is a layer in which part or all of the element images in the first image are blocked, which means that the first layer includes fewer main body salient features, such as pure color background elements. In the process of stretching or compressing it to match the size of the terminal display screen, there will be no deformation or distortion problems; on the other hand, since the anchor point is a constant coordinate relative to the image reference coordinate system, it can be used to determine the relative position between the two layers. Therefore, by reorganizing the second layer and the stretched or compressed first layer through the anchor point set, it can be ensured that the relative position between any two layers before and after the reorganization remains unchanged. From the perspective of visual perception, the relative position between any two layers does not change before and after the reorganization, thereby avoiding the distortion problem caused by the transformation of the first image.

[0241] Figure 7 The image processing method provided by the present application is mainly introduced from the perspective of the method flow. It can be understood that in order to achieve the above functions, the device may include hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0242] Fig.19 A possible exemplary block diagram of an image processing device involved in an embodiment of the present application is shown. The image processing device 1900 may exist in the form of software. The image processing device 1900 may include: an acquisition unit 1901, a configuration unit 1902, a stretching unit 1903 and a reorganization unit 1904.

[0243] In a possible implementation, the image processing device 1900 may be the above-mentioned Figure 2 Alternatively, the image processing device 1900 may be the server 200 described above, or may be a chip disposed in the server 200. Figure 3 The terminal 300 in the embodiment, or it may also be a chip set in the terminal 300.

[0244] Specifically, in one embodiment, the acquisition unit 1901 may be used to acquire a first picture, the first picture includes at least two layers, the first picture is used to be displayed on a terminal, and the size of the first picture does not match the size of a display screen of the terminal;

[0245] A configuration unit 1902 is used to configure anchor points for any two layers of the at least two layers to obtain an anchor point set, wherein the anchor points are used to determine the relative position between any two layers;

[0246] A stretching unit 1903 is used to stretch or compress the first layer according to the size of the terminal display screen, and the aspect ratio of the stretched or compressed first layer is the same as the aspect ratio of the terminal display screen, wherein the first layer is one or more layers in which part or all of the element images of at least two layers are blocked;

[0247] And, the reorganization unit 1904 is used to reorganize the second layer and the stretched or compressed first layer according to the anchor point set to obtain a second image. When the second image is displayed on the terminal, the size of the second image matches the size of the terminal display screen; wherein the second layer is one or more layers in which the element images of at least two layers are not obscured.

[0248] In a possible design, any two layers include a third layer and a fourth layer, and the configuration unit 1902 is specifically configured to:

[0249] Determine the distance between the third layer and the fourth layer;

[0250] Configure anchor points for the third and fourth layers based on their distances.

[0251] In one possible design, configuration unit 1902 is specifically configured to:

[0252] When the distance between the third layer and the fourth layer is equal to 0, anchor points are configured for the third layer and the fourth layer according to the positional relationship between the third layer and the fourth layer; or,

[0253] When the distance between the third layer and the fourth layer meets the first preset condition, anchor points are configured for the third layer and the fourth layer according to the first pixel pair, wherein the first pixel pair is one or more pairs of pixel points between the third layer and the fourth layer that meet the first preset condition, and the first preset condition is greater than 0 and less than a first threshold; or

[0254] When the distance between the third layer and the fourth layer is greater than the first threshold, the center point of the first layer and the center point of the fourth layer are determined as anchor points between the third layer and the fourth layer.

[0255] In one possible design, configuration unit 1902 is specifically configured to:

[0256] When the third layer and the fourth layer are in contact, a contact point between the third layer and the fourth layer is determined as an anchor point between the third layer and the fourth layer; or,

[0257] When the third layer intersects with the fourth layer, a center point in the intersection area of ​​the third layer and the fourth layer is determined as an anchor point between the third layer and the fourth layer; or,

[0258] When the third layer includes the fourth layer, a center point of the third layer is determined as an anchor point between the third layer and the fourth layer.

[0259] In one possible design, configuration unit 1902 is specifically configured to:

[0260] In the case where the first pixel pair is a pair of pixel points, a center point of the pair of pixel points is determined as an anchor point between the third layer and the fourth layer; or,

[0261] When the first pixel pair is a plurality of pairs of pixel points, and the distance between each pair of pixel points in the plurality of pairs of pixel points is different, a center point of a pair of pixel points with the smallest distance among the plurality of pairs of pixel points is determined as the anchor point between the third layer and the fourth layer; or,

[0262] When the first pixel pair is a plurality of pairs of pixel points, and the distance between each pair of pixel points in the plurality of pairs of pixel points is the same, the center point of the plurality of pairs of pixel points is determined as the anchor point between the third layer and the fourth layer.

[0263] In a possible design, the recombination unit 1903 is specifically used for:

[0264] Recombining the stretched or compressed first layer and the second layer according to the anchor point set to obtain a recombined first image, wherein the aspect ratio of the recombined first image is the same as the aspect ratio of the terminal display screen;

[0265] The reorganized first picture is reduced or enlarged in proportion to the size of the terminal display screen to obtain the second picture.

[0266] In a possible design, the image processing apparatus 2000 may further include a determining unit 1904, which may be used to:

[0267] Determine a croppable area of ​​the first image, where the croppable area is an area of ​​the first image excluding a minimum circumscribed horizontal rectangle, where the minimum circumscribed horizontal rectangle is a minimum horizontal rectangle including the second layer;

[0268] Determine a first cropping area according to the size of the terminal display screen, where the first cropping area is the minimum area that needs to be cropped so that the aspect ratio of the cropped first image is the same as the aspect ratio of the terminal display screen;

[0269] It is determined that the first cropping area is outside the croppable area of ​​the first picture.

[0270] In a possible implementation, the image processing device 1900 may further include a transceiver unit to implement the transceiver function of the image processing device 1900. For example, when the image processing device 1900 is a server 200, the transceiver unit may receive a request message for obtaining an APP compressed file from a terminal 300, and send the second image to the terminal 300. For another example, when the image processing device 1900 is a terminal 300, the transceiver unit may send a request message for obtaining an APP compressed file to the server 200, and receive an APP compressed file from the server 200.

[0271] The division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. Each functional unit in the embodiments of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0272] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0273] like Fig. 20 As shown, the present application embodiment also provides a structural schematic diagram of another possible image processing device. For example, the image processing device 2000 can be Figure 2 Server 200 in, or Figure 3The terminal 300 in the image processing device 2000. The image processing device 2000 may include at least one processor 2001 and at least one communication interface 2002. Further, the image processing device 2000 may also include a memory 2003, and the memory 2003 is used to store computer programs or instructions. The memory 2003 may be a memory in the processor 2001 or a memory outside the processor 2001.

[0274] exist Fig. 20 When each unit module described in the embodiment is implemented by software, the software or program code required for the processor 2001 to perform the corresponding action is stored in the memory 2003. The processor 2001 is used to execute the program or instruction in the memory 2003 to implement the above-mentioned embodiment. Figure 7 or Fig.12 The communication interface 2002 is used to implement the communication between the image processing device 2000 and other devices, for example, the communication between the image processing device 2000 and the server 200 or the communication between the image processing device 2000 and the terminal 300 .

[0275] In the case where the memory 2003 is placed outside the processor, the memory 2003, the processor 2001 and the communication interface 2002 are interconnected via a bus 2004, and the bus 2004 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. It should be understood that the bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 20 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0276] It should be noted that the operations and / or functions of the various modules in the image processing device 2000 are respectively to achieve Figure 7 or Fig.12 For the sake of brevity, the corresponding process of the method shown in is not repeated here.

[0277] The embodiment of the present application also provides a chip system, including: a processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instruction is executed by the processor, the chip system can achieve the above Figure 7 or Fig.12 The method shown in .

[0278] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.

[0279] Optionally, the memory in the chip system may be one or more. The memory may be integrated with the processor or may be separately provided with the processor, which is not limited in the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be provided on different chips. The present application does not specifically limit the type of memory and the arrangement of the memory and the processor.

[0280] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.

[0281] It should be understood that each step in the above method embodiment can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.

[0282] The embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the computer implements the above Figure 7 or Fig.12 The method shown in .

[0283] The present application also provides a computer program product. When a computer reads and executes the computer program product, the computer implements the above Figure 7 or Fig.12 The method shown in .

[0284] It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0285] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0286] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) is integrated in the processor.

[0287] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0288] It should be understood that in various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0289] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0290] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0291] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0292] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0293] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0294] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0295] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for processing an image, characterized in that: include: Acquire a first picture, where the first picture includes at least two layers, the first picture is used to be displayed on a terminal, and a size of the first picture does not match a size of a display screen of the terminal; configuring anchor points for any two layers of the at least two layers to obtain an anchor point set, wherein the anchor points are used to determine the relative positions between the any two layers; Stretching or compressing the first layer according to the size of the terminal display screen, wherein the aspect ratio of the stretched or compressed first layer is the same as the aspect ratio of the terminal display screen, wherein the first layer is one or more layers in which part or all of the element images of the at least two layers are blocked; According to the anchor point set, reorganize the second layer and the stretched or compressed first layer to obtain a second image, wherein the second image matches the size of the terminal display screen when displayed on the terminal; wherein the second layer is one or more layers in which element images of the at least two layers are not blocked; The arbitrary two layers include a third layer and a fourth layer, and configuring anchor points for any two layers of the at least two layers includes: determining a distance between the third layer and the fourth layer; When the distance between the third layer and the fourth layer is equal to 0, anchor points are configured for the third layer and the fourth layer according to the positional relationship between the third layer and the fourth layer; or, when the distance between the third layer and the fourth layer satisfies a first preset condition, anchor points are configured for the third layer and the fourth layer according to a first pixel pair, wherein the first pixel pair is one or more pairs of pixel points between the third layer and the fourth layer that satisfy the first preset condition, and the first preset condition is greater than 0 and less than a first threshold; or, when the distance between the third layer and the fourth layer is greater than a first threshold, a center point of the first layer and a center point of the fourth layer are determined as anchor points between the third layer and the fourth layer.

2. The method according to claim 1, characterized in that Configuring anchor points for the third layer and the fourth layer according to the positional relationship between the third layer and the fourth layer includes: In the case that the third layer contacts the fourth layer, determining the contact point between the third layer and the fourth layer as the anchor point between the third layer and the fourth layer; or, In the case where the third layer intersects with the fourth layer, determining a central point in the intersection area of ​​the third layer and the fourth layer as an anchor point between the third layer and the fourth layer; or, In the case that the third layer includes the fourth layer, a center point of the third layer is determined as an anchor point between the third layer and the fourth layer.

3. The method according to claim 1 or 2, characterized in that Configuring anchor points for the third layer and the fourth layer according to the first pixel pair includes: In the case where the first pixel pair is a pair of pixel points, determining the center point of the pair of pixel points as an anchor point between the third layer and the fourth layer; or When the first pixel pair is a plurality of pairs of pixel points, and the distance between each pair of pixel points in the plurality of pairs of pixel points is different, determine the center point of a pair of pixel points with the smallest distance among the plurality of pairs of pixel points as the anchor point between the third layer and the fourth layer; or When the first pixel pair is a plurality of pairs of pixel points, and the distance between each pair of pixel points in the plurality of pairs of pixel points is the same, the center point of the plurality of pairs of pixel points is determined as the anchor point between the third layer and the fourth layer.

4. The method according to claim 1 or 2, characterized in that: According to the anchor point set, reorganizing the stretched or compressed first layer and the second layer to obtain a second image includes: recombining the stretched or compressed first layer and the second layer according to the anchor point set to obtain a recombined first image, wherein the aspect ratio of the recombined first image is the same as the aspect ratio of the terminal display screen; The reorganized first picture is reduced or enlarged in proportion according to the size of the terminal display screen to obtain the second picture.

5. The method according to claim 1 or 2, characterized in that: The method further comprises: Determine a croppable area of ​​the first image, where the croppable area is an area of ​​the first image excluding a minimum circumscribed horizontal rectangle, where the minimum circumscribed horizontal rectangle is a minimum horizontal rectangle including the second layer; Determining a first cropping area according to the size of the terminal display screen, where the first cropping area is a minimum area that needs to be cropped so that the aspect ratio of the cropped first image is the same as the aspect ratio of the terminal display screen; It is determined that the first cropping area is outside a croppable area of ​​the first picture.

6. A picture processing device, characterized in that: include: An acquiring unit, configured to acquire a first picture, wherein the first picture includes at least two layers, the first picture is used to be displayed on a terminal, and a size of the first picture does not match a size of a display screen of the terminal; a configuration unit, configured to configure anchor points for any two layers of the at least two layers to obtain an anchor point set, wherein the anchor points are used to determine a relative position between the any two layers; a stretching unit, configured to stretch or compress the first layer according to the size of the terminal display screen, wherein the aspect ratio of the stretched or compressed first layer is the same as the aspect ratio of the terminal display screen, wherein the first layer is one or more layers in which part or all of the element images of the at least two layers are blocked; a reorganization unit, configured to reorganize the second layer and the stretched or compressed first layer according to the anchor point set to obtain a second image, wherein the second image matches the size of the terminal display screen when displayed on the terminal; wherein the second layer is one or more layers in which element images of the at least two layers are not blocked; The arbitrary two layers include a third layer and a fourth layer, and the configuration unit is further used to determine the distance between the third layer and the fourth layer; The configuration unit is further used to configure anchor points for the third layer and the fourth layer according to the positional relationship between the third layer and the fourth layer when the distance between the third layer and the fourth layer is equal to 0; or, when the distance between the third layer and the fourth layer meets a first preset condition, configure anchor points for the third layer and the fourth layer according to a first pixel pair, wherein the first pixel pair is one or more pairs of pixel points between the third layer and the fourth layer that meet the first preset condition, and the first preset condition is greater than 0 and less than a first threshold; or, when the distance between the third layer and the fourth layer is greater than the first threshold, determine the center point of the first layer and the center point of the fourth layer as the anchor points between the third layer and the fourth layer.

7. The device according to claim 6, characterized in that The configuration unit is specifically used for: In the case where the third layer contacts the fourth layer, determining a contact point between the third layer and the fourth layer as an anchor point between the third layer and the fourth layer; or, When the third layer intersects with the fourth layer, determine a center point in the intersection area between the third layer and the fourth layer as an anchor point between the third layer and the fourth layer; or, In the case that the third layer includes the fourth layer, a center point of the third layer is determined as an anchor point between the third layer and the fourth layer.

8. The device according to claim 6 or 7, characterized in that The configuration unit is specifically used for: In the case where the first pixel pair is a pair of pixel points, determining the center point of the pair of pixel points as an anchor point between the third layer and the fourth layer; or When the first pixel pair is a plurality of pairs of pixel points, and the distance between each pair of pixel points in the plurality of pairs of pixel points is different, determine the center point of a pair of pixel points with the smallest distance among the plurality of pairs of pixel points as the anchor point between the third layer and the fourth layer; or When the first pixel pair is a plurality of pairs of pixel points, and the distance between each pair of pixel points in the plurality of pairs of pixel points is the same, the center point of the plurality of pairs of pixel points is determined as the anchor point between the third layer and the fourth layer.

9. The device according to claim 6 or 7, characterized in that The recombination unit is specifically used for: recombining the stretched or compressed first layer and the second layer according to the anchor point set to obtain a recombined first image, wherein the aspect ratio of the recombined first image is the same as the aspect ratio of the terminal display screen; The reorganized first picture is reduced or enlarged in proportion according to the size of the terminal display screen to obtain the second picture.

10. The device according to claim 6 or 7, characterized in that The device further includes a determining unit, the determining unit being configured to: Determine a croppable area of ​​the first image, where the croppable area is an area of ​​the first image excluding a minimum circumscribed horizontal rectangle, where the minimum circumscribed horizontal rectangle is a minimum horizontal rectangle including the second layer; Determining a first cropping area according to the size of the terminal display screen, where the first cropping area is a minimum area that needs to be cropped so that the aspect ratio of the cropped first image is the same as the aspect ratio of the terminal display screen; It is determined that the first cropping area is outside a croppable area of ​​the first picture.

11. A picture processing device, characterized in that: The apparatus comprises at least one processor coupled to at least one memory: The at least one processor is configured to execute a computer program or instruction stored in the at least one memory, so that the apparatus performs the method according to any one of claims 1 to 5.

12. A computer-readable storage medium, characterized in that: Used to store a computer program or an instruction, which, when executed, enables the method according to any one of claims 1 to 5 to be implemented.

13. A computer program product, characterized in that When a computer reads and executes the computer program product, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Picture generation method and device, electronic device and storage medium

    CN107590848A

  • Image drawing method and device, computing equipment and storage medium

    CN109829963A