Methods, apparatus, devices and products for processing images
By using an intelligent system to identify and split image layers and generate editable image templates, the problem of low efficiency in splitting posters or collages is solved, achieving efficient and accurate layer splitting and template generation.
Patent Information
- Application Number
- CN202611510468.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-24
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, the process of splitting images such as posters or collages into layers is inefficient, requires manual operation by the user, and results in incomplete layer information, leading to complex and inaccurate splitting.
An intelligent system identifies and splits image layers, generating image templates with editable locations. Machine learning models are used to identify layer categories, order, and transparency, and to calculate slots and masks, ensuring consistency of layers and information.
It achieves automated layer splitting, generates editable image templates, improves splitting efficiency, ensures accurate position calculation and natural masking, and maintains the original design effect.
Smart Images

Figure CN123118355A_ABST
Abstract
Description
Technical Field
[0001] This article generally relates to the field of image processing, and more specifically to methods, apparatuses, devices, and computer program products for processing images. Background Technology
[0002] For example, images such as posters and collages can carry rich visual materials such as photos, text, stickers, and special effects, efficiently conveying visual information and improving users' information acquisition efficiency while quickly attracting their attention. Summary of the Invention
[0003] In the examples presented herein, a method, apparatus, electronic device, and computer program product for processing images are provided.
[0004] In a first aspect of this document, a method for processing an image is provided. The method may include obtaining a first layer and first information based on a first image, the first layer comprising at least a portion of the content of the first image, and the first information associated with the first layer. The method may also include obtaining a first image template based on the first layer and the first information, wherein the first image template includes an editable first position.
[0005] In a second aspect of this document, an electronic apparatus for processing images is provided. The apparatus includes a first obtaining module configured to obtain a first layer and first information based on a first image, the first layer including at least a portion of the content of the first image, and the first information associated with the first layer. The apparatus also includes a second obtaining module configured to obtain a first image template based on the first layer and the first information, the first image template including an editable first position.
[0006] In a third aspect of this document, an electronic device is provided. The electronic device includes a processor. The electronic device also includes a memory coupled to the processor, the memory having instructions stored therein, which, when executed by the processor, cause the electronic device to perform the method according to the first aspect of this document.
[0007] In a fourth aspect of this document, a computer program product is provided, comprising computer-executable instructions, wherein the computer-executable instructions are executed by a processor to implement the method according to the first aspect of this document.
[0008] In a fifth aspect of this document, a computer-readable storage medium is provided. The computer-readable storage medium stores computer-executable instructions, which are executed by a processor to implement the method according to the first aspect.
[0009] The summary section is intended to present the chosen concepts in a simplified form, which will be further described in the detailed description below. The summary section is not intended to identify key or principal features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. Attached Figure Description
[0010] The above and other features, advantages, and aspects of the examples herein will become more apparent when taken in conjunction with the accompanying drawings and the following detailed description. In the accompanying drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0011] Figure 1 A schematic diagram is shown illustrating an example environment in which one or more examples in this article can be implemented;
[0012] Figure 2 Flowcharts illustrating some of the methods used in this paper for processing images are shown;
[0013] Figure 3 A flowchart illustrating a method for processing an image according to one or more examples in this document is shown;
[0014] Figure 4 This shows a schematic diagram of an example of a first region and a second region based on one or more examples in this article;
[0015] Figures 5A to 5D This illustrates a schematic diagram of an example process for processing an image according to one or more examples in this article;
[0016] Figures 6A to 6C This illustrates an example of generating an image using an image template based on one or more examples in this article;
[0017] Figure 7 A block diagram of an electronic device for processing images, according to some examples in this paper, is shown;
[0018] Figure 8 A block diagram of a device capable of implementing several of the examples in this paper is shown;
[0019] In all the accompanying drawings, the same or similar reference numerals indicate the same or similar elements. Detailed Implementation
[0020] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0021] It is understandable that before using the technical solutions disclosed in the examples in this article, users should be informed of the type, scope of use, and use scenarios of the relevant information involved in this article in an appropriate manner in accordance with relevant laws and regulations, and their authorization should be obtained.
[0022] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's relevant information. This allows the user to autonomously choose, based on the prompt message, whether to provide relevant information to the software or hardware such as the electronic device, application program, server, or storage medium performing the operations described herein.
[0023] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide relevant information to the electronic device.
[0024] It is understood that the above notification and user authorization process is merely illustrative and does not limit the implementation method described in this article. Other methods that comply with relevant laws and regulations may also be applied to the implementation method described in this article.
[0025] The examples herein will now be described in more detail with reference to the accompanying drawings. While some examples of this document are shown in the drawings, it should be understood that this document can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these examples are provided to provide a more thorough and complete understanding of this document. It should be understood that the accompanying drawings and examples are for illustrative purposes only and are not intended to limit the scope of this document.
[0026] In the description of the examples in this document, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The terms "some examples" or "the example" should be understood as "at least some examples". The terms "first", "second", etc., may refer to different or the same objects unless explicitly stated otherwise. Other explicit and implicit definitions may also be included below.
[0027] In one context, an intelligent system is an information processing system. This intelligent system uses at least one or more models to process one or more inputs. The intelligent system may include the one or more models as components, or it may use models external to the system for processing. Those skilled in the art will recognize that there are various implementations of intelligent systems in the industry, including but not limited to agents, artificial intelligence assistants, artificial intelligence workers, copilot systems, and chatbots. The inputs include data in one or more modalities. The modal data includes, but is not limited to, text, audio, images, video, application-specific data, or scientific computing data. The models include, but are not limited to, one or more combinations of the following: large-scale parametric models, deep learning models, neural network models, machine learning models, statistical models, rule-based models, or other models capable of processing the inputs. The specific implementation of the models can employ various existing or improved models. The intelligent system may involve one or more of the following operations: receiving single-round or multi-round input; recognizing and / or understanding the input; generating answers, decisions, or processing results using one or more models; invoking one or more external tools, interfaces, knowledge bases, or other systems to obtain information or perform operations; processing in a self-decision-making or human-machine collaborative manner, or transferring tasks to human or other systems for processing. Self-decision-making refers to execution without human intervention. Human-machine collaboration refers to partial human participation or confirmation. The above explanation of "intelligent system" is illustrative, and each description is an example, not necessarily necessary, and does not constitute an exhaustive list.
[0028] As mentioned above, posters and collages can carry rich visual materials such as photos, text, stickers, and special effects, efficiently conveying visual information and quickly attracting users' attention while improving their information acquisition efficiency. However, posters or collages usually only retain a composite flat image and no longer carry information such as layers, order, text, slots, and masks. When users need to replace images or modify text, they usually have to manually split the layers and adjust them one by one, which is inefficient.
[0029] Therefore, to address at least one of the above problems, one or more examples of this paper provide a mechanism that simplifies the process of splitting image layers to obtain an editable image template. Specifically, one or more examples of this paper can obtain a first layer and first information based on a first image, the first layer comprising at least a portion of the content of the first image, and the first information associated with the first layer. Furthermore, one or more examples of this paper can also obtain a first image template based on the first layer and the first information, wherein the first image template includes an editable first position. In this way, one or more examples of this paper provide a mechanism for processing images, and based on this mechanism, simplify the process of splitting image layers to obtain an editable image template.
[0030] Figure 1 A schematic diagram of an example environment 100 in which one or more examples of this article can be implemented is shown. For example... Figure 1 As shown, environment 100 includes processing device 102. Processing device 102 can be any device with processing capabilities. For example, processing device 102 can include smartphones, tablets, laptops, desktop computers, workstations, servers, cloud computing platforms, quantum computers, or smart wearable devices. In environment 100, processing device 102 can run image processing applications, which can be used to manage various image processing functions (such as image splitting, template generation, image replacement, etc.). In some examples, terminal devices can run image processing applications and can communicate with processing device 102. Users can interact with the image processing application through the terminal device, and the terminal device can then send and receive information associated with the server based on the user's interaction to realize various image processing functions.
[0031] In some examples, processing device 102 may receive a first image 104. The first image 104 may include a composite planar image (e.g., a poster, collage, etc.), a user-uploaded image, and an image retrieved from a server. Processing device 102 may process the first image 104 to obtain a first layer 106 and first information 108. The first layer 106 includes at least a portion of the content of the first image 104. For example, both the first image 104 and the first layer 106 may include content 110. Content 110 may include photographs, text, or materials (e.g., stickers, doodles, or emojis). In some examples, the first information 108 is associated with the first layer 106. For example, the first information 108 may include information associated with the first layer 106, such as layer identifier, layer order, layer type, layer description, whether the first layer 106 is replaceable, and whether the first layer 106 is keyed out. In some examples, processing device 102 may obtain a first image template 112 based on the first layer 106 and the first information 108. The first image template 112 may include an editable first position 114. For example, the editable first position 114 may be an area where the user can replace the image or modify the text.
[0032] It should be understood that, for the sake of brevity, Figure 1 Only a specific number of processing devices 102, first image 104, first layer 106, first information 108, content, first image template 112, etc., are shown in this document, but it is not intended to limit the number of these elements. In other implementations, any number applicable to this document may be used.
[0033] In this way, the environment 100 of the processing device 102 containing one or more example implementations of this article provides a mechanism for processing images and, based on this mechanism, simplifies the operation of splitting image layers to obtain editable image templates.
[0034] The following will combine Figures 2 to 7 The process described in detail is based on the examples in this document. For ease of understanding, the specific data mentioned in the following description are exemplary and are not intended to limit the scope of protection of this document. It should be understood that the examples described below may also include additional actions not shown and / or the actions shown may be omitted, and the scope of this document is not limited in this respect.
[0035] Figure 2 A flowchart illustrating a method 200 for processing images, as shown in this paper, is provided. Method 200 can be executed by a processing device. For example, method 200 can be performed by… Figure 1 The processing device 102 performs the operation. The processing device may include, for example, a smartphone, tablet computer, laptop computer, desktop computer, workstation, quantum computer, cloud computing platform, or smart wearable device.
[0036] In step 202, based on the first image, a first layer and first information are obtained. The first layer includes at least a portion of the content of the first image, and the first information is associated with the first layer. In some examples, the first image may be a planar template image, such as a composite image from a poster, collage, etc., containing only the composite pixel information and not carrying structured information such as layers, order, text, slots, and masks. By processing the first image, multiple layers can be identified and separated from it. The first layer may be one of these multiple layers, including at least a portion of the content of the first image.
[0037] In some examples, method 200 may also obtain a first layer and first information based on an intelligent system (e.g., an agent) and a first image. The intelligent system may, for example, include a machine learning model for image understanding and layer splitting. The intelligent system can identify the first image, generate layer categories, orders, and descriptions, and output corresponding transparent layers. The system can sequentially map layer descriptions to images one-to-one and verify the consistency of the number of layers. If the number is inconsistent, processing stops. The first layer may include at least one of a background layer, a text layer, a source layer, or a photo layer. The background layer may serve as the canvas background and may not generate a separate visible layer. In some examples, there may be one background layer. In the absence of a background layer, the size of the first-order photo layer can be used as the canvas. The photo layer can serve as an alternative photo layer for use with intelligent keying or manual masking. Intelligent keying refers to automatically identifying the subject area in the image through the intelligent system, separating targets such as people and objects from the original background, removing the original background image, and preserving the subject outline. Source layers (e.g., sticker layers) may use ordinary rectangular slots. When the source layer is located below the topmost photo, it can participate in the restoration of the mask background. Text layers can be preserved as images or converted to editable text. In this way, the first image is broken down into structured layers and corresponding information.
[0038] In some examples, method 200 can also obtain multiple layers and multiple pieces of information based on the first image, where the multiple layers include the first layer, the multiple pieces of information include the first information, and the multiple pieces of information also include the order of the multiple layers. The multiple layers and multiple pieces of information are then matched. In response to successful matching of the multiple layers and multiple pieces of information one by one, the multiple layers are arranged according to the order of the multiple layers to obtain a template of the first image. For example, the intelligent system can simultaneously generate multiple layer descriptions (e.g., including the first information) and multiple layers (e.g., including the first layer), and then match the layer descriptions with the layers one by one in sequence. If the number of multiple layer descriptions and multiple layers is different, processing stops. In this way, the consistency of layers and information can be ensured, thereby accurately restoring the layer structure of the original image.
[0039] Back Figure 2 In step 204, based on the first layer and the first information, a first image template is obtained, which includes an editable first position. In some examples, the layer structure can be organized based on the first layer and the first information, slots (also referred to herein as second regions) and masks (also referred to herein as first masks) can be calculated, and the first image template can be obtained. The first image template may include an editable first position that indicates to the user that the slots for replacing images or modifying text.
[0040] In some examples, method 200 may further include obtaining a first region based on the transparency of a first layer, wherein the transparency of the first region satisfies a first threshold; and obtaining a second region based on the first region, wherein the second region covers the first region, and the second region includes an editable first position. For example, for transparent images of the same size as the canvas (i.e., the background layer of the first image), such as photo layers, material layers, and image text, the intelligent system can scan the first layer and treat pixels with transparency greater than the first threshold as valid content. The first region is the area containing this valid content. The intelligent system can also record the leftmost and rightmost boundary points of each row in the first region. Based on the leftmost and rightmost boundary points of each row in the first region, a second region (also referred to as a slot in this document) that can cover the first region can be determined. In some examples, the intelligent system can use the rectangle with the smallest area that can cover the first region as the second region. The second region includes an editable first position. The editable first position refers to the content located in the second region that can be replaced based on the first position. In this way, the location and range of valid content can be accurately identified from the transparent layer, and the location and range of replaceable regions can be determined, allowing the user to replace image or text content in that region.
[0041] In some examples, method 200 may further include obtaining a first rectangular region based on a first region, wherein the edges of the first rectangular region are parallel to the edges of the first layer and the first rectangular region covers the first region; and obtaining a second region based on the first rectangular region. For example, the first rectangular region is the smallest bounding rectangle of the first region aligned to its axis, and the edges of the first rectangular region are parallel to the edges of the first layer and completely cover the first region. The parallelism of the edges of the first rectangular region to the edges of the first layer means that the outline of the first rectangular region is not rotated relative to the outline of the first layer. In some examples, the first rectangular region (also referred to herein as a regular rectangular slot) can be directly used as the second region. This approach provides a simple and efficient way to determine the range of replaceable regions.
[0042] In some examples, method 200 may also include obtaining a third region based on a first region, obtaining a second rectangular region based on the third region, and obtaining the second region based on the first and second rectangular regions (also referred to herein as rotated rectangular slots). The third region is a convex region surrounding the first region, the second rectangular region covers the first region, and at least one edge of the second rectangular region is not parallel to an edge of the first layer. For example, the system can generate a convex hull using the boundary points of the first region, i.e., the outermost contour that encloses the valid content, and the third region is this convex hull. At least one edge of the second rectangular region is not parallel to an edge of the first layer, meaning that the contour of the second rectangular region is rotated relative to the contour of the first layer. For example, the second rectangular region is the smallest area of the rotated bounding rectangle, and the intelligent system can find the smallest area of the bounding rectangle of the convex hull along its outer contour to obtain the second rectangular region. In this way, for layers containing rotated valid content, rotated rectangular slots that fit the valid content more closely can be calculated, reducing transparent blank areas.
[0043] In some examples, method 200 may further include obtaining a first value based on a first rectangular region, a second rectangular region, and a first layer; obtaining a second value based on the second rectangular region and the first region; and, in response to the first value satisfying a second threshold and the second value satisfying a third threshold, designating the second rectangular region as the second region. The first value indicates the difference in the proportion of the first and second rectangular regions within the first layer. For example, the first value indicates an area reduction rate. For example, the first value can compare the difference in the area occupied by the first and second rectangular regions within the canvas of the first layer. For example, the first difference can be obtained based on the difference between the areas of the first and second rectangular regions. Then, the first value is obtained based on the proportion of the first difference in the area of the first rectangular region. Specifically, the area can be determined by the number of pixels. For example, the first difference can be obtained based on the difference between the number of pixels in the first and second rectangular regions. Then, the proportion of the first difference in the number of pixels in the first rectangular region is determined to determine the first value. The second value indicates the proportion of the number of pixels occupied by the first pixel in the second rectangular region, where the first pixel indicates the number of pixels overlapping between the second region and the second rectangular region. For example, the second value is the rectangle proportion, representing the degree to which the effective area fills the second rectangular region. The second value can be a ratio. In some examples, the closer the second value is to 1, the closer the outline of the second rectangular region is to the outline of the effective region. In some examples, the second rectangular region is used as the second region only if the first value meets the second threshold and the second value meets the third threshold simultaneously.
[0044] In some examples, if the rotation angle of the second rectangular area relative to the first layer does not meet the requirements of the terminal device, the width and height of the second rectangular area can be swapped, and the second rectangular area can be rotated 90°. If it still does not meet the requirements, the first rectangular area is used as the second area. In this way, the reliability of the second rectangular area can be ensured, and unreasonable rotation can be avoided, which would degrade the display effect of the image template.
[0045] In some examples, method 200 may further include obtaining a first proportion and a second proportion based on the first rectangular region and the second rectangular region, and obtaining a first value based on the first proportion and the second proportion. The first proportion indicates the percentage of the number of second pixels in the first layer, and the second pixel count indicates the number of pixels overlapping between the first rectangular region and the first layer. For example, the first proportion could be the percentage of the first rectangular region in the first layer. The second proportion indicates the percentage of the number of third pixels in the first layer, and the third pixel count indicates the number of pixels overlapping between the second rectangular region and the first layer. For example, the second proportion could be the percentage of the second rectangular region in the first layer. For example, the first value could be the difference between the first proportion and the second proportion. In this way, the area difference between the first rectangular region and the second rectangular region in the first layer can be quantified, thereby providing a basis for determining whether to use the second rectangular region.
[0046] In some examples, method 200 may also include obtaining a second region based on the transparency of a first layer, obtaining first coordinates and a first scale based on the second region, and obtaining an editable first position based on the first coordinates. The second region includes the editable first position. For example, the intelligent system can scan the transparency distribution of the canvas, identify pixels with transparency greater than a first threshold as valid content, and then determine a second region covering the valid content. The specific method for determining the second region based on the transparency of the first layer is described above. The first coordinate indicates the center position of the second region, and the first scale indicates the size ratio of the second region to the first layer. For example, the first coordinate could be the normalized center position of the second region. The normalization method includes setting the center of the first layer as (0,0), the horizontal dimension of the first layer from left to right as -1 to 1, and the vertical dimension of the first layer from top to bottom as 1 to -1. The first scale can be a scaling value of the second region. For example, the ratio of the width of the second region to the width of the first layer and the ratio of the height of the second region to the height of the first layer are calculated respectively, and the larger of these two ratios is taken as the first scale. The first position is associated with the first scale. For example, when a user fills a second area of a first image template with source material, the terminal device will scale the source material based on a first ratio and display the scaled material at a first position in the first image template. In this way, the client can accurately locate and scale the editable area based on the first coordinates and the first ratio during rendering.
[0047] In some examples, method 200 may further include obtaining a second image in response to a first operation, based on the first media content, a first scale, and a first position. The first operation is associated with the first media content and the first image template. For example, a user may select a new picture, photograph, or enter new text as the first media content, and the system may scale the first media content according to a first scale and place it at a first position to generate the second image. At least a portion of the first media content is displayed in a second region of the second image. When replacing the image, only the image is replaced, and it is centered and cropped according to its original slot. The position, size, rotation angle, mask, and keying settings of the second region remain unchanged, so replacing a portion of the content in the first image template does not alter the layout. In this way, users can easily replace the image or text content in the image template to reuse the image template to generate new images.
[0048] In some examples, method 200 may also include obtaining multiple layers based on a first image. These layers are then overlaid to obtain a third image. A first mask is obtained based on the transparency of the third image. A first image template is obtained based on the first mask, the first layer, and first information. The multiple layers include the first layer. The first mask indicates the extent of the visible area of valid content within the photo layer. For example, the system can first reconstruct the image below the photo: duplicate the background layer, place the material layers and image text below the highest photo layer back into their corresponding slots, and then overlay them in layer order to obtain the third image. Layers above the photo layer are not involved. When there are no other layers below the photo layer, the background layer is used directly. The first mask includes a fourth region where the transparency of the first mask is less than a set transparency. The fourth region can indicate the visible area of valid content. For example, when there is a background image and the photo is not keyed using a smart system, the system generates a mask (i.e., the first mask). The mask is always generated based on the transparency of the original full-canvas photo layer, without using cropping or overwriting images, and therefore is not affected by rotation of the second region. The fourth region is the area covered by the photo. The transparency of the first mask in the fourth region is less than the set transparency, indicating that this region is visible in the photo. In this way, masks can be generated for irregularly shaped photos without intelligent keying systems, making the edges between the photo and the background more natural, thus maintaining the original design effect.
[0049] In some examples, method 200 may further include determining a fourth region based on the transparency of a third image, adjusting the transparency of a first pixel, defining the outline of the first pixel within the fourth region, and obtaining a first mask based on the fourth region. For example, pixels with transparency greater than a first threshold can be considered as photo regions (i.e., the fourth region). In some examples, denoising may be performed before generating the first mask. For example, for each pixel in the third image, a 3×3 pixel range around that pixel is examined, and the pixel is retained only if at least 5 pixels belong to the valid region. If smaller second regions are therefore entirely removed, the process reverts to the original outline. In some examples, the fourth region is softened during the generation of the first mask. For example, a 3×3 Gaussian calculation is performed on the outline of the fourth region, and only the transparency of pixels within the outline of the fourth region is adjusted, without blurring the colors. For example, the more pixels around a pixel that belong to the photo region, the more transparent that pixel becomes. The first mask can be determined based on the adjusted fourth region and the third image. In this way, noise and jagged edges are removed while maintaining natural edges during the determination of the first mask.
[0050] In some examples, method 200 may also include obtaining a second region based on the intelligent system and the transparency of the first layer. The second region includes an editable first position, and its outline changes based on a first input associated with the intelligent system. For example, the first input could be a replacement layer (second layer) processed by the intelligent system. The replacement layer can be obtained by the intelligent system extracting content from a user-provided image. In some examples, the outline of the second region can vary based on the outline of valid content in the replacement layer. That is, the outline of the content displayed within the second region is variable. For example, after the user replaces an image in an image template, an image containing content with different outlines can be generated. In some examples, the outline of the second region is irregular. Irregularity means that the outline of the second region does not belong to common shapes (e.g., rectangles, circles, ellipses, triangles, or other shapes). The outline of the content displayed at the corresponding position in the second region of an image generated using an image template can also be irregular. This provides users with more creative options and enhances their creative experience.
[0051] In some examples, method 200 may also include, in response to an operation on an editable first position, receiving a fourth image, the fourth image including first content, the first content having an irregular outline; extracting the first content from the fourth image based on an intelligent system to obtain a second layer, the second layer including the first content; and obtaining a fifth image based on the second layer and the first image template, displaying the first content at the first position in the fifth image. In this way, content with irregular outlines can be inserted into the image template, rather than only displaying image content with fixed shapes, thus increasing the richness of user creation and improving the user's creative experience.
[0052] In summary, one or more examples of Method 200 address several technical issues in this manner. For instance, one or more examples of Method 200 resolve the problem that floor plans no longer carry layer information, which necessitates manual layer splitting and debugging by the user, resulting in complex operations and low efficiency. One or more examples of Method 200 automatically obtain the first layer and first information based on the first image, and then obtain a first image template containing an editable first position based on the first layer and first information.
[0053] Furthermore, one or more examples of Method 200 address the issue of inaccurate position calculations for editable regions. For instance, a regular rectangular slot might contain too much transparent area, making it impossible to fit valid content. One or more examples of Method 200 combine metrics such as the second rectangular region, the minimum bounding rectangle, the first value, and the second value to accurately determine whether to use the second rectangular region, and revert to the first rectangular region if the result is unreliable.
[0054] In addition, one or more examples of Method 200 also address the problem of unnatural mask edges; for example, determining the fourth region solely based on its original transparency leaves noise and jagged edges. One or more examples of Method 200 employ a two-step process: first denoising and then smoothing the edges, thus removing noise and jagged edges while maintaining the natural edges of the fourth region.
[0055] Furthermore, one or more examples of Method 200 also address the problem of layer and information mismatch, such as inconsistencies between the layer descriptions and the number of images generated by the intelligent system. One or more examples of Method 200 sequentially map layer descriptions to images one by one and verify the number, generating image templates only during this one-to-one matching process, thus ensuring consistency between layers and information.
[0056] By addressing the above issues, one or more examples of Method 200 implement an end-to-end approach that automatically reconstructs layers and replaceable regions from a planar image and generates an image template containing editable locations. This approach ensures that layer splitting, slot calculation, mask generation, and template assembly are not mutually exclusive, enabling users to quickly replace content based on the generated image template while maintaining the original design effect, thus achieving significant technical results.
[0057] To help those skilled in the art better understand the implementation of the overall method presented in this paper, Figures 3 to 5D A flowchart and a schematic diagram of an image processing method according to one or more examples herein are shown. Figure 3 A flowchart of a method 300 for processing an image is shown according to one or more examples herein. Figure 4 This illustrates a schematic diagram of Example 400, which includes a first region and a second region according to one or more examples in this document. Figures 5A to 5D This illustrates a schematic diagram of an example process 500 for processing an image according to one or more examples in this document.
[0058] It is important to note that the detailed methodologies described below are merely examples and not intended to limit the scope of this document. Any methodologies and their variations suitable for this document should be within its scope. Furthermore, the specific steps involved are also merely examples and not intended to limit the scope of this document. Any specific steps or combinations of specific steps suitable for this document should be within its scope.
[0059] like Figure 3 As shown, method 300 illustrates an end-to-end processing chain from a planar image (e.g., a first image) to a publishable layer template (e.g., a first image template). The intelligent system can break down the entire processing chain into multiple asynchronous tasks. Upon receiving a request, the entry point returns a task identifier; each node sequentially reads the result of the previous step and writes back the same task data corresponding to the task identifier. For example... Figure 3 As shown, method 300 may include the following steps. At 302, a first image may be input. For example, the system may receive a planar image as input, corresponding to step 202 of method 200, which involves acquiring the first image.
[0060] In 304, multiple layers and multiple pieces of information can be identified. For example, the intelligent system can identify and separate multiple layers, then organize them into structured layers and corresponding information. In some examples, the model simultaneously generates multiple layer descriptions and multiple titles, and then outputs multiple transparent layers. The intelligent system sequentially matches the multiple layer descriptions with multiple images one by one. In some examples, the processing device can stop the current processing in response to a difference in the number of multiple layers and multiple layer descriptions. In some examples, method 300 may also include enhancement processing. For example, super-resolution processing of multiple layers. In some examples, the enhancement processing is completed if the super-resolution results of multiple layers are all successful and the number is consistent; otherwise, multiple layers revert to their original state. In this way, layer effects can be enhanced while maintaining quality. In some examples, text in an image can be recognized. If recognition is successful and the font matches a preset font, the text is converted to editable text; otherwise, the text is retained as an image.
[0061] At 306, normalized first information can be constructed. For example, the scaling factor (e.g., first scale) and normalized center position (e.g., first coordinates) of the slot (e.g., second region) can be calculated based on the transparency of the first layer. In some examples, the center of the layer (e.g., including the first layer) can be denoted as (0,0), with horizontal coordinates from -1 to 1 from left to right and vertical coordinates from 1 to -1 from top to bottom, thus obtaining the normalized first coordinates.
[0062] At 308, the slot area and mask can be determined. For example, the effective content area can be determined based on the transparency of the first layer, and a regular rectangular slot or a rotated rectangular slot can be calculated. Specific details will be provided below. Figure 4 Detailed Description. In some examples, masks can be generated for irregularly shaped photos. For example, multiple layers can be obtained based on a first image. These layers are then overlaid to obtain a third image. Based on the transparency of the third image, a first mask is obtained. Based on the first mask, the first layer, and the first information, a first image template is obtained. The multiple layers include the first layer. The first mask indicates the extent of the visible area of valid content within the photo layer. For example, the system can first reconstruct the image below the photo: duplicate the background layer, place the material layers and image text below the highest photo layer back into their corresponding slots, and then overlay them in layer order to obtain the third image. Layers above the photo layer are not involved. When there are no other layers below the photo layer, the background layer is used directly. The first mask includes a fourth region where the transparency of the first mask is less than the set transparency. The fourth region can indicate the visible area of valid content. For example, when there is a background image and the photo is not keyed using a smart system, the system generates a mask. The mask is always generated based on the transparency of the original full-canvas photo layer, without using cropped or rewritten images, and therefore is not affected by the rotation of the second region. The fourth region is the area covered by the photo. The transparency of the first mask in the fourth region is less than the set transparency, indicating that this region is visible in the photo. In this way, masks can be generated for irregularly shaped photos without intelligent keying systems, making the edges between the photo and the background more natural, thus maintaining the original design effect.
[0063] In some examples, the processing device can also determine a fourth region based on the transparency of a third image, adjust the transparency of a first pixel, the outline of the first pixel within the fourth region, and obtain a first mask based on the fourth region. For example, pixels with transparency greater than a first threshold can be considered as photo regions (i.e., the fourth region). In some examples, denoising can be performed before generating the first mask. For example, for each pixel in the third image, a 3×3 pixel range around that pixel is examined, and the pixel is retained only if at least 5 pixels belong to the valid region. If smaller second regions are therefore completely removed, the process reverts to the original outline. In some examples, the fourth region is softened during the generation of the first mask. For example, a 3×3 Gaussian calculation is performed on the outline of the fourth region, and only the transparency of pixels within the outline of the fourth region is adjusted, without blurring the colors. For example, the more pixels around a pixel that belong to the photo region, the more transparent that pixel becomes. The first mask can be determined based on the adjusted fourth region and the third image. In this way, noise and jagged edges are removed while maintaining natural edges during the determination of the first mask.
[0064] In version 310, image template drafts can be created. For example, a draft can be generated based on layers, information, slots, and masks. When generating the draft, for photo layers using rotated slots, the intelligent system can first rotate the original image in reverse and crop it into a local image that is upright (e.g., so that the edges of the second region are parallel to the edges of the layer canvas), and then write the original rotation angle into the draft. This way, only one rotation is needed during client-side rendering, which restores the orientation and avoids introducing unnecessary transparent corners.
[0065] In section 312, a preview is possible. For example, preview images can be generated in parallel based on the draft, allowing users to view the template effect. In section 314, template conversion and packaging are possible. For example, the draft can be converted into a compressed image template package for loading and use on the client (e.g., a terminal device). In section 316, quality verification is possible. For example, the generated image template can be quality verified to check its quality. Specifically, quality verification may include checking the number of layers, the reasonableness of the position and size of the slot areas, the edge effect of the mask, and the visual effect after template rendering. In this way, substandard results can be filtered out before the image template is saved, thereby ensuring the reliability of the final released image template.
[0066] Go to Figure 4 , Figure 4 The diagram includes three sub-figures (A), (B), and (C), which respectively illustrate examples of ordinary rectangular slots when valid content is not rotated from a transparent layer, examples of rotated rectangular slots when valid content is rotated, and examples of ordinary rectangular slots when valid content is rotated.
[0067] As shown in sub-figure (A), for transparent images of the same size as the first image, such as photo layers, material layers, or text layers, the intelligent system can scan the canvas and identify pixels with transparency greater than a first threshold as valid content (e.g., areas with fill). In some examples, the area containing the valid content is the first region 402. The transparency of the pixels in the first region 402 satisfies the first threshold. In some examples, based on the first region 402, a first rectangular region 404 can be obtained, with its edges parallel to the edges of the first layer, and the first rectangular region 404 covering the first region 402. In some examples, if the first region 402 is not rotated, a regular rectangular slot that can encompass the first region 402 (e.g., the first rectangular region 404) can be directly used as the slot. For example, the intelligent system can record the leftmost and rightmost boundary points of each row of the first region 402, and obtain the first rectangular region 404 based on these boundary points, using the first rectangular region 404 as the second region.
[0068] In some examples, the first rectangular region 404 is the smallest bounding rectangle aligned to the axis. For example, the first rectangular region 404 can be determined by iterating through rectangles that can cover the first region 402 and identifying the rectangle with the smallest area. Based on the first rectangular region 404, a second region can be obtained that covers the first region and includes an editable first position.
[0069] As shown in sub-figure (B), for a photo layer, a rotating rectangular slot can be determined. For example, if the first region 406 is rotated, a rotating rectangular slot covering the first region 406 can be determined (e.g., a second rectangular region 408). For example, the system can generate a convex hull based on the boundary points of the first region 406. The convex hull can be the outermost contour that can enclose the first region 406. In some examples, the boundary points of the first region 406 can be sorted and deduplicated before constructing the convex hull. Based on the convex hull, a third region can be determined, which is a convex region that encloses the first region 406. Based on the third region, a second rectangular region 408 can be obtained, which covers the first region 406, and at least one edge of the second rectangular region 408 is not parallel to the edge of the first layer. In some examples, the second rectangular region can be the rotating bounding rectangle with the smallest area. In some examples, when multiple rotating bounding rectangles have the same area, a rotating bounding rectangle closer to the angle threshold can be selected as the second rectangular region to avoid obtaining different angles for the same image each time.
[0070] In some examples, the second region can be determined based on the first and second rectangular regions. For example, the area reduction rate (e.g., a first value) and the rectangle proportion (e.g., a second value) can be determined based on the first and second rectangular regions. For the first region 406, as shown in subfigure (B), if the area reduction rate meets the second threshold and the rectangle proportion meets the third threshold, the second rectangular region 408 can be used as the second region. As shown in subfigure (C), if the area reduction rate does not meet the second threshold or the rectangle proportion does not meet the third threshold, the first rectangular region 410 can be used as the second region. In some examples, when determining the convex hull of the first region, if there are insufficient boundary points, all points are collinear, or the area is zero, a regular rectangular slot can be directly used as the second region.
[0071] In some examples, the area reduction rate indicates the difference in the proportion of the first rectangular area and the second rectangular area within the first layer. In some examples, the area reduction rate can be determined by comparing a first proportion of the number of pixels in a regular rectangular slot to the total number of pixels in the first layer, and a second proportion of the number of pixels in a rotated rectangular slot to the total number of pixels in the first layer. In other examples, a first difference can be determined between the number of pixels in a regular rectangular slot and the number of pixels in a rotated rectangular slot. The area reduction rate is then determined based on the proportion of this first difference in the number of pixels in the regular rectangular slot. In some examples, a portion of the rotated rectangular slot lies outside the canvas of the first layer. In such examples, the portion of the rotated rectangular slot outside the canvas does not belong to the pixels where the rotated rectangular slot overlaps with the first layer. The area reduction rate can be a percentage value. In some examples, the rectangle proportion indicates the proportion of pixels in the second rectangular area that overlap with the first area to the total number of pixels in the second rectangular area.
[0072] In some examples, a rotated rectangular slot can be used as a second region (i.e., a second rectangular area is used as the second region) if the following conditions are met simultaneously: the area reduction rate meets a second threshold, the rectangle proportion meets a third threshold, the first coordinate of the rotated rectangular slot is within the canvas of the first layer, the rotated rectangular slot can cover the first region, and the scaling ratio is not greater than a fourth threshold. In some examples, a scaling ratio not greater than the fourth threshold indicates that the width of the rotated rectangular slot is not greater than the width of the first layer, and the height of the rotated rectangular slot is not greater than the height of the first layer. In some examples, when determining to use a rotated rectangular slot as the second region, a 2-pixel margin is left on each of the four sides of the rotated rectangular slot.
[0073] Go to Figure 5A ,like Figure 5AAs shown, the first image 502 may include multiple photographs (e.g., photographs 504-1, 504-2, 504-3, 504-4, and 504-5, hereinafter collectively referred to as multiple photographs 504) and text 506. The processing device may receive the first image 502 uploaded by a user and, in response to a conversion request for the first image 502, perform layer splitting on the first image 502 to obtain multiple layers and multiple layer descriptions. In some examples, the multiple layer descriptions correspond to the multiple layers.
[0074] like Figure 5B As shown, the multiple layers may include a background layer 508, photo layers 510-1, 510-2, 510-3, 510-4, and 510-5 (hereinafter collectively referred to as multiple photo layers 510), and a text layer 514. Layer descriptions may include layer description 512. Layer descriptions may include information indicating the order of the layers, the position of the valid content within the layers, the layer category, whether the layers are editable, and whether the valid content within the layers is rotated. In some examples, the multiple photo layers 510 and text layer 514 may be transparent layers that include a portion of the content of the first image 502. For example, photo layer 510-1 may include photo 504-1, and the filled portion in photo layer 510-1 indicates a transparent area. As another example, photo layer 510-4 may include photo 504-4. As yet another example, text layer 514 may include text 506. In some examples, the multiple photos in the multiple photo layers 510 are located in defined slots. For example, in photo layer 510-2, photo 504-2 is displayed in slot 516. In some examples, slot 516 may be determined based on the transparency of photo layer 510-2.
[0075] like Figure 5C As shown, the processing device can rewrite multiple photos 504 in multiple photo layers 510 and output multiple photos 504 included in the multiple photo layers 510. For example, the processing device can output photo 504-1 in photo layer 510-1. As another example, the processing device can output photo 504-2 in photo layer 510-2. Figure 5D As shown, the processing device can arrange multiple layers sequentially based on multiple layer descriptions to obtain an image template 518. In some examples, the processing device can output a cover image of the image template 518 as a preview image. In some examples, the processing device can display a replacement image in slot 516 of the image template in response to an operation to replace an image in slot 516. In some examples, the processing device can display a replacement image in slot 516 of the image template based on the center coordinates and scaling of slot 516, thereby replacing a photograph in the image template.
[0076] In some examples, the processing device can be based on a text layer (e.g., such as...) Figure 5B The text layer 514 shown determines the text slots (e.g., as shown in the image). Figure 5D (See text slot 520). In some examples, the processing device may determine the text slot 520 in response to the font of text 506 matching a default font, and in response to an operation on the text slot 520 for an image template, the processing device may receive replacement text input by the user and display the replacement text in the text slot 520 based on the default font that matches the font of text 506.
[0077] In some examples, a second region can be obtained based on the intelligent system and the transparency of the first layer. This second region includes an editable first position, and its outline changes based on a first input associated with the intelligent system. For example, the first input could be a replacement layer processed by the intelligent system. The replacement layer can be obtained by the intelligent system extracting content from a user-provided image. In some examples, the outline of the second layer can vary based on the outline of the valid content in the replacement layer. That is, the outline of the content displayed within the second region is variable. For example, after the user replaces an image in an image template, images containing content with different outlines can be generated. In some examples, the outline of the second region is irregular. Irregularity means that the outline of the second region does not belong to common shapes (e.g., rectangles, circles, ellipses, triangles, or other shapes). The outline of the content displayed at the corresponding position in the second region of an image generated using an image template can also be irregular. This provides users with more creative options and enhances their creative experience.
[0078] Figures 6A to 6C A schematic diagram of example 600, which generates an image using an image template according to some examples in this article, is shown. Figure 6A and Figure 6BAs shown, the processing device can receive a replacement image uploaded by a user in response to an operation on an editable first position 604 in an image template 602. The replacement image includes first content 608 (e.g., a person, animal, object, building, or other content). The outline of the first content 608 is irregular. Irregularity means that the outline of the first content 608 does not belong to common shapes (e.g., rectangle, circle, ellipse, triangle, or other shapes). The processing device can invoke a preset system prompt to extract the first content 608 from the replacement image to obtain a replacement layer 606 (i.e., the second layer). The replacement layer 606 includes the first content 608, and the transparency of pixels in the area of the replacement layer 606 other than the first content 608 is less than a transparency threshold. That is, the replacement layer 606 is a transparent layer that includes the first content 608. In some examples, the processing device can intelligently identify the first content 608 in the replacement image, or it can determine the first content 608 in the replacement image based on the user's selection operation. For example, when the replacement image includes a subject object and a background object, the processing device can intelligently determine the subject object as the first content.
[0079] like Figure 6C As shown, the processing device can generate a fifth image based on the replacement layer 606 and the image template 602. For example, the processing device can use the replacement layer 606 to replace the layer in the image template 602 corresponding to the first position to obtain the fifth image (e.g., ...). Figure 6C (As shown). In the fifth image, the first content 608 is displayed at a first position in the fifth image, and the outline of the first content 608 in the fifth image is irregular. In some examples, the first content 608 is not affected by the size of the slot corresponding to the first position in the image template 602. That is, the outline of the first content 608 may be outside the slot corresponding to the first position.
[0080] Figure 7 A block diagram of an electronic device 700 for processing images, according to some examples herein, is shown. Figure 7 As shown, device 700 includes a first obtaining module 702, configured to obtain a first layer and first information based on a first image, the first layer including at least a portion of the content of the first image, and the first information associated with the first layer. Device 700 also includes a second obtaining module 704, configured to obtain a first image template based on the first layer and the first information, the first image template including an editable first position. It can be understood that, in this way, one or more examples of device 700 can achieve at least one of the aforementioned advantages.
[0081] In summary, one or more examples in this paper provide a technical mechanism for automatically splitting layers from a planar image, identifying replaceable regions, and generating image templates containing editable locations. Furthermore, one or more examples in this paper automatically split a planar image into structured layers and corresponding information, calculate a second region and a mask based on the layer's transparency, and generate an editable image template, allowing users to easily replace image and text content.
[0082] One or more examples in this paper also construct an end-to-end processing chain from a plan view to an editable template. The processing chain includes layer splitting, slot calculation, mask generation, and template assembly, enabling users to quickly generate image templates and easily replace content based on the generated image templates while maintaining the original design effect.
[0083] Furthermore, one or more examples in this paper provide a mechanism for calculating the first and second rectangular regions based on transparency. Also, one or more examples in this paper provide a scheme for determining whether to use the second rectangular region by combining quality metrics such as the third region, the minimum bounding rectangle, the first value, and the second value. One or more examples in this paper also provide a mechanism for generating the first mask based on the original transparency and employing a two-step process of denoising and softening the edges to make the edges of the first mask natural.
[0084] Furthermore, one or more examples in this paper provide a mechanism for automatically splitting a planar image into layers such as a background layer, photo layer, source layer, and text layer, and sequentially matching multiple layers and multiple pieces of information. These examples further provide optional enhancement processing, including super-resolution and character recognition, to enhance layer effects while maintaining quality. Moreover, one or more examples in this paper also provide a method for generating a second region separately from the first mask, unaffected by the second rectangular region. On another front, one or more examples in this paper extend image template generation from manual operation to an end-to-end automated and auditable process, while grounding abstract image processing into a concrete, editable first position and first mask through structured layers and information.
[0085] Therefore, through the various methods described above, one or more examples in this paper solve multiple technical problems. For instance, one or more examples in this paper address the issue of floor plans no longer carrying layer information; previously, users had to manually split layers and debug them one by one, resulting in low efficiency. One or more examples in this paper automatically obtain the first layer and first information based on the first image, and then obtain a first image template containing an editable first position based on the first layer and first information.
[0086] Furthermore, one or more examples in this paper address the issue of inaccurate slot calculations. For instance, the first rectangular area might contain too many transparent areas, failing to fit the valid content. One or more examples in this paper combine metrics such as the second rectangular area, the minimum bounding rectangle, and the first and second numerical values to accurately determine whether to use the second rectangular area, and to revert to the first rectangular area when the result is unreliable.
[0087] Furthermore, one or more examples in this paper address the issue of unnatural edges in the first mask; for instance, determining the fourth region solely based on its original transparency leaves noise and jagged edges. One or more examples in this paper employ a two-step process: denoising followed by edge smoothing, which removes noise and jagged edges while maintaining natural edges in the fourth region.
[0088] Furthermore, one or more examples in this paper address the issue of layer and information mismatch, such as discrepancies between the layer descriptions generated by the intelligent system and the number of images. One or more examples in this paper sequentially map layer descriptions to images one-to-one and verify the number, generating image templates only during this one-to-one matching process, thus ensuring consistency between layers and information.
[0089] By addressing the above issues, one or more examples in this paper implement an end-to-end method for automatically reconstructing layers and replaceable regions from a planar image and generating an image template containing editable locations. This method ensures that layer splitting, slot calculation, mask generation, and template assembly are not mutually exclusive, enabling users to quickly replace content based on the generated image template while maintaining the original design effect, achieving significant technical results.
[0090] Figure 8 A block diagram of a device 800 capable of implementing several examples of this paper is shown. For example... Figure 8 As shown, device 800 includes a central processing unit (CPU) and / or a graphics processing unit (GPU) 801, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 802 or loaded from storage unit 808 into random access memory (RAM) 803. The RAM 803 can also store various programs and data required for the operation of device 800. The CPU / GPU 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804. Although not shown in... Figure 8 As shown, device 800 may also include a coprocessor.
[0091] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0092] The various methods or processes described above can be executed by CPU / GPU 801. For example, in some examples, the methods can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 808. In some examples, part or all of the computer program can be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by CPU / GPU 801, one or more steps or actions in the methods or processes described above can be performed.
[0093] In some examples, the methods and processes described above can be implemented as a computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing the various aspects of this document.
[0094] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0095] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, a local area network (LAN), a wide area network (WAN), and / or a wireless network, to an external computer or external storage device. The network may include copper cables, fiber optic cables, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0096] The computer program instructions used to perform the operations described herein can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages and conventional procedural programming languages. The computer-readable program instructions can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider). In some examples, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), can be customized by utilizing state information from the computer-readable program instructions to execute the computer-readable program instructions, thereby implementing various aspects of this document.
[0097] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0098] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0099] The flowcharts and block diagrams in the accompanying figures illustrate the architecture, functionality, and operation of possible implementations of devices, methods, and computer program products according to several examples herein. In this regard, each box in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions marked in the boxes may occur in a different order than those marked in the figures. For example, two consecutive boxes may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each box in the block diagrams and / or flowcharts, and combinations of boxes in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0100] The examples described above are exemplary and not exhaustive, nor are they limited to the disclosed examples. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described examples. The terminology used herein is chosen to best explain the principles, practical applications, or technical improvements to technology in the market, or to enable others skilled in the art to understand the examples disclosed herein.
Claims
1. A method for processing an image, comprising: Based on the first image, a first layer and first information are obtained, wherein the first layer includes at least a portion of the content of the first image, and the first information is associated with the first layer; as well as Based on the first layer and the first information, a first image template is obtained, wherein the first image template includes an editable first position.
2. The method according to claim 1, further comprising: A first region is obtained based on the transparency of the first layer, wherein the transparency in the first region satisfies a first threshold. as well as Based on the first region, a second region is obtained, the second region covering the first region, and the second region including the editable first position.
3. The method of claim 2, wherein obtaining the second region based on the first region comprises: Based on the first region, a first rectangular region is obtained, the edges of the first rectangular region are parallel to the edges of the first layer, and the first rectangular region covers the first region; as well as Based on the first rectangular region, a second region is obtained.
4. The method according to claim 3, further comprising: Based on the first region, a third region is obtained, wherein the third region is a convex region surrounding the first region; Based on the third region, a second rectangular region is obtained, which covers the first region, and at least one side of the second rectangular region is not parallel to the side of the first layer; as well as The second region is obtained based on the first rectangular region and the second rectangular region.
5. The method according to claim 4, wherein obtaining the second region based on the first rectangular region and the second rectangular region comprises: Based on the first rectangular region and the second rectangular region, a first value is obtained, which indicates the area difference between the first rectangular region and the second rectangular region; Based on the second rectangular region and the first region, a second value is obtained, the second value indicating the proportion of the number of first pixels in the second rectangular region, and the number of first pixels indicating the number of pixels overlapping between the first region and the second rectangular region; as well as In response to the first value satisfying the second threshold and the second value satisfying the third threshold, the second rectangular region is designated as the second region.
6. The method of claim 5, wherein obtaining the first value based on the first rectangular region and the second rectangular region comprises: Based on the areas of the first rectangular region and the second rectangular region, a first difference is obtained; as well as The first value is obtained based on the proportion of the first difference in the first rectangular region.
7. The method according to claim 1, further comprising: Based on the transparency of the first layer, a second region is obtained, the second region including the editable first position; Based on the second region, a first coordinate and a first scale are obtained, wherein the first coordinate indicates the center position of the second region and the first scale indicates the size ratio of the second region to the first layer; as well as Based on the first coordinates, the editable first position is obtained, and the first position is associated with the first ratio.
8. The method according to claim 7, further comprising: In response to a first operation, a second image is obtained based on the first media content, the first scale, and the first position, the first operation being associated with the first media content and the first image template, and at least a portion of the first media content is displayed in a second region of the second image.
9. The method according to claim 1, further comprising: Based on the first image, multiple layers are obtained, wherein the multiple layers include the first layer; The multiple layers are overlaid to obtain a third image; Based on the transparency of the third image, a first mask is obtained, the first mask including a fourth region, the transparency of the first mask in the fourth region being less than a set transparency; as well as Based on the first mask, the first layer, and the first information, the first image template is obtained.
10. The method of claim 9, wherein obtaining the first mask based on the transparency of the third image comprises: The fourth region is determined based on the transparency of the third image; Adjust the transparency of the first pixel, which is located within the outline of the fourth region; as well as The first mask is obtained based on the fourth region.
11. The method according to claim 1, further comprising: Based on the first image, multiple layers and multiple pieces of information are obtained, wherein the multiple layers include the first layer, the multiple pieces of information include the first information, and the multiple pieces of information also include the order of the multiple layers; Match the multiple layers and the multiple pieces of information; as well as In response to the successful matching of the multiple layers and the multiple pieces of information one by one, the multiple layers are arranged in order to obtain the first image template.
12. The method according to claim 1, further comprising: Based on the intelligent system and the first image, the first layer and the first information are obtained, wherein the first layer includes at least one of the following: a background layer, a text layer, a material layer, or a photo layer.
13. The method according to claim 1, further comprising: A second region is obtained based on the intelligent system and the transparency of the first layer. The second region includes the editable first position, and the outline of the second region changes based on a first input, which is associated with the intelligent system.
14. An electronic device comprising: A first obtaining module is configured to obtain a first layer and first information based on a first image, wherein the first layer includes at least a portion of the content of the first image, and the first information is associated with the first layer; as well as A second obtaining module is configured to obtain a first image template based on the first layer and the first information, the first image template including an editable first position.
15. An electronic device comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, which, when executed by the processor, cause the electronic device to perform the method according to any one of claims 1 to 13.
16. A computer program product comprising computer-executable instructions, wherein the computer-executable instructions are executed by a processor to implement the method according to any one of claims 1 to 13.
