Image editing method and device

By generating preview images and loading them into memory for editing in chunks, it solves the problem of system crashes caused by insufficient memory or CPU when editing higher-resolution images, and achieves stable editing of high-resolution images.

CN114820878BActive Publication Date: 2024-10-18BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110129764.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2024-10-18
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

In the existing technology, when editing an image with a higher resolution, insufficient memory or CPU of the electronic device causes a system crash.

Method used

Edit by generating a preview image instead of directly editing the image to be processed. The preview image has a lower resolution than the image to be processed, and the blocks corresponding to the editing instructions are loaded into the memory for editing, and the target image is generated.

Benefits of technology

It avoids loading the entire image to be processed into the memory at one time, reduces the load on the memory and CPU, solves the problem of system crash, and enables the editing of higher-resolution images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114820878B_ABST
    Figure CN114820878B_ABST
Patent Text Reader

Abstract

The disclosed embodiment provides an image editing method and device. When the electronic device detects that the user is processing an image to be processed with a higher resolution, a preview image of the image to be processed is generated and displayed. During the process of the user editing the preview image, the electronic device stores the editing instructions in sequence. When the user saves the edited preview image, the electronic device loads the blocks corresponding to the editing instructions into the memory according to the stored editing instructions, edits the blocks according to the editing instructions, and generates a target image according to the edited blocks. With this solution, when editing an image to be processed with a higher resolution, it is not necessary to load the entire image to be processed into the memory at one time, but only load the blocks corresponding to the editing instructions, so that the data loaded into the memory is relatively small, thereby overcoming the problem of system crash caused by insufficient memory or CPU when editing an image with a higher resolution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of image processing technology, and more particularly to an image editing method and device. Background Art

[0002] With the rapid development of technology, more and more users use electronic devices to edit images to achieve ideal display effects. Image editing includes brightness adjustment, contrast adjustment, adding stickers, etc.

[0003] In a common image editing process, the electronic device loads the image selected by the user into the memory, displays the image on the interface and displays editing tools such as filters, cropping, adjustment, etc. The user edits the image using the editing tools. After the editing is completed, the electronic device saves the edited image.

[0004] However, when the image to be edited is relatively large, such as an image with a 4K or 8K resolution, due to the limited performance of the memory and central processing unit (CPU) of electronic devices, fully loading the image will bring a very large overhead to the memory and CPU, and even cause the system to crash due to insufficient memory. Therefore, how to edit images with higher resolutions, that is, how to edit large images or very large images, is considered an urgent problem to be solved in the industry. Summary of the invention

[0005] The embodiments of the present disclosure provide an image editing method and device to overcome the problem of system crash caused by insufficient memory or CPU when editing images with higher resolutions.

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

[0007] Receive an editing instruction input by a user, the editing instruction is used to edit a preview image, the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the resolution of the image to be processed; edit the preview image in response to the editing instruction, display the edited preview image, and store the editing instruction; receive a storage instruction input by the user; in response to the storage instruction, load the blocks of the image to be processed corresponding to the editing instruction into a memory, so as to edit the blocks according to the editing instruction, and generate a target image using the edited blocks, wherein the blocks are obtained by dividing the image to be processed.

[0008] In a second aspect, an embodiment of the present disclosure provides an electronic device, including:

[0009] a receiving unit, configured to receive an editing instruction input by a user, wherein the editing instruction is used to edit a preview image, wherein the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the resolution of the image to be processed;

[0010] A processing unit, configured to edit the preview image in response to the editing instruction;

[0011] A display unit, used for displaying the edited preview image;

[0012] A storage unit, used for storing the editing instruction;

[0013] The receiving unit is further used to receive a storage instruction input by a user;

[0014] The processing unit is also used to respond to the storage instruction, load the blocks of the image to be processed corresponding to the editing instruction into the memory, edit the blocks according to the editing instruction, and generate the target image using the edited blocks, wherein the blocks are obtained by dividing the image to be processed.

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

[0016] The memory stores computer-executable instructions;

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

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

[0019] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, comprising: a computer program, wherein the computer program is stored in a readable storage medium, at least one processor of an electronic device reads the computer program from the readable storage medium, and the at least one processor executes the computer program so that the electronic device executes the method described in the first aspect above.

[0020] The image editing method and device provided in this embodiment generate and display a preview image of the image to be processed when the electronic device detects that the user is processing the image to be processed with a higher resolution. During the process of the user editing the preview image, the electronic device stores the editing instructions in sequence. When the user saves the edited preview image, the electronic device loads the blocks corresponding to the editing instructions into the memory according to the stored editing instructions, edits the blocks according to the editing instructions, and generates the target image according to the edited blocks. With this solution, when editing the image to be processed with a higher resolution, it is not necessary to load the entire image to be processed into the memory at one time, but only load the blocks corresponding to the editing instructions, so that the data loaded into the memory is relatively small, thereby overcoming the problem of system crash caused by insufficient memory or CPU when editing images with a higher resolution. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0022] Figure 1A is a schematic diagram of an operating environment of the image editing method provided by an embodiment of the present disclosure;

[0023] Figure 1B is another operating environment schematic diagram of the image editing method provided by the embodiment of the present disclosure;

[0024] Figure 2 is a flow chart of an image editing method provided by an embodiment of the present disclosure;

[0025] Figure 3 is a schematic diagram of the image editing process provided by the present disclosure;

[0026] Figure 4 is a schematic diagram of local editing in the image editing method provided by an embodiment of the present disclosure;

[0027] Figure 5 is a schematic diagram of local editing in the image editing method provided by an embodiment of the present disclosure;

[0028] Figure 6 is a schematic diagram of global editing in the image editing method provided by an embodiment of the present disclosure;

[0029] Figure 7 is a schematic diagram of global editing in the image editing method provided by an embodiment of the present disclosure;

[0030] Figure 8A structural block diagram of an electronic device provided by an embodiment of the present disclosure;

[0031] Fig. 9 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

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

[0033] In daily life, when users use mobile phones and other electronic devices to view images, they often encounter some super-large images. Super-large images refer to images that are particularly large or have very high resolutions, such as 4K and 8K images. However, the memory and CPU performance of electronic devices are limited. If a super-large image is fully loaded, it will bring a very large overhead to the memory, CPU, etc., and even cause the electronic device to crash due to insufficient memory. The current common method is to load in blocks, that is, only encode and decode the user-visible part to avoid the image occupying too much memory. This technology is widely used in electronic maps. For example, when a user uses a navigation application (application, APP) to navigate, the area on the interface of the navigation APP is an area centered on the user's location, rather than the entire map.

