Picture processing method and device, computer equipment and storage medium
Through layer construction and configuration information processing, the problem of cumbersome character card redrawing during multilingual localization in the game is solved, improving the efficiency of picture changes and reducing the workload of artists.
Patent Information
- Application Number
- CN202411346018.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-27
AI Technical Summary
When multilingual localization is performed in the game, the redrawing of character cards increases the workload of artists, and the operation is cumbersome, affecting the efficiency of changes and production.
By obtaining the original image and changing configuration information, layer construction is performed, the layer where the target image content is located is determined, and changes it according to the configuration information, the changed layer is generated, and finally merged into the target image.
This reduces the workload of artists to change pictures, improves the efficiency of image changes, and makes it easier for non-art professionals to make picture changes, reducing the steps and communication and feedback process during the production process.
Smart Images

Figure CN119205989A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and apparatus for image processing, a computer device, and a computer-readable storage medium. Background Art
[0002] In some games, there are gameplays such as collecting and developing character cards. The character cards contain a variety of information related to the character, which is displayed in the form of images or art words. When the game needs to be localized for multiple languages, each character card needs to be redrawn, which increases the workload of the artists and is cumbersome, affecting the efficiency of changing and making character cards. Summary of the invention
[0003] The embodiments of the present application provide a method, apparatus, computer device and computer-readable storage medium for image processing, which can reduce the workload of artists in changing images, thereby improving the efficiency of image changing.
[0004] The present application provides a method for processing an image, including:
[0005] Acquire an original image to be processed and change configuration information corresponding to the original image, wherein the change configuration information is used to indicate that a target image content of the original image is to be changed;
[0006] Performing layer construction processing on the original image to obtain at least one first layer corresponding to the original image;
[0007] Based on the changed configuration information, determining a target first layer where the target image content is located from the at least one first layer;
[0008] Modify the target image content in the target first layer according to the modified configuration information to obtain a modified second layer;
[0009] Based on the second layer and the unchanged first layer, a target image corresponding to the original image is obtained.
[0010] Accordingly, the embodiment of the present application further provides a picture processing device, including:
[0011] An acquisition unit, used for acquiring an original image to be processed and change configuration information corresponding to the original image, wherein the change configuration information is used for indicating a change to be made to a target image content of the original image;
[0012] A first processing unit, configured to perform layer construction processing on the original image to obtain at least one first layer corresponding to the original image;
[0013] A first determining unit, configured to determine, based on the configuration change information, a target first layer where the target image content is located from the at least one first layer;
[0014] A changing unit, used for changing the target image content in the target first layer according to the change configuration information to obtain a changed second layer;
[0015] The second determining unit is used to obtain a target image corresponding to the original image based on the second layer and the unchanged first layer.
[0016] Correspondingly, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes any mapping processing method provided in the embodiments of the present application.
[0017] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the above-mentioned mapping processing method.
[0018] The embodiment of the present application obtains the original image to be processed and the change configuration information corresponding to the original image, the change configuration information is used to indicate the change of the target image content of the original image; performs layer construction processing on the original image to obtain at least one first layer corresponding to the original image; based on the change configuration information, determines the target first layer where the target image content is located from at least one first layer; changes the target image content in the target first layer according to the change configuration information to obtain the changed second layer; based on the second layer and the first layer that has not been changed, obtains the target image corresponding to the original image. In this way, the workload of artists changing images can be reduced, thereby improving the efficiency of image changes. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 A flowchart of an image processing method provided in an embodiment of the present application.
[0021] Figure 2 A schematic diagram of an application scenario of an image processing method provided in an embodiment of the present application.
[0022] Figure 3A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.
[0023] Figure 4 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.
[0024] Figure 5 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application.
[0025] Figure 6 A structural block diagram of an image processing device provided in an embodiment of the present application.
[0026] Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0028] The embodiments of the present application provide a method, apparatus, computer-readable storage medium, and computer equipment for image processing. Specifically, the image processing method of the embodiments of the present application can be executed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a personal computer (PC), a personal digital assistant (PDA), etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0029] For example, the computer device can be a terminal, which can obtain an original image to be processed and change configuration information corresponding to the original image, the change configuration information is used to indicate a change to a target image content of the original image; perform layer construction processing on the original image to obtain at least one first layer corresponding to the original image; based on the change configuration information, determine a target first layer where the target image content is located from at least one first layer; change the target image content in the target first layer according to the change configuration information to obtain a changed second layer; and obtain a target image corresponding to the original image based on the second layer and the unchanged first layer.
[0030] Based on the above problems, the embodiments of the present application provide a first image processing method, apparatus, computer device and computer-readable storage medium, which can reduce the workload of artists in changing images, thereby improving the efficiency of image changing.
[0031] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0032] An embodiment of the present application provides a method for processing an image, which can be executed by a terminal or a server. The embodiment of the present application is described by taking the execution of the method for processing an image by a terminal as an example.
[0033] See also Figure 1 , Figure 1 A schematic diagram of a process flow of an image processing method provided in an embodiment of the present application. The specific process flow of the image processing method may be as follows:
[0034] 101. Obtain the original image to be processed and the change configuration information corresponding to the original image.
[0035] In the embodiment of the present application, the original image refers to an image created by an artist using a graphic editing software. The original image may include a variety of formats, such as PNG (Portable Network Graphics) format.
[0036] Among them, graphic editing software refers to software tools used to create, edit and modify graphics, images and design works. Graphic editing software can include many types, for example, graphic editing software can include Photoshop, figma, 3dmax, etc.
[0037] In an embodiment of the present application, the original image may include multiple image contents, and the contents may be divided according to the type of image content.
[0038] For example, the original image may be a character card in a game, and the image content of the original image may include information such as a character image, a background image, and a character name, thereby obtaining different types of image content in the original image.
[0039] The configuration change information may be used to indicate that the target image content of the original image is to be changed, that is, the configuration change information may include the target image content to be changed in the original image, and the changed content corresponding to the target image content.
[0040] In some embodiments, the configuration information can be changed by an artist. For example, the configuration information can support table configuration, that is, the artist can configure the target image content that needs to be changed in the original image and the changed content corresponding to the target image content in the change configuration table, thereby obtaining the configuration information.
[0041] For example, see Table 1 below:
[0042] Table 1
[0043]
[0044] Among them, Table 1 shows part of the changed configuration information. The changed configuration information in Table 1 indicates that in the original picture 1: the text of the text content is changed from "Alice" to "Alice"; the font of the text content is changed from "Bold" to "Song"; the size of the text content is changed from "20" to "30", etc.
[0045] 102. Perform layer construction processing on the original image to obtain at least one first layer corresponding to the original image.
[0046] In the embodiment of the present application, the layer construction process can be used to split the original image into at least one layer, that is, the first layer. The content in the first layer is the image content in the original image. For example, if the original image includes multiple image contents, the original image can be split into multiple first layers, each of which contains one image content in the original image.
[0047] Among them, layers allow images to be decomposed into multiple simple, independent elements, each of which can be located on a separate layer. For example, in the embodiment of the present application, a type of image content in the original image can be used as an independent element and located on a first layer.
[0048] Among them, layers can include the following features: Independence: Each layer is independent, and modifications to a certain layer will not affect other layers; Editability: Users can draw, color, add text, and perform other operations on any layer without affecting the underlying or other layer images; Movability: The layer can be moved freely in the image and its position in the image can be adjusted; Adjustable transparency: Users can adjust the transparency of the layer to achieve an image overlay effect; Mergeable and groupable: Multiple layers can be merged into one layer, or multiple layers can be grouped for unified management and editing.
[0049] In some embodiments, in order to improve the efficiency of image modification, the step of "performing layer construction processing on the original image to obtain at least one first layer corresponding to the original image" may include the following operations:
[0050] Get the template layer file corresponding to the original image;
[0051] The original image is layered based on the template layer file to obtain at least one first layer corresponding to the original image.
[0052] The template layer file refers to the PSD (Photoshop Document, image processing file) template file used to make the original image. PSD is a special file format for Photoshop software, which is used to save various layers, channels, paths, masks, reference lines, annotations and other information during the image editing process. PSD format is the default file format of Photoshop, which allows users to save images in a lossless way and retain all editing history so that they can be edited or modified later.
[0053] In an embodiment of the present application, the PSD template file may include image contents of all original images generated using the PSD template file.
[0054] In some embodiments, a PSD template file can be used to make original images of the same category. For example, the original image can be a character card in a game, and the characters in the game can be divided into characters of multiple camps according to different camps. For characters belonging to the same camp, the same PSD template file can be used to make cards.
[0055] For example, original picture A, original picture B, and original picture C belong to the same category, and the same PSD template file can be used to create original picture A, original picture B, and original picture C. The PSD template file includes all the picture contents of original picture A, original picture B, and original picture C. Among them, each picture content of each original picture can be located on different layers of the PSD template file, so as to facilitate editing of different picture contents of different original pictures.
[0056] The template layer file may include multiple layer groups, each of which corresponds to a content type. That is, a layer group may include multiple layers, and the image contents contained in the multiple layers in each layer group may belong to the same content type.
[0057] For example, the template layer file can be used to create original picture A, original picture B, and original picture C. The content types of the picture contents of original picture A, original picture B, and original picture C may include: role type, text type, background type, etc., and the template layer file may include layer group 1 corresponding to the role type, layer group 2 corresponding to the text type, and layer group 3 corresponding to the background type. Among them, layer group 1 may include content layers of the role type corresponding to each original picture, layer group 2 may include content layers of the text type corresponding to each original picture, and layer group 3 may include content layers of the background type corresponding to each original picture.
[0058] In some embodiments, in order to accurately split different image contents of the original image into different layers, the step of "performing layer-by-layer processing on the original image based on the template layer file to obtain at least one first layer corresponding to the original image" may include the following operations:
[0059] Get the target content type to which each image content of the original image belongs;
[0060] Determine a target layer group corresponding to a target content type from among multiple layer groups;
[0061] Get the layer that matches the image content from the target layer group as the first layer.
[0062] The target content type to which each image content of the original image belongs is obtained by performing image recognition on the original image to determine multiple image contents in the original image and the target content type corresponding to each image content.
[0063] In some embodiments, since the original image is produced according to the template layer file, the content type corresponding to the image content of the original image can be consistent with the content type corresponding to each layer group in the template layer file. When performing image recognition on the original image, the image recognition process can be performed on the original image according to the content type corresponding to each layer group in the template layer file, so as to obtain the target content type corresponding to each image content in the original image.
[0064] Among them, determining the target layer group corresponding to the target content type from multiple layer groups may include: determining the target layer group corresponding to the picture content according to the layer group corresponding to the content type that is the same as the target content type to which each picture content belongs.
[0065] For example, the image content of the original image may include: image of character A, name of character A, background image, etc. Among them, the target content type of the image content "image of character A" may be: character type; the target content type of the image content "name of character A" may be: text type; the target content type of the image content "background image" may be: background type.
[0066] Then, you can select the layer group corresponding to the role type from the template layer file as the target layer group corresponding to the image content "image of role A"; select the layer group corresponding to the text type as the target layer group corresponding to the image content "name of role A"; select the layer group of the background type as the target layer group corresponding to the image content "background image".
[0067] Among them, obtaining a layer matching the image content from the target layer group as the first layer may include: according to the image contents of the original image, obtaining a layer matching the image content from the target layer group corresponding to each image content as the first layer corresponding to each image content.
[0068] For example, a template layer file may include layer group 1, layer group 2 and layer group 3, wherein layer group 1 corresponds to the role type and may include: role layer 11, role layer 12 and role layer 13; layer group 2 corresponds to the text type and may include: text layer 21, text layer 22 and text layer 23; layer group 3 corresponds to the background type and may include background layer 31, background layer 32 and background layer 33.
[0069] Further, the layer corresponding to the image content "image of character A" of the original image can be obtained from character layer 11, character layer 12 and character layer 13, for example, character layer 11 can be used as the first layer corresponding to the character type of the original image; the layer corresponding to the text content "name of character A" of the original image can be obtained from text layer 21, text layer 22 and text layer 23, for example, text layer 21 can be used as the first layer corresponding to the text type of the original image; the layer corresponding to the image content "background image" of the original image can be obtained from background layer 31, background layer 32 and background layer 33, for example, background layer 31 can be used as the first layer corresponding to the background type of the original image. According to the first layers corresponding to the various content types, multiple first layers corresponding to the original image are obtained.
[0070] In some embodiments, obtaining a layer matching the image content from the target layer group can be done through a calling tool provided by the graphics editing software, which calls the graphics editing software to operate the layers in the template layer file to obtain each first layer from the template layer file.
[0071] There are many calling tools, such as COM (Component Object Model) interface, SDK (Software Development Kit), API (Software Development Kit) interface, etc. Different graphic editing software may provide at least one calling tool.
[0072] Among them, the COM interface supports external programs to interact and exchange data with graphics editing software through COM technology. For example, developers can write programs or scripts through the COM interface to control the graphics editing software; the SDK supports external programs to call the functions of the graphics editing software; the API interface defines a set of communication methods between software components, allowing data exchange and function calls between different software applications or components.
[0073] For example, the graphics editing software may be Photoshop, and the calling tool may be the Photoshop COM interface provided by Photoshop. The Photoshop COM interface allows other applications to interact with Photoshop through COM technology, thereby controlling and manipulating the functions of Photoshop. For example, by calling the Photoshop COM interface, the functions of Photoshop are called to operate the layers in the template layer file, so as to obtain each first layer from the template layer file.
[0074] Among them, an image editing tool is provided in the embodiment of the present application, and the original image can be imported into the image editing tool. The image editing tool can operate the template layer file through the Photoshop COM interface provided by Photoshop. Through the software automation process, the manual intervention of the complex process can be reduced, the labor cost can be reduced, and the production cost can be saved. Moreover, since the production process is more standardized, the additional cost caused by human intervention will also be reduced, thereby saving resources.
[0075] In some embodiments, after creating the original image according to the template layer file, the artist may also overlay special effects on the original image. In order to accurately extract the layer containing the special effects from the original image, the method may further include the following steps:
[0076] If there is no layer group corresponding to the target content type in the template layer file, content extraction processing is performed on the original image, and the first layer is determined based on the extracted image content.
[0077] Among them, there is no layer group corresponding to the target content type in the template layer file, which means that the original image includes image content other than the content type corresponding to the template layer file.
[0078] For example, the template layer file may include layer group 1 corresponding to the role type, layer group 2 corresponding to the text type, and layer group 3 corresponding to the background type. The image content of the original image may include: image of role A, name of role A, background image, and light effect, etc. By matching the image content of the original image with the content types corresponding to the template layer file, it can be determined that the content type corresponding to the light effect does not exist in the template layer file, and the original image can be further processed to extract the layer corresponding to the light effect content of the original image.
[0079] Among them, the content extraction process can be used to extract image content that does not belong to the content type corresponding to the template layer file from the original image as the first layer.
[0080] In some embodiments, in order to improve the accuracy of layer construction of the original image, the step of "extracting content from the original image and determining the first layer based on the extracted image content" may include the following operations:
[0081] Convert the original image into a binary image;
[0082] Determine at least one connected region from the binary image according to pixel values and position information of pixels in the binary image;
[0083] A target connected area is determined from at least one connected area, and image content corresponding to the target connected area is extracted from the original image as a first layer.
[0084] Among them, a binary image is a special image format in which each pixel has only two possible values: usually 0 and 1 (or black and white).
[0085] Among them, converting the original image into a binary image may include: first converting the original image into a grayscale image, and the specific method may be: obtaining the color information of each pixel in the original image, and calculating the grayscale value corresponding to each pixel according to the color information and a preset weight value, so as to obtain a grayscale image; then comparing the grayscale value of each pixel in the grayscale image with a preset threshold, setting the pixel points corresponding to the grayscale value greater than or equal to the preset threshold to white, and setting the pixel points corresponding to the grayscale value less than the preset threshold to black, so as to obtain a binary image.
[0086] The preset threshold value may be any value between 0 and 1, and the preset threshold value may be set manually or calculated according to an algorithm, etc.
[0087] In some embodiments, in order to improve the accuracy of image processing, before converting the grayscale image into a binary image, the grayscale image may be blurred (eg, Gaussian blur) and the blurred grayscale image may be converted into a binary image.
[0088] Among them, according to the pixel values and position information of the pixels in the binary image, at least one connected region is determined from the binary image, and connected component analysis (CCA) can be used to identify the connected regions in the binary image.
[0089] The connected regions in the image refer to the image regions composed of foreground pixels with the same pixel value and adjacent positions in the image. These regions are visually represented as a set of connected points, while disconnected points form different regions.
[0090] In some embodiments, multiple methods may be used to identify connected regions of a binary image through connected component analysis, such as a Two-Pass algorithm, a seed filling method, and the like.
[0091] Among them, the Two-Pass algorithm marks all connected regions by traversing the image twice. The first traversal assigns a temporary label to each connected region, and the second traversal updates the labels of all pixels belonging to the same connected region to the minimum label value; the seed filling rule starts from a pixel (seed) and checks the pixels in its neighborhood. If the neighboring pixels meet the conditions (such as the same pixel value), they are marked with the same label as the seed, and continue to search in its neighborhood until there are no more pixels that meet the conditions.
[0092] Wherein, the target connected area is determined from at least one connected area, and the connected area with the highest score can be determined according to the scores of the connected areas as the target connected area.
[0093] In some embodiments, determining the score of a connected region may include the following steps: first, calculating the properties of the connected region: that is, after the connected component analysis is completed, the properties of each connected region, such as area, perimeter, circumscribed rectangle, centroid, etc., may be calculated; then, setting the scoring criteria: according to the specific application scenario, one or more scoring criteria may be set to evaluate the "score" of each connected region. For example, a connected region with a larger area may be an area where the image content needs to be extracted, so it can be regarded as an area with a high score; finally, screening and marking are performed: according to the set scoring criteria, the connected regions with high scores are screened out and marked on the image, thereby determining the target connected region.
[0094] Furthermore, the image content corresponding to the location of the target connected area can be obtained from the original image to determine the first layer.
[0095] In the embodiment of the present application, there are two ways to construct the layers of the original image. The first way is to extract the layer corresponding to the image content of the original image from the template layer file as the layer of the original image, that is, the first layer; the second way is to perform a series of image processing on the original image for the image content that does not exist in the template layer file to generate the layer corresponding to the image content, that is, the first layer.
[0096] For example, see Figure 2 , Figure 2 A schematic diagram of an application scenario of an image processing method provided in an embodiment of the present application. Figure 2 The upper side shows the original picture A. Figure 2 The lower side shows a plurality of first layers corresponding to the original image A obtained by performing layer construction processing on the original image A, including: a special effect layer A1, a character layer A2, a background layer A3, and a text layer A4.
[0097] Among them, the special effect layer A1 includes the special effect content in the original picture A; the character layer A2 includes the character content in the original picture A; the background layer A3 includes the background content in the original picture A; and the text layer A4 includes the text content in the original picture A. In this way, multiple layers constituting the original picture A are obtained.
[0098] The embodiment of the present application utilizes layer stratification technology and image processing technology to construct layers of the original image, thereby lowering the operating threshold and allowing non-art professionals to modify and produce the original image, reducing unnecessary steps and communication feedback processes in the process, and making the entire production process smoother and more efficient.
[0099] 103. Based on the changed configuration information, determine a target first layer where the target image content is located from at least one first layer.
[0100] Among them, the changed configuration information includes the target image content that needs to be changed in the original image, so the first layer that meets the target image content can be screened out from multiple first layers as the target first layer that needs to be changed.
[0101] For example, the image content of the original image may include: character images, background images, special effects, text, etc. If the target image content to be changed in the original image indicated in the change configuration information may be text, then the layer where the text content is located may be determined from the multiple first layers corresponding to the original image as the target first layer.
[0102] 104. Change the target image content in the target first layer according to the changed configuration information to obtain a changed second layer.
[0103] After the target first layer is determined, the target image content in the first layer may be changed according to the changed image content corresponding to the target image content recorded in the change configuration information.
[0104] In some embodiments, in order to ensure the effect of image modification, the step of "modifying the target image content in the target first layer according to the modified configuration information to obtain the modified second layer" may include the following operations:
[0105] Obtain the changed content corresponding to the target image content from the changed configuration information;
[0106] The target image content in the target first layer is replaced with the changed content to obtain the changed second layer.
[0107] The changed content corresponding to the target image content is obtained from the changed configuration information, that is, the changed content corresponding to the target image content in the target first layer is determined from the changed configuration information.
[0108] For example, the target image content in the first target layer may include: text "Alice", font "Kaiti" and size "18". The target image content to be changed recorded in the change configuration information may be text content, which may include: text "Alice", font "Kaiti" and size "18", and the corresponding changed text content may include: text "Alice", font "Kaiti" and size "14". Thus, the changed content may include: text "Alice", font "Kaiti" and size "14".
[0109] Among them, the target image content in the target first layer is replaced with the changed content. Through the PhotoshopCOM interface, all the first layers of the original image are traversed to find the target first layer that needs to be changed. After finding the corresponding target first layer, the target image content in the target first layer is changed to the obtained changed content. Thus, the changed target first layer is obtained as the second layer.
[0110] For example, see Figure 3 , Figure 3 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 3 The left side shows the target first layer containing the target image content that needs to be changed, where the target image content includes: text "Alice", font "Kaiti" and size "18". The changed content corresponding to the target image content obtained from the change configuration information may include: text "Alice", font "Kaiti" and size "14". Thus, the content of the target first layer can be changed to obtain the changed target first layer, that is, Figure 3The second layer shown on the right includes the following image content: the text "Alice", the font "Kai Ti" and the size "14", thereby changing the content of the target first layer without affecting the content of other first layers.
[0111] In some embodiments, in order to ensure that the display size of the image content before and after the adjustment in the original image does not change, the method may further include the following steps:
[0112] If the display size of the changed content in the second layer does not match the display size of the target image content in the target first layer, the display size of the changed content is adjusted based on the display size of the target image content to obtain an adjusted second layer;
[0113] Among them, the display size of the changed content in the second layer does not match the display size of the target image content in the target first layer, which may include: the display size of the changed content in the second layer is larger than or smaller than the display size of the target image content in the target first layer.
[0114] For example, see Figure 4 , Figure 4 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 4 The left side shows the target first layer containing the target image content that needs to be changed, where the target image content includes: text "Alice", font "Kaiti" and size "18". The changed content corresponding to the target image content obtained from the change configuration information may include: text "Alice", font "Songti" and size "8". Thus, the content of the target first layer can be changed to obtain the changed target first layer, that is, Figure 4 The second layer shown on the right side includes the following image content: text "Alice", font "Songti" and size "8", thereby achieving the content change of the target first layer.
[0115] However, the display size of the changed content in the second layer is smaller than the display size of the target image content in the target first layer, so the display size of the changed content in the second layer needs to be adjusted.
[0116] Among them, adjusting the display size of the changed content based on the display size of the target image content may include: adjusting the display size of the changed content in the second layer to be the same as the display size of the target image content in the target first layer.
[0117] In some embodiments, the specific steps of adjusting the display size of the changed content based on the display size of the target image content may include: obtaining the boundary coordinates of the area where the target image content is located in the target first layer, mapping the boundary coordinates to the second layer, and determining the target display size of the changed content in the second layer according to the position of the boundary coordinates in the second layer, and then adjusting the size of the changed content according to the target display size to obtain the adjusted second layer.
[0118] The display size of the changed content in the adjusted second layer is the same as the display size of the target image content in the target first layer.
[0119] In some embodiments, the step of “obtaining a target image corresponding to the original image based on the second layer and the unchanged first layer” may include the following operations:
[0120] Based on the adjusted second layer and the unchanged first layer, a target image corresponding to the original image is obtained.
[0121] Specifically, the adjusted second layer may be merged with the unchanged first layer to obtain a target image corresponding to the original image.
[0122] 105. Based on the second layer and the unchanged first layer, a target image corresponding to the original image is obtained.
[0123] The target image refers to a changed image obtained by changing the target image content of the original image.
[0124] In some embodiments, the step of “obtaining a target image corresponding to the original image based on the second layer and the unchanged first layer” may include the following operations:
[0125] Merge the second layer with the unchanged first layer to obtain a merged image;
[0126] Based on the merged image, determine the target image.
[0127] The second layer and the unchanged first layer are merged, and each layer can be merged according to the display hierarchy order of each layer in the original image.
[0128] In some embodiments, the display hierarchy order of each layer is recorded in the template layer file corresponding to the original image. Therefore, when the layer corresponding to the image content of the original image is extracted from the template layer file, the display hierarchy order of the layer can be obtained synchronously, and the layer obtained by extracting the image content by performing image processing on the original image can be used as the topmost display layer.
[0129] The display hierarchy order of the layers determines how the elements in the image are stacked, that is, which element will be displayed above or below another element. For example, the display hierarchy order may include from top to bottom, and the higher the display hierarchy order, the less content is blocked by other layers.
[0130] For example, see Figure 5 , Figure 5 A schematic diagram of an application scenario of another image processing method provided in an embodiment of the present application. Figure 5 The left side shows the second layer and the unchanged first layer, wherein the second layer may include: the changed text layer A4; the unchanged first layer may include: the background layer A3, the character layer A2 and the special effect layer A1.
[0131] The display hierarchy order of each layer from bottom to top is: background layer A3, character layer A2, modified text layer A4, special effect layer A1. Then, each layer can be superimposed according to the display hierarchy order to obtain a merged image, that is, Figure 5 The merged image is shown on the right.
[0132] Wherein, determining the target image based on the merged image may include: exporting the merged image into an image in PNG format, which may be used as the target image. The target image differs from the original image only in that the text content is changed, and other contents remain unchanged.
[0133] In some embodiments, in order to further avoid changing the content of the picture that does not need to be changed, the step of "determining the target picture based on the merged picture" may include the following operations:
[0134] Cut out the area image corresponding to the content of the second layer from the merged image;
[0135] The region image is superimposed on the target image content of the original image to obtain the target image.
[0136] Among them, intercepting the area picture corresponding to the content of the second layer from the merged picture may include: determining the display position corresponding to the content of the second layer from the merged picture, and then intercepting the content corresponding to the display position from the merged picture to obtain the area picture.
[0137] In some embodiments, the content corresponding to the display position can be captured from the merged image using the Image library of Python (a high-level programming language). The Image library of Python is a powerful image processing tool that provides rich functions and flexible interfaces and can be used for operations such as reading, operating, processing and saving images.
[0138] Furthermore, the area image captured in the merged image can be superimposed on the target image content of the original image, that is, according to the first position of the area image in the merged image, corresponding to the second position of the target image content in the original image, the area image is superimposed on the second position of the original image, covering the target image content, thereby obtaining the target image.
[0139] In some embodiments, the captured area image in the merged image is superimposed on the target image content of the original image, and the Image paste function can be used to superimpose the captured area image to the position where the target image content is located in the original image.
[0140] In an embodiment of the present application, a picture editing tool is provided, which supports importing an original picture that needs to be changed, and then the picture editing tool can execute the steps of the picture processing method: obtaining the original picture to be processed, and the change configuration information corresponding to the original picture, the change configuration information is used to indicate the change of the target picture content of the original picture; performing layer construction processing on the original picture to obtain at least one first layer corresponding to the original picture; based on the change configuration information, determining the target first layer where the target picture content is located from at least one first layer; changing the target picture content in the target first layer according to the change configuration information to obtain a changed second layer; based on the second layer and the first layer that has not been changed, obtaining the target picture corresponding to the original picture.
[0141] Among them, when the image editing tool executes each step of the image processing method, Python's logging module can be used to record each step to achieve traceability of the entire process.
[0142] Among them, when the image editing tool calls the Photoshop COM interface, part of Photoshop is not exposed through the COM interface, which hinders the automation process. You can check the log to determine the obstruction process and use pyautogui to trigger the automation process to continue executing the steps of the image processing method.
[0143] Among them, pyautogui is a Python module that provides cross-platform GUI (graphical user interface) automation functions, allowing users to control the mouse, keyboard and screen by writing Python scripts to achieve automated tasks such as automated testing, simulated user interaction, batch processing, etc.
[0144] By developing standardized processes through software, the image modification process can be batched, streamlined, and industrialized, and the production process can be traced. Each step can be recorded and tracked, making it easy to trace any problems in the production process. It helps to improve product quality, reduce the possibility of errors, and locate and solve problems more quickly when they occur, thereby improving overall production efficiency and product quality.
[0145] An embodiment of the present application discloses a method for processing an image, the method comprising: obtaining an original image to be processed, and change configuration information corresponding to the original image, the change configuration information being used to indicate a change to a target image content of the original image; performing layer construction processing on the original image to obtain at least one first layer corresponding to the original image; based on the change configuration information, determining a target first layer where the target image content is located from at least one first layer; changing the target image content in the target first layer according to the change configuration information to obtain a changed second layer; and obtaining a target image corresponding to the original image based on the second layer and the first layer that has not been changed, thereby reducing the workload of artists in changing images, thereby improving the efficiency of image changes.
[0146] In order to facilitate better implementation of the image processing method provided in the embodiment of the present application, the embodiment of the present application also provides an image processing device based on the above image processing method. The meanings of the terms are the same as those in the above image processing method, and the specific implementation details can refer to the description in the method embodiment.
[0147] See also Figure 6 , Figure 6 A structural block diagram of an image processing device provided in an embodiment of the present application, the device comprising:
[0148] An acquisition unit 301 is used to acquire an original image to be processed and change configuration information corresponding to the original image, wherein the change configuration information is used to indicate that a target image content of the original image is to be changed;
[0149] A first processing unit 302 is used to perform layer construction processing on the original image to obtain at least one first layer corresponding to the original image;
[0150] A first determining unit 303 is used to determine, based on the configuration change information, a target first layer where the target image content is located from the at least one first layer;
[0151] A changing unit 304, configured to change the target image content in the target first layer according to the change configuration information to obtain a changed second layer;
[0152] The second determining unit 305 is used to obtain a target image corresponding to the original image based on the second layer and the unchanged first layer.
[0153] In some embodiments, the first processing unit 302 may include:
[0154] A first acquisition subunit is used to acquire a template layer file corresponding to the original image, wherein the template layer file includes a plurality of layer groups, and each layer group corresponds to a content type;
[0155] The first processing subunit is used to perform layer-by-layer processing on the original image based on the template layer file to obtain at least one first layer corresponding to the original image.
[0156] In some embodiments, the first processing subunit may be specifically configured to:
[0157] Obtain the target content type to which each image content of the original image belongs;
[0158] Determine a target layer group corresponding to the target content type from the multiple layer groups;
[0159] A layer matching the image content is obtained from the target layer group as the first layer.
[0160] In some embodiments, the apparatus may further include:
[0161] The second processing unit is used to perform content extraction processing on the original image if there is no layer group corresponding to the target content type in the template layer file, and determine the first layer based on the extracted image content.
[0162] In some embodiments, the second processing unit may include:
[0163] A conversion subunit, used to convert the original image into a binary image;
[0164] A first determining subunit, configured to determine at least one connected region from the binary image according to pixel values and position information of pixels in the binary image;
[0165] The extraction subunit is used to determine a target connected area from the at least one connected area, and extract the image content corresponding to the target connected area from the original image as the first layer.
[0166] In some embodiments, the second determining unit 305 may include:
[0167] a merging subunit, configured to merge the second layer with the unchanged first layer to obtain a merged image;
[0168] The second determining subunit is used to determine the target picture based on the merged picture.
[0169] In some embodiments, the second determining subunit may be specifically used for:
[0170] Cutting out a region image corresponding to the content of the second layer from the merged image;
[0171] The region image is superimposed on the target image content of the original image to obtain the target image.
[0172] In some embodiments, the modifying unit 304 may include:
[0173] A second acquisition subunit is used to acquire the changed content corresponding to the target image content from the change configuration information;
[0174] The replacement subunit is used to replace the target image content in the target first layer with the changed content to obtain the changed second layer.
[0175] In some embodiments, the apparatus may further include:
[0176] An adjustment unit is used to adjust the display size of the changed content based on the display size of the target image content if the display size of the changed content in the second layer does not match the display size of the target image content in the target first layer, so as to obtain the adjusted second layer.
[0177] In some embodiments, the second determining unit 305 may include:
[0178] The third determining subunit is used to obtain a target image corresponding to the original image based on the adjusted second layer and the unchanged first layer.
[0179] The embodiment of the present application discloses a picture processing device, wherein an acquisition unit 301 acquires an original picture to be processed and change configuration information corresponding to the original picture, wherein the change configuration information is used to indicate that a target picture content of the original picture is changed; a first processing unit 302 performs layer construction processing on the original picture to obtain at least one first layer corresponding to the original picture; a first determination unit 303 determines a target first layer where the target picture content is located from the at least one first layer based on the change configuration information; a change unit 304 changes the target picture content in the target first layer according to the change configuration information to obtain a changed second layer; and a second determination unit 305 obtains a target picture corresponding to the original picture based on the second layer and the first layer that has not been changed. In this way, the workload of artists in changing pictures can be reduced, thereby improving the efficiency of picture changes.
[0180] Accordingly, the embodiment of the present application also provides a computer device, which may be a terminal. Figure 7 As shown, Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored in the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. It will be understood by those skilled in the art that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0181] The processor 501 is the control center of the computer device 500. It uses various interfaces and lines to connect the various parts of the entire computer device 500, executes various functions of the computer device 500 and processes data by running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, thereby monitoring the computer device 500 as a whole.
[0182] In the embodiment of the present application, the processor 501 in the computer device 500 will load instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 will run the application programs stored in the memory 502 to implement various functions:
[0183] Obtaining the original image to be processed and the change configuration information corresponding to the original image, where the change configuration information is used to indicate that the target image content of the original image is to be changed;
[0184] Performing layer construction processing on the original image to obtain at least one first layer corresponding to the original image;
[0185] Based on the changed configuration information, determining a target first layer where the target image content is located from at least one first layer;
[0186] The target image content in the target first layer is changed according to the changed configuration information to obtain a changed second layer;
[0187] Based on the second layer and the unchanged first layer, a target image corresponding to the original image is obtained.
[0188] The embodiment of the present application obtains the original image to be processed and the change configuration information corresponding to the original image, the change configuration information is used to indicate the change of the target image content of the original image; performs layer construction processing on the original image to obtain at least one first layer corresponding to the original image; based on the change configuration information, determines the target first layer where the target image content is located from at least one first layer; changes the target image content in the target first layer according to the change configuration information to obtain the changed second layer; based on the second layer and the first layer that has not been changed, obtains the target image corresponding to the original image. In this way, the workload of artists changing images can be reduced, thereby improving the efficiency of image changes.
[0189] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0190] Optional, such as Figure 7 As shown, the computer device 500 further includes: a touch screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507, respectively. Those skilled in the art can understand that Figure 7 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0191] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, and these graphical user interfaces may be composed of graphics, guide information, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 501, and can receive the command sent by the processor 501 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 501 to determine the type of touch event, and then the processor 501 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 503 can also be used as a part of the input unit 506 to realize the input function.
[0192] The radio frequency circuit 504 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer devices through wireless communication, and to send and receive signals between the network device or other computer devices.
[0193] The audio circuit 505 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 505 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 505 and converted into audio data, and then the audio data is output to the processor 501 for processing, and then sent to another computer device through the radio frequency circuit 504, or the audio data is output to the memory 502 for further processing. The audio circuit 505 may also include an earphone jack to provide communication between an external headset and the computer device.
[0194] The input unit 506 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0195] The power supply 507 is used to supply power to various components of the computer device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 507 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0196] although Figure 7 Not shown, the computer device 500 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0197] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0198] As can be seen from the above, the computer device provided in this embodiment can obtain the original image to be processed, and the change configuration information corresponding to the original image, the change configuration information is used to indicate the change of the target image content of the original image; perform layer construction processing on the original image to obtain at least one first layer corresponding to the original image; based on the change configuration information, determine the target first layer where the target image content is located from at least one first layer; change the target image content in the target first layer according to the change configuration information to obtain a changed second layer; based on the second layer and the first layer that has not been changed, obtain the target image corresponding to the original image.
[0199] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0200] To this end, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any one of the image processing methods provided in the embodiment of the present application. For example, the computer program can execute the following steps:
[0201] Obtaining the original image to be processed and the change configuration information corresponding to the original image, where the change configuration information is used to indicate that the target image content of the original image is to be changed;
[0202] Performing layer construction processing on the original image to obtain at least one first layer corresponding to the original image;
[0203] Based on the changed configuration information, determining a target first layer where the target image content is located from at least one first layer;
[0204] The target image content in the target first layer is changed according to the changed configuration information to obtain a changed second layer;
[0205] Based on the second layer and the unchanged first layer, a target image corresponding to the original image is obtained.
[0206] The embodiment of the present application obtains the original image to be processed and the change configuration information corresponding to the original image, the change configuration information is used to indicate the change of the target image content of the original image; performs layer construction processing on the original image to obtain at least one first layer corresponding to the original image; based on the change configuration information, determines the target first layer where the target image content is located from at least one first layer; changes the target image content in the target first layer according to the change configuration information to obtain the changed second layer; based on the second layer and the first layer that has not been changed, obtains the target image corresponding to the original image. In this way, the workload of artists changing images can be reduced, thereby improving the efficiency of image changes.
[0207] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0208] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0209] Since the computer program stored in the computer-readable storage medium can execute the steps in any one of the image processing methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the image processing methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0210] The above is a detailed introduction to an image processing method, device, computer-readable storage medium and computer equipment provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for processing an image, characterized in that: The method comprises: Acquire an original image to be processed and change configuration information corresponding to the original image, wherein the change configuration information is used to indicate that a target image content of the original image is to be changed; Performing layer construction processing on the original image to obtain at least one first layer corresponding to the original image; Based on the changed configuration information, determining a target first layer where the target image content is located from the at least one first layer; Modify the target image content in the target first layer according to the modified configuration information to obtain a modified second layer; Based on the second layer and the unchanged first layer, a target image corresponding to the original image is obtained.
2. The method according to claim 1, characterized in that The performing layer construction processing on the original image to obtain at least one first layer corresponding to the original image includes: Obtaining a template layer file corresponding to the original image, wherein the template layer file includes multiple layer groups, each layer group corresponding to a content type; The original image is subjected to layer-by-layer processing based on the template layer file to obtain at least one first layer corresponding to the original image.
3. The method according to claim 2, characterized in that The performing layer-by-layer processing on the original image based on the template layer file to obtain at least one first layer corresponding to the original image includes: Obtain the target content type to which each image content of the original image belongs; Determine a target layer group corresponding to the target content type from the multiple layer groups; A layer matching the image content is obtained from the target layer group as the first layer.
4. The method according to claim 3, characterized in that The method further comprises: If the layer group corresponding to the target content type does not exist in the template layer file, content extraction processing is performed on the original image, and the first layer is determined based on the extracted image content.
5. The method according to claim 4, characterized in that The performing content extraction processing on the original image and determining the first layer based on the extracted image content includes: Convert the original image into a binary image; Determine at least one connected region from the binary image according to pixel values and position information of pixels in the binary image; A target connected area is determined from the at least one connected area, and image content corresponding to the target connected area is extracted from the original image as the first layer.
6. The method according to claim 1, characterized in that The obtaining, based on the second layer and the unchanged first layer, a target image corresponding to the original image includes: Merging the second layer with the unchanged first layer to obtain a merged image; Based on the merged picture, the target picture is determined.
7. The method according to claim 6, characterized in that The determining the target picture based on the merged picture includes: Cutting out a region image corresponding to the content of the second layer from the merged image; The region image is superimposed on the target image content of the original image to obtain the target image.
8. The method according to claim 1, characterized in that The step of changing the target image content in the target first layer according to the changed configuration information to obtain a changed second layer includes: Obtaining the changed content corresponding to the target image content from the changed configuration information; The target image content in the target first layer is replaced with the changed content to obtain the changed second layer.
9. The method according to claim 8, characterized in that The method further comprises: If the display size of the modified content in the second layer does not match the display size of the target image content in the target first layer, adjusting the display size of the modified content based on the display size of the target image content to obtain an adjusted second layer; The obtaining, based on the second layer and the unchanged first layer, a target image corresponding to the original image includes: Based on the adjusted second layer and the unchanged first layer, a target image corresponding to the original image is obtained.
10. A picture processing device, characterized in that: The device comprises: An acquisition unit, used for acquiring an original image to be processed and change configuration information corresponding to the original image, wherein the change configuration information is used for indicating a change to be made to a target image content of the original image; A first processing unit, configured to perform layer construction processing on the original image to obtain at least one first layer corresponding to the original image; A first determining unit, configured to determine, based on the configuration change information, a target first layer where the target image content is located from the at least one first layer; A changing unit, used for changing the target image content in the target first layer according to the change configuration information to obtain a changed second layer; The second determining unit is used to obtain a target image corresponding to the original image based on the second layer and the unchanged first layer.
11. A computer device comprising a memory, a processor and a computer program stored in the memory and running on the processor, wherein: When the processor executes the program, the image processing method according to any one of claims 1 to 9 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the image processing method according to any one of claims 1 to 9.