[0034] With the rapid development of technology, in addition to viewing images on electronic devices, users also edit images through various image editing apps. During the editing process, the entire image needs to be loaded into memory. This is because block loading is difficult to meet the needs of image editing. For example, when a face image needs to beautify, basic data such as facial key points need to be extracted. Basic data such as facial key points are based on the entire image. If the image is loaded in blocks, it is difficult to beautify the image. In addition, since editing the entire image is relatively simple and easy to operate, even if a local area of ​​the image is processed, the existing technology also loads the entire image.

[0035] During the image editing process, if the image to be edited is a large image, it will be loaded into the memory, which may easily cause excessive or insufficient memory consumption. In addition, during the image editing process, some intermediate data will be generated due to the need to execute image processing algorithms, and the algorithms and intermediate data will further consume memory, which may easily cause electronic equipment system crashes.

[0036] Obviously, electronic devices with limited memory cannot support the processing of ultra-large images. For example, many mobile phones currently cannot edit ultra-high-definition images such as 4K and 8K.

[0037] In view of this, the embodiments of the present disclosure provide an image editing method and device, which store editing instructions of a preview image, load the image to be processed in blocks according to the editing instructions, and edit it, so as to overcome the problem of system crash caused by insufficient memory or CPU when editing images with higher resolution.

[0038] Figure 1A This is a schematic diagram of an operating environment of the image editing method provided by the embodiment of the present disclosure. Figure 1A , the operating environment includes an electronic device 1, and the electronic device 1 is, for example, an electronic device with a display screen. An APP capable of image editing is installed on the electronic device 1. The user uses the APP to edit the image. During the editing process, the user imports the image through the image import button on the APP, so that a preview image of the image to be processed is displayed on the display screen of the electronic device. Afterwards, the user inputs editing instructions through the display screen, such as selecting a sticker, to edit the preview image. The electronic device loads the image to be processed in blocks and edits the image to be processed according to the user's editing instructions for the preview image. The image to be processed is, for example, an image taken by the electronic device 1; or, the image to be processed is an image stored locally by the electronic device 1 through copying or the like.

[0039] Figure 1B FIG. 1 is another schematic diagram of an operating environment of the image editing method provided by the embodiment of the present disclosure. Figure 1B The operating environment includes an electronic device 1 and a server 2, and a network connection is established between the electronic device 1 and the server 2. For example, a large number of images are stored on the server 2, and the electronic device 1 can download the images from the server 1 and edit them. The editing process can be seen in the above Figure 1A The description is not repeated here.

[0040] Above Figure 1A and Figure 1B In the embodiment, the APP on the electronic device 1 is a built-in APP of the system, a third-party APP, etc., which is not limited in the embodiment of the present disclosure.

[0041] Above Figure 1A and Figure 1B In the embodiment, the electronic device 1 is a desktop electronic device or a mobile electronic device, such as a TV, a computer, etc., and the mobile electronic device is a mobile phone, a tablet computer, a laptop computer, a wearable electronic device, a smart home device, etc. The server is an independently set server or a server cluster composed of multiple servers.

[0042] It should be noted that although Figure 1A and Figure 1BIn the embodiment, the electronic device 1 is used as the execution subject to process the image. However, the embodiments of the present disclosure are not limited to this. For example, when the user edits the preview image, the electronic device 1 stores the editing instructions in sequence, and sends the editing instructions to the server 2 storing the image to be processed. The server 2 loads the blocks of the image to be processed in sequence according to the editing instructions, and performs image processing on the blocks.

[0043] Figure 2 is a flowchart of the image editing method provided by the embodiment of the present disclosure. The execution subject of this embodiment is the above Figure 1A and Figure 1B The electronic device in this embodiment includes:

[0044] 101. Receive an editing instruction input by a user.

[0045] The editing instruction is used to edit a preview image of the image to be processed. The editing instruction is used to edit a preview image, and the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the resolution of the image to be processed.

[0046] Exemplarily, the image to be processed is a large image, such as a 4K or 8K high-definition image, and the resolution of the image is relatively high, higher than the resolution of the screen of the electronic device, resulting in the electronic device being unable to load or consuming more memory even if it is successfully loaded. When the user needs to edit the image to be processed, the user clicks on the image to be processed, and the electronic device generates a preview image for the image to be processed according to the screen resolution, loads the preview image into the memory, and displays the preview image on the display screen. The resolution of the preview image is less than or equal to the resolution of the screen of the electronic device. At the same time, the resolution of the preview image is lower than the image to be processed, that is, the image to be processed loses a part of its pixels to obtain the preview image. Due to the loss of some pixels, if the preview image is enlarged, when it is enlarged to a certain multiple, the preview image is blurred. However, if the image to be processed is enlarged, when it is enlarged by the same multiple, the image to be processed is likely not to be blurred. Whether it will be blurred depends on the relationship between the screen pixels and the image pixels. For example, if the width of the image to be processed is 1080 pixels and it is displayed on a mobile phone with a width of 720, the image to be processed will not be blurred when the magnification of the image to be processed is between 1.0 and 2.0. When the magnification exceeds 2 times, it is very likely to be blurred. The preview image of the image to be processed is generated according to the screen resolution of the electronic device. Therefore, the preview image will become blurred when it is enlarged. During the enlargement process, the "blur" can be improved by local loading, that is, the corresponding area is loaded from the image to be processed to generate a new preview image during the enlargement operation.

[0047] When the user edits the preview image, he or she selects beauty, makeup, etc. from the interface of the electronic device to input the editing instruction.

[0048] In the embodiment of the present application, editing the preview image refers to adjusting the preview image, such as adjusting the brightness, contrast, saturation, etc. of the preview image. Alternatively, editing the preview image refers to adding a filter, applying beauty effects, etc. to the preview image.

[0049] 102. Edit the preview image in response to the editing instruction, display the edited preview image, and store the editing instruction.

[0050] Exemplarily, each time the user inputs an editing instruction, the electronic device edits the preview image according to the editing instruction and stores the editing instruction. When there are more than two editing instructions, the object edited by this editing instruction is the preview image edited by the last editing instruction. In other words, each edit is performed on the preview image based on the last edit. After editing, the editing effect is displayed in real time on the display screen of the electronic device for the user to view.

[0051] 103. Receive a storage instruction input by a user.

[0052] 104. In response to the storage instruction, the blocks of the image to be processed corresponding to the editing instruction are loaded into the memory, so as to edit the blocks according to the editing instruction, and generate the target image using the edited blocks, where the blocks are obtained by dividing the image to be processed.

[0053] Wherein, the image to be processed includes multiple blocks.

[0054] In step 103 and step 104, after the user has finished editing the preview image, he clicks the editing instruction on the interface, triggering the electronic device to edit the image to be processed (i.e., the original image) according to the stored editing instruction. In the process of the electronic device editing the original image, the blocks corresponding to the editing instructions are loaded into the memory, and the blocks are edited according to the editing instructions. Finally, the target image is generated according to the edited blocks. For example, if the user partially edits the preview image, the block is a local area of ​​the image to be processed. For another example, if the user edits the preview image as a whole, the electronic device divides the entire image to be processed into blocks, loads one or more blocks corresponding to the editing instructions each time, and edits these blocks. Afterwards, the electronic device generates the target image using the edited blocks.

[0055] The image editing method provided by the embodiment of the present disclosure generates and displays a preview image of the image to be processed when the electronic device detects that the user is processing the image to be processed with a higher resolution. During the process of the user editing the preview image, the electronic device stores the editing instructions in sequence. When the user saves the edited preview image, the electronic device loads the blocks corresponding to the editing instructions into the memory according to the stored editing instructions, edits the blocks according to the editing instructions, and generates the target image according to the edited blocks. With this solution, when editing the image to be processed with a higher resolution, it is not necessary to load the entire image to be processed into the memory at one time, but only load the blocks corresponding to the editing instructions, so that the data loaded into the memory is relatively small, thereby overcoming the problem of system crash caused by insufficient memory or CPU when editing images with a higher resolution.

[0056] In the above embodiment, when the electronic device generates a target image using the edited blocks after editing the blocks, the edited blocks are used to cover the corresponding positions of the image to be processed, thereby obtaining the target image. Alternatively, the electronic device copies the image to be processed to obtain a copy image, and uses the edited blocks to cover the corresponding positions of the copy image.

[0057] By adopting this solution, the purpose of generating a target image by using the edited blocks is achieved.

[0058] In the above embodiment, the user performs local editing or global editing on the preview image. Next, how the electronic device performs local editing and global editing on the image to be processed is described in detail respectively.

[0059] First, the electronic device performs partial editing on the preview image. Partial editing refers to editing a part of the preview image, such as beautifying the face area, without editing other areas outside the face area.

[0060] Figure 3 This is a schematic diagram of the image editing process provided by the present disclosure. Please refer to Figure 3 , the user clicks on the icon of the image editing APP on the display screen of the electronic device to enter the image selection interface. The image selection interface displays at least one thumbnail. The user clicks on a thumbnail of at least one thumbnail (hereinafter referred to as the target thumbnail) to send a selection instruction to the electronic device. The electronic device responds to the selection request, generates a preview image according to the image to be processed corresponding to the target thumbnail, and displays the preview image. For example, if the image to be processed is a 4K image, the preview image is a 1K image. Among them, the process of the electronic device generating a preview image is imperceptible to the user. Of course, the electronic device can also inform the user through voice prompts, text prompts, etc.: the resolution of the image to be processed is relatively high, whether the user agrees to generate a preview image.

[0061] For electronic devices, whether the image to be processed is a large image is usually related to the performance of the electronic device. For example, for low-end devices, images with a resolution of more than 1920×1080 are super large images; while for high-end models, images with a resolution of more than 4096×2160 are super large images. Therefore, when the user selects a target thumbnail, the electronic device will only generate a preview image if it determines that the image to be processed is a super large image.

[0062] Exemplarily, when the user selects a target thumbnail, the electronic device reads the image information of the image to be processed corresponding to the target thumbnail. Then, based on the image information, it is determined whether the size of the image to be processed is greater than a preset threshold. If the resolution of the image to be processed is greater than the preset threshold, a preview image is generated based on the resolution of the image to be processed and the resolution of the electronic device. For example, if the resolution of the display screen of the electronic device is 1920×1080 and the resolution of the image to be processed is 4096×2160, a preview image with a resolution of 1920×1080 is generated. If the resolution of the image to be processed is less than or equal to the preset threshold, the image to be processed is directly loaded and edited. If the resolution of the image to be processed is greater than the preset threshold, a preview image is generated based on the image to be processed. Wherein, the preset threshold is determined based on at least one of the size of the central processing unit CPU of the electronic device, the size of the graphics processing unit GPU, the size of the screen resolution, and the memory size.

[0063] With this solution, the electronic device generates a preview image for the image to be processed and edits it only when the image to be processed is an extremely large image, thereby saving image processing steps.

[0064] After the electronic device displays the preview image, various image editing tools are also displayed on the display screen of the electronic device. For example, for portraits, the image editing tools include beauty, makeup, face reshaping, face slimming and fitness, and three-dimensional facial features. In addition, the electronic device also displays other scriptwriting tool labels, such as filters, editing, creation, etc. When the user selects different tool labels, the electronic device displays the corresponding category of tools. The user selects the favorite editing tool to edit the image according to needs or preferences. The electronic device generates editing instructions based on the user's operation of the editing tool to edit the preview image. During the editing process, each edit is edited on the basis of the last edit. For example, the user first selects face reshaping, and the electronic device reshapes the face of the person in the preview image according to the user's operation, and displays the editing effect in real time. Afterwards, the user selects three-dimensional facial features, and the electronic device adjusts the facial features of the face in the preview image after face reshaping, and displays the editing effect in real time.

[0065] When the user finishes editing the preview image, he clicks the Save button. At this time, the blocks corresponding to the editing instructions are loaded into the memory to edit the blocks, and the edited blocks are used to generate the target image. For example, see Figure 4 .

[0066] Figure 4 This is a schematic diagram of local editing in the image editing method provided by the embodiment of the present disclosure. Figure 4 After the user inputs the storage instruction, the electronic device extracts the blocks from the image to be processed according to the local area of ​​the preview image. Then, the electronic device loads the blocks into the memory, and edits the blocks according to the editing instruction to obtain the edited blocks. Finally, the target image is generated using the edited blocks, thereby completing the editing of the image to be processed.

[0067] With this solution, when editing an image to be processed, only a portion of the image to be processed, ie, a block, is loaded, thereby reducing memory consumption.

[0068] When the user edits the preview image multiple times, that is, when there are at least two editing instructions, the electronic device sequentially edits the preview image according to the at least two editing instructions during the user editing the preview image, displays the edited preview image, and sequentially stores the at least one editing instruction in the order in which it is input. Afterwards, when editing the blocks, the electronic device loads the blocks into the memory, obtains the editing instructions and sequentially edits the blocks in the order in which the at least two editing instructions are stored, and obtains the edited blocks.

[0069] For example, because the image to be processed has not been loaded into the memory, forcing it to load may cause memory problems, such as Out Of Memory Error (OOM). In the embodiment of the present application, all user edits are based on the preview image, and the editing effect seen by the user is also the editing effect of the preview image. When the user operation is completed and saved, the corresponding blocks in the original image are edited in sequence according to the user's editing order and editing method of the preview image.

[0070] During the editing process, it is necessary to ensure that the editing of the image to be processed is consistent with the editing of the preview image. This is because when editing, the editing object of each editing instruction is the editing result of the previous editing instruction. In other words, each edit is superimposed on the editing of the previous editing instruction. For example, the editing order of the preview image is: adjust the brightness first, then add a filter. The editing order with the block should also be: adjust the brightness first, then add a filter. If the editing order of the preview image is different from the editing order of the block, the superimposed effect of multiple edits to the block and the superimposed effect of multiple edits to the preview image will be inconsistent, and even deviations will occur.

[0071] In the embodiment of the present application, the electronic device sequentially stores multiple editing instructions input by the user in the order in which they are input. Afterwards, when editing the image to be processed, the multiple editing instructions are sequentially executed on the blocks to ensure that the editing process of the image to be processed is consistent with the editing process of the preview image, and achieve the ideal editing effect.

[0072] During the above-mentioned local editing process, it is very likely that there will be a phenomenon of relatively large local areas. At this time, if the blocks in the image to be processed are loaded into the memory, it will also cause the problem of large memory overhead. Therefore, when the size of the block exceeds the preset size, the electronic device needs to divide the block into multiple sub-blocks, where the preset size is, for example, the maximum value of the single load amount of the electronic device. Afterwards, the electronic device loads the multiple sub-blocks in the memory in sequence, edits each of the multiple sub-blocks according to the editing instruction to obtain multiple edited sub-blocks, and generates edited blocks based on the multiple edited sub-blocks. Exemplary, please follow Figure 5 .

[0073] Figure 5 This is a schematic diagram of local editing in the image editing method provided by the embodiment of the present disclosure. Figure 5 After the electronic device extracts a block from the image to be processed according to the local area of ​​the preview image, if the block is relatively large, the electronic device divides the block into 20 sub-blocks. After that, a portion of the sub-blocks are loaded each time, such as loading each of the 20 sub-blocks in sequence. For another example, the sub-blocks of the first row, the second row, the third row, the fourth row, and the fifth row are loaded in sequence from top to bottom.

[0074] With this solution, during the local editing process, the block is divided into sub-blocks and then loaded. Since the size of the sub-block is smaller than the size of the block, the overhead of memory and the like can be reduced.

[0075] The electronic device can flexibly divide the image to be processed into blocks in different ways. For example, the electronic device divides the image to be processed into blocks according to rows, that is, multiple consecutive rows of pixels are taken as a block; for another example, the electronic device divides the image to be processed into blocks according to columns, that is, multiple consecutive columns of pixels are taken as a block; for another example, the electronic device divides the image to be processed into blocks by both rows and columns. For another example, the electronic device divides the image to be processed into blocks according to regions. For example, assuming that the image to be processed contains mountains, water and grassland, the image to be processed is divided into three blocks, namely mountains, water and grassland.

[0076] Secondly, the electronic device performs global editing on the preview image. Global editing refers to editing the entire preview image, for example, adjusting the brightness of the entire preview image.

[0077] During the global image editing process, the process of the user selecting the target thumbnail and generating the preview image can be seen in the above Figure 3 The description is not repeated here.

[0078] When the user finishes editing the preview image, he clicks the Save button. At this time, the electronic device divides the image to be processed into blocks to obtain multiple blocks. Then, the electronic device loads some of the multiple blocks into the memory each time, and edits each of the blocks in the partial blocks according to the editing instruction to obtain multiple edited blocks. Finally, the electronic device generates the target image according to the multiple edited blocks. For example, see Figure 6 .

[0079] Figure 6 is a schematic diagram of global editing in the image editing method provided by the embodiment of the present disclosure. Figure 6 After the user inputs the storage instruction, the electronic device recognizes that the stored editing instruction is to edit the entire preview image. At this time, the electronic device divides the image to be processed into multiple sub-blocks. As shown in the figure, each small square represents a sub-block. After that, the electronic device loads these sub-blocks in sequence. For example, one sub-block is loaded each time; for another example, one row or one column of sub-blocks is loaded each time, etc., which is not limited in the embodiments of the present disclosure.

[0080] With this solution, when globally editing the image to be processed, only a part of the image to be processed, that is, one or more sub-blocks, is loaded, so the consumption of memory and the like can be effectively reduced.

[0081] In the above embodiment, when the electronic device divides the image to be processed into blocks to obtain multiple blocks, it first finds the cache determined from the memory for loading the blocks, and then divides the image to be processed according to the size of the fixed cache to divide the image to be processed into multiple blocks, wherein the fixed cache is used to load the multiple blocks.

[0082] Exemplarily, the electronic device selects a portion of memory of appropriate size from the memory as a fixed cache in the image processing process according to the memory size required by the image processing algorithm, etc. Each time loading, a fixed number of blocks are loaded, so that multiple blocks are processed in parallel.

[0083] In this way, a fixed cache is used in the image processing process. Since the fixed cache is relatively constant, abnormal phenomena such as fluctuation, insufficient memory, and memory overflow will not occur. Therefore, the stability of image processing can be guaranteed. Moreover, parallel processing of multiple blocks can increase the image processing speed.

[0084] In the above embodiment, when the electronic device divides the image to be processed into multiple blocks according to the size of the fixed buffer, the size of the block is first determined according to the size of the fixed buffer. Then, the electronic device performs grid division on the image to be processed according to the size of the block to divide the image to be processed into multiple blocks, and two adjacent blocks in the multiple blocks have overlapping parts.

[0085] Please refer to Figure 5 and Figure 6 , the electronic device divides the blocks or the image to be processed by grid division. Taking the division of the image to be processed as an example, the electronic device determines which division method to use according to the image processing algorithm. For example, when the electronic device executes an image algorithm on a certain area, only the data in the area is required to execute the image algorithm. At this time, the electronic device adopts a grid division strategy to grid the image to be processed. In the subsequent editing process of the image to be processed, multiple blocks can be processed in parallel, thereby improving the image processing speed. In this scenario, the image processing algorithm is, for example, stickers, local beauty, etc.

[0086] For another example, when an electronic device executes an image algorithm on a certain area, in addition to knowing the data of the pixels in the area, it also needs to know the information of the surrounding pixels. In this case, the electronic device adopts a sliding window strategy. In this case, two adjacent blocks in the multiple blocks have overlapping parts. For example, see Figure 7 .

[0087] Figure 7 is a schematic diagram of global editing in the image editing method provided by the embodiment of the present disclosure. Figure 7 , for every two adjacent sub-blocks, the diagonal filled part belongs to both sub-blocks. In this way, when processing two adjacent sub-blocks, the first sub-block is processed first, and then the second sub-block is processed. When processing the second sub-block, the information of some pixels of the first sub-block can be obtained, so that the processed image effect is better and the accuracy of image processing is improved. In this scenario, the image processing algorithm is, for example, overall beauty, brightness adjustment, contrast adjustment, etc.

[0088] By adopting this solution, the image to be processed is divided by grid division, so as to achieve the purpose of accurately dividing the image to be processed.

[0089] In the above embodiment, the electronic device edits the preview image according to the editing instruction, which can be roughly divided into two cases: editing pixels and editing positions. For example, when adjusting the brightness, it is necessary to adjust the pixel and the adjacent pixels, and no position mapping is required. When editing the position, it is necessary to perform position mapping on the first pixel in the preview image and the second pixel in the block.

[0090] During the mapping process, the electronic device first responds to the storage instruction, loads the block of the image to be processed corresponding to the editing instruction into the memory, determines the second pixel from the block according to the first pixel in the preview image, and the position of the second pixel in the image to be processed is determined according to the position of the first pixel in the preview image and the scaling ratio, and the scaling ratio is the scaling ratio of the preview image generated according to the image to be processed. Then, according to the editing of the first pixel by the editing instruction, the electronic device edits the second pixel to obtain the edited block, and generates the target image using the edited block.

[0091] For example, if you want to add a filter to the face in the image to be processed, you need to know the position of the face in the image to be processed and the position of each part of the face, that is, the face point map. At this time, position mapping is required. Position mapping means that the effect seen by the user is the editing effect of the preview image. In order to achieve the same effect by performing the same editing on the image to be processed, the position of each edited first pixel in the preview image is found in the image to be processed according to the scaling ratio, and then the second pixel is edited according to the editing of the first pixel. Among them, the scaling ratio refers to the scaling ratio when the preview image is generated from the original image to be processed.

[0092] When determining the position of the second pixel according to the position of the first pixel, the position coordinates of the second pixel can be obtained by multiplying the coordinates of the first pixel by the scaling ratio.

[0093] This solution ensures that the editing of the image to be processed is consistent with the editing of the preview image, thereby achieving the purpose of accurately editing the image to be processed.

[0094] It should be noted that in the above embodiments, the user directly edits the preview image, and the electronic device displays the editing effect of the preview image. However, the ultimate goal is to edit the original image to be processed. For example, the eyebrows are edited in the preview image, and finally the original image to be processed is edited according to the edited preview image.

[0095] In the above embodiment, after the electronic device generates the target image, the electronic device also deletes the above preview image and the stored editing instruction, thereby releasing the storage space of the electronic device.

[0096] Corresponding to the image editing method of the above embodiment, Figure 8 This is a structural block diagram of an electronic device provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Figure 8 The device includes: a receiving unit 11, a processing unit 12, a display unit 13 and a storage unit 14.

[0097] The receiving unit 11 is used to receive an editing instruction input by a user, wherein the editing instruction is used to edit a preview image, wherein the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the resolution of the image to be processed;

[0098] A processing unit 12, configured to edit the preview image in response to the editing instruction;

[0099] A display unit 13, used to display the edited preview image;

[0100] A storage unit 14, used for storing the editing instruction;

[0101] The receiving unit 11 is further used to receive a storage instruction input by a user;

[0102] The processing unit 12 is also used to respond to the storage instruction, load the blocks of the image to be processed corresponding to the editing instruction into the memory, edit the blocks according to the editing instruction, and generate the target image using the edited blocks, wherein the blocks are obtained by dividing the image to be processed.

[0103] In one embodiment of the present disclosure, the editing instruction is used to edit a local area of ​​the preview image, and the processing unit 12 is used to extract corresponding blocks from the image to be processed according to the local area of ​​the preview image, load the blocks into the memory, edit the blocks according to the editing instruction to obtain edited blocks, and generate the target image using the edited blocks.

[0104] In one embodiment of the present disclosure, the processing unit 12 is used to divide the block into multiple sub-blocks when the size of the block exceeds a preset size; load the multiple sub-blocks in the memory in sequence, edit each of the multiple sub-blocks according to the editing instruction to obtain multiple edited sub-blocks, and generate an edited block based on the multiple edited sub-blocks.

[0105] In one embodiment of the present disclosure, the editing instruction is used to edit the entire area of ​​the preview image, and the processing unit 12 is used to divide the image to be processed into blocks to obtain multiple blocks, load some of the multiple blocks into the memory each time, edit each block in the partial blocks according to the editing instruction to obtain multiple edited blocks, and generate the target image according to the multiple edited blocks.

[0106] In one embodiment of the present disclosure, the processing unit 12 is used to determine a fixed cache from the memory, and the fixed cache is used to load the multiple blocks. The image to be processed is divided according to the size of the fixed cache to divide the image to be processed into multiple blocks, wherein the fixed cache is used to load the multiple blocks.

[0107] In one embodiment of the present disclosure, when the processing unit 12 divides the image to be processed according to the size of the fixed cache to divide the image to be processed into multiple blocks, it is used to determine the size of the block according to the size of the fixed cache, and grid-divide the image to be processed according to the size of the block to divide the image to be processed into multiple blocks, wherein two adjacent blocks among the multiple blocks have overlapping parts.

[0108] In one embodiment of the present disclosure, before receiving the editing instruction input by the user, the receiving unit 11 further receives a selection instruction input by the user, wherein the selection instruction is used to select a target thumbnail from at least one thumbnail, wherein the target thumbnail is a thumbnail of the image to be processed, and the at least one thumbnail is displayed on a display screen of the electronic device;

[0109] The processing unit 12 is further configured to generate a preview image of the image to be processed in response to the selection request.

[0110] In one embodiment of the present disclosure, the processing unit 12 is used to read the image information of the image to be processed, and determine whether the resolution of the image to be processed is greater than a preset threshold value according to the image information, wherein the preset threshold value is determined according to at least one of the size of the central processing unit CPU, the size of the graphics processing unit GPU, the size of the screen resolution, and the memory size of the electronic device. If the resolution of the image to be processed is greater than the preset threshold value, the preview image is generated according to the image to be processed.

[0111] In one embodiment of the present disclosure, the number of the editing instructions is at least two, and the processing unit 12 is configured to edit the preview image in sequence according to the at least two editing instructions when editing the preview image in response to the editing instructions;

[0112] The display unit 13 is used to edit the preview image in sequence according to at least two editing instructions;

[0113] The storage unit 14 is used to store the at least two editing instructions in sequence according to the input order;

[0114] The processing unit 12 is further configured to load the blocks into a memory, obtain the editing instructions according to the storage order of the at least two editing instructions stored, and edit the blocks in sequence to obtain the edited blocks.

[0115] In one embodiment of the present disclosure, the processing unit 12 responds to the storage instruction, loads the block of the image to be processed corresponding to the editing instruction into the memory, edits the block according to the editing instruction, and generates the target image using the edited block, and is used to respond to the storage instruction, load the block of the image to be processed corresponding to the editing instruction into the memory, determine the second pixel from the block according to the first pixel in the preview image, the position of the second pixel in the image to be processed is determined according to the position of the first pixel in the preview image and the scaling ratio, the scaling ratio is the scaling ratio of the preview image generated from the image to be processed, edit the second pixel according to the editing of the first pixel by the editing instruction to obtain the edited block, and generate the target image using the edited block.

[0116] In one embodiment of the present disclosure, when the processing unit 12 generates a target image using the edited blocks, it is configured to replace the blocks at corresponding positions in the image to be processed with the edited blocks to obtain the target image.

[0117] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0118] Fig. 9 : is a schematic diagram of the structure of an electronic device 900 of an embodiment of the present disclosure, and the electronic device 900 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (Portable Media Players, PMPs), vehicle terminals (such as vehicle navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

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

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

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

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

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

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

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

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

[0127] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

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

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

[0130] In a first aspect, according to one or more embodiments of the present disclosure, there is provided an image editing method, comprising: receiving an editing instruction input by a user, the editing instruction being used to edit a preview image, the preview image being generated by processing an image to be processed according to a screen resolution of an electronic device, the resolution of the preview image being lower than the resolution of the image to be processed; editing the preview image in response to the editing instruction, displaying the edited preview image, and storing the editing instruction; receiving a storage instruction input by the user; in response to the storage instruction, loading a block of the image to be processed corresponding to the editing instruction into a memory, so as to edit the block according to the editing instruction, and generating a target image using the edited block, wherein the block is obtained by dividing the image to be processed.

[0131] According to one or more embodiments of the present disclosure, the editing instruction is used to edit a local area of ​​the preview image, and the blocks corresponding to the editing instruction are loaded into the memory to edit the blocks according to the editing instruction, and the target image is generated using the edited blocks, including: extracting corresponding blocks from the image to be processed according to the local area of ​​the preview image; loading the blocks into the memory, editing the blocks according to the editing instruction to obtain the edited blocks; and generating the target image using the edited blocks.

[0132] According to one or more embodiments of the present disclosure, the step of loading the block into a memory and editing the block according to the editing instruction to obtain an edited block includes: when the size of the block exceeds a preset size, dividing the block into a plurality of sub-blocks, sequentially loading the plurality of sub-blocks into a memory, editing each of the plurality of sub-blocks according to the editing instruction to obtain a plurality of edited sub-blocks, and generating an edited block based on the plurality of edited sub-blocks.

[0133] According to one or more embodiments of the present disclosure, the editing instruction is used to edit the entire area of ​​the preview image, the blocks corresponding to the editing instruction are loaded into the memory to edit the blocks according to the editing instruction, and the target image is generated using the edited blocks, including: dividing the image to be processed into blocks to obtain multiple blocks; loading some of the multiple blocks into the memory each time, and editing each block in the some of the blocks according to the editing instruction to obtain multiple edited blocks; generating the target image based on the multiple edited blocks.

[0134] According to one or more embodiments of the present disclosure, the step of dividing the image to be processed into multiple blocks includes: determining a fixed cache from the memory, dividing the image to be processed according to the size of the fixed cache, so as to divide the image to be processed into multiple blocks, wherein the fixed cache is used to load the multiple blocks.

[0135] According to one or more embodiments of the present disclosure, the dividing the image to be processed according to the size of the fixed cache so as to divide the image to be processed into a plurality of blocks includes: determining the size of the blocks according to the size of the fixed cache; and grid-dividing the image to be processed according to the size of the blocks so as to divide the image to be processed into a plurality of blocks, wherein two adjacent blocks among the plurality of blocks have overlapping portions.

[0136] According to one or more embodiments of the present disclosure, before receiving the editing instruction input by the user, it also includes: receiving a selection instruction input by the user, the selection instruction is used to select a target thumbnail from at least one thumbnail, the target thumbnail is a thumbnail of the image to be processed, and the at least one thumbnail is displayed on the display screen of the electronic device; in response to the selection request, generating a preview image of the image to be processed.

[0137] According to one or more embodiments of the present disclosure, the generating of a preview image of the image to be processed in response to the selection request includes: reading image information of the image to be processed; judging, based on the image information, whether a resolution of the image to be processed is greater than a preset threshold, wherein the preset threshold is determined based on at least one of the size of a central processing unit (CPU) of the electronic device, the size of a graphics processing unit (GPU), the size of a screen resolution, and the size of a memory; if the resolution of the image to be processed is greater than the preset threshold, generating the preview image based on the image to be processed.

[0138] According to one or more embodiments of the present disclosure, there are at least two editing instructions, and editing the preview image in response to the editing instructions, displaying the edited preview image, and storing the editing instructions includes: editing the preview image in sequence according to the at least two editing instructions, displaying the edited preview image, and storing the at least two editing instructions in sequence according to the input order; loading the blocks into the memory and editing the blocks according to the editing instructions to obtain the edited blocks includes: loading the blocks into the memory, obtaining the editing instructions and editing the blocks in sequence according to the storage order of the at least two editing instructions stored, to obtain the edited blocks.

[0139] According to one or more embodiments of the present disclosure, the step of responding to the storage instruction, loading the block of the image to be processed corresponding to the editing instruction into the memory, editing the block according to the editing instruction, and generating the target image using the edited block, includes: responding to the storage instruction, loading the block of the image to be processed corresponding to the editing instruction into the memory, determining a second pixel from the block according to a first pixel in the preview image, the position of the second pixel in the image to be processed being determined according to the position of the first pixel in the preview image and a scaling ratio, the scaling ratio being a scaling ratio of generating the preview image from the image to be processed; editing the first pixel according to the editing instruction, editing the second pixel to obtain the edited block, and generating the target image using the edited block.

[0140] According to one or more embodiments of the present disclosure, generating a target image using the edited blocks includes: replacing blocks at corresponding positions in the image to be processed with the edited blocks to obtain the target image.

[0141] In a second aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, including:

[0142] A receiving unit, configured to receive an editing instruction input by a user, wherein the editing instruction is used to edit a preview image, wherein the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the resolution of the image to be processed;

[0143] A processing unit, configured to edit the preview image in response to the editing instruction;

[0144] A display unit, used for displaying the edited preview image;

[0145] A storage unit, used for storing the editing instruction;

[0146] The receiving unit is further used to receive a storage instruction input by a user;

[0147] The processing unit is also used to respond to the storage instruction, load the blocks of the image to be processed corresponding to the editing instruction into the memory, edit the blocks according to the editing instruction, and generate the target image using the edited blocks, wherein the blocks are obtained by dividing the image to be processed.

[0148] According to one or more embodiments of the present disclosure, the editing instruction is used to edit a local area of ​​the preview image, and the processing unit is used to extract corresponding blocks from the image to be processed according to the local area of ​​the preview image; load the blocks into the memory, edit the blocks according to the editing instruction to obtain edited blocks; and generate the target image using the edited blocks.

[0149] According to one or more embodiments of the present disclosure, the processing unit is used to divide the block into multiple sub-blocks when the size of the block exceeds a preset size; load the multiple sub-blocks in the memory in sequence, edit each of the multiple sub-blocks according to the editing instruction to obtain multiple edited sub-blocks; and generate an edited block based on the multiple edited sub-blocks.

[0150] According to one or more embodiments of the present disclosure, the editing instruction is used to edit the entire area of ​​the preview image, and the processing unit is used to divide the image to be processed into blocks to obtain a plurality of blocks; each time a portion of the plurality of blocks is loaded into the memory, and each of the portion of the blocks is edited according to the editing instruction to obtain a plurality of edited blocks; and the target image is generated according to the plurality of edited blocks.

[0151] According to one or more embodiments of the present disclosure, the processing unit is used to determine a fixed cache from the memory; divide the image to be processed according to the size of the fixed cache to divide the image to be processed into multiple blocks, wherein the fixed cache is used to load the multiple blocks.

[0152] According to one or more embodiments of the present disclosure, when the processing unit divides the image to be processed according to the size of the fixed cache to divide the image to be processed into multiple blocks, it is used to determine the size of the block according to the size of the fixed cache; and grid-divides the image to be processed according to the size of the block to divide the image to be processed into multiple blocks, wherein two adjacent blocks in the multiple blocks have overlapping parts.

[0153] According to one or more embodiments of the present disclosure, before receiving the editing instruction input by the user, the receiving unit further receives a selection instruction input by the user, wherein the selection instruction is used to select a target thumbnail from at least one thumbnail, wherein the target thumbnail is a thumbnail of the image to be processed, and the at least one thumbnail is displayed on a display screen of the electronic device;

[0154] The processing unit is further configured to generate a preview image of the image to be processed in response to the selection request.

[0155] According to one or more embodiments of the present disclosure, the processing unit is used to read the image information of the image to be processed; based on the image information, determine whether the resolution of the image to be processed is greater than a preset threshold, and the preset threshold is determined based on at least one of the size of the central processing unit CPU, the size of the graphics processing unit GPU, the size of the screen resolution, and the memory size of the electronic device; if the resolution of the image to be processed is greater than the preset threshold, generate the preview image based on the image to be processed.

[0156] According to one or more embodiments of the present disclosure, the editing instructions are at least two, and the processing unit, when editing the preview image in response to the editing instructions, is used to edit the preview image in sequence according to the at least two editing instructions;

[0157] The display unit is used to display the edited preview image;

[0158] The storage unit is used to store the at least two editing instructions in sequence according to the input order;

[0159] The processing unit is further used to load the blocks into the memory, obtain the editing instructions and edit the blocks in sequence according to the storage order of the at least two editing instructions stored, so as to obtain the edited blocks.

[0160] According to one or more embodiments of the present disclosure, the processing unit responds to the storage instruction, loads the block of the image to be processed corresponding to the editing instruction into the memory, edits the block according to the editing instruction, and generates the target image using the edited block, and is used to respond to the storage instruction, load the block of the image to be processed corresponding to the editing instruction into the memory, determine the second pixel from the block according to the first pixel in the preview image, the position of the second pixel in the image to be processed is determined according to the position of the first pixel in the preview image and the scaling ratio, the scaling ratio is the scaling ratio of the preview image generated from the image to be processed, edit the second pixel according to the editing of the first pixel by the editing instruction to obtain the edited block, and generate the target image using the edited block.

[0161] According to one or more embodiments of the present disclosure, when the processing unit generates a target image using the edited blocks, it is configured to replace the blocks at corresponding positions in the image to be processed with the edited blocks to obtain the target image.

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

[0163] The memory stores computer-executable instructions;

[0164] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the image editing method as described above.

[0165] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, and when a processor executes the computer-executable instructions, the image editing method as described above is implemented.

[0166] In a fifth aspect, according to one or more embodiments of the present disclosure, there is provided a computer program product, including a computer program, which, when executed by a processor, implements the image editing method as described above.

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

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

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

Claims

1. An image editing method, characterized in that: include: Receiving an editing instruction input by a user, wherein the editing instruction is used to edit a preview image, wherein the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the resolution of the image to be processed; editing the preview image in response to the editing instruction, displaying the edited preview image, and storing the editing instruction; receiving a storage instruction input by a user; In response to the storage instruction, the blocks of the image to be processed corresponding to the editing instruction are loaded into the memory, so as to edit the blocks according to the editing instruction, and generate the target image by using the edited blocks, wherein the blocks are obtained by dividing the image to be processed; The editing instruction is used to edit a local area of ​​the preview image, the blocks corresponding to the editing instruction are loaded into a memory, the blocks are edited according to the editing instruction, and the target image is generated using the edited blocks, including: Extracting corresponding blocks from the image to be processed according to the local area of ​​the preview image; Loading the blocks into a memory, and editing the blocks according to the editing instructions to obtain edited blocks; The target image is generated using the edited blocks.

2. The method according to claim 1, characterized in that: The step of loading the blocks into a memory and editing the blocks according to the editing instructions to obtain edited blocks includes: When the size of the block exceeds a preset size, dividing the block into a plurality of sub-blocks; sequentially loading the plurality of sub-blocks into a memory, and editing each of the plurality of sub-blocks according to the editing instruction to obtain a plurality of edited sub-blocks; An edited partition is generated according to the plurality of edited sub-blocks.

3. The method according to claim 1, characterized in that The editing instruction is used to edit the entire area of ​​the preview image, the blocks corresponding to the editing instruction are loaded into the memory to edit the blocks according to the editing instruction, and the target image is generated using the edited blocks, including: Dividing the image to be processed into blocks to obtain a plurality of blocks; Each time, a portion of the plurality of blocks is loaded into the memory, and each of the portion of the blocks is edited according to the editing instruction to obtain a plurality of edited blocks; The target image is generated according to the multiple edited blocks.

4. The method according to claim 3, characterized in that The step of dividing the image to be processed into blocks to obtain a plurality of blocks includes: determining a fixed buffer from the memory; The image to be processed is divided according to the size of the fixed buffer, so as to divide the image to be processed into a plurality of blocks, wherein the fixed buffer is used to load the plurality of blocks.

5. The method according to claim 4, characterized in that The step of dividing the image to be processed according to the size of the fixed buffer so as to divide the image to be processed into a plurality of blocks includes: Determining the size of the blocks according to the size of the fixed cache; According to the size of the blocks, the image to be processed is grid-divided to divide the image to be processed into a plurality of blocks, and two adjacent blocks in the plurality of blocks have overlapping parts.

6. The method according to any one of claims 1 to 5, characterized in that: Before receiving the editing instruction input by the user, the method further includes: receiving a selection instruction input by the user, wherein the selection instruction is used to select a target thumbnail from at least one thumbnail, wherein the target thumbnail is a thumbnail of an image to be processed, and the at least one thumbnail is displayed on a display screen of the electronic device; In response to the selection instruction, a preview image of the image to be processed is generated.

7. The method according to claim 6, characterized in that The step of generating a preview image of the image to be processed in response to the selection instruction includes: Reading image information of the image to be processed; According to the image information, determining whether the resolution of the image to be processed is greater than a preset threshold, wherein the preset threshold is determined according to at least one of the size of a central processing unit (CPU), the size of a graphics processing unit (GPU), the size of a screen resolution, and the size of a memory of the electronic device; If the resolution of the image to be processed is greater than the preset threshold, the preview image is generated according to the image to be processed.

8. The method according to any one of claims 1 to 5, characterized in that: The editing instructions include at least two, and the editing the preview image in response to the editing instructions, displaying the edited preview image, and storing the editing instructions include: Editing the preview image in sequence according to at least two editing instructions, displaying the edited preview image, and storing the at least two editing instructions in sequence according to the input order; The step of loading the blocks into a memory and editing the blocks according to the editing instructions to obtain edited blocks includes: The blocks are loaded into the memory, and the editing instructions are obtained according to the storage order of the at least two editing instructions stored, and the blocks are edited in sequence to obtain the edited blocks.

9. The method according to any one of claims 1 to 5, characterized in that: In response to the storage instruction, the blocks of the image to be processed corresponding to the editing instruction are loaded into the memory, the blocks are edited according to the editing instruction, and the target image is generated by using the edited blocks, including: In response to the storage instruction, a block of the image to be processed corresponding to the editing instruction is loaded into a memory, and a second pixel is determined from the block according to a first pixel in the preview image, wherein a position of the second pixel in the image to be processed is determined according to a position of the first pixel in the preview image and a scaling ratio, wherein the scaling ratio is a scaling ratio of the preview image generated according to the image to be processed; According to the editing instruction for editing the first pixel, the second pixel is edited to obtain an edited block, and the target image is generated using the edited block.

10. The method according to any one of claims 1 to 5, characterized in that: The method of generating a target image by using the edited blocks comprises: The edited blocks are used to replace the blocks at corresponding positions in the image to be processed to obtain the target image.

11. An electronic device, characterized in that: include: a receiving unit, configured to receive an editing instruction input by a user, wherein the editing instruction is used to edit a preview image, wherein the preview image is generated by processing the image to be processed according to the screen resolution of the electronic device, and the resolution of the preview image is lower than the resolution of the image to be processed; A processing unit, configured to edit the preview image in response to the editing instruction; A display unit, used for displaying the edited preview image; A storage unit, used for storing the editing instruction; The receiving unit is further used to receive a storage instruction input by a user; The processing unit is further configured to respond to the storage instruction, load the blocks of the image to be processed corresponding to the editing instruction into the memory, edit the blocks according to the editing instruction, and generate the target image using the edited blocks, wherein the blocks are obtained by dividing the image to be processed; The editing instruction is used to edit a local area of ​​the preview image, and the processing unit is specifically used to: Extracting corresponding blocks from the image to be processed according to the local area of ​​the preview image; Loading the blocks into a memory, and editing the blocks according to the editing instructions to obtain edited blocks; The target image is generated using the edited blocks.

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

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

14. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Image processing method and system

    CN103123718A

  • Method and system for synchronously processing and displaying mass images under ultrahigh resolution platform

    CN103995684A