Image processing method and electronic device
By providing a dynamic image editing interface on an electronic device, users can directly select and edit the static images in the dynamic image and save it, solving the cumbersome editing process in the prior art and improving user experience and efficiency.
Patent Information
- Application Number
- PCT/CN2024/083161
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-26
- Filing Date
- 2024-03-22
- Publication Date
- 2024-12-05
AI Technical Summary
The prior art is difficult to edit static images in dynamic images in an easy and efficient manner, and users need to perform tedious operations such as setting as covers, etc., which affects the user experience.
Provide an image processing method. By displaying the editing interface corresponding to the dynamic image, users can directly select and edit any static image in the dynamic image, and edit and save without additional operations, including displaying thumbnails and updating. Edit interface, screenshot and other technical means.
It realizes convenient and efficient editing and saving of static images in dynamic images, reducing user operation steps and improving user experience and efficiency.
Smart Images

Figure CN2024083161_05122024_PF_FP_ABST
Abstract
Description
Image processing method and electronic device
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on May 26, 2023, with application number 202310613144.3 and application name “A method and electronic device for image processing”, and the Chinese patent application filed with the China Patent Office on May 26, 2023, with application number 202310610328.4 and application name “A method and electronic device for image processing”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of electronic technology, and in particular to an image processing method and electronic equipment. Background Art
[0003] Currently, many electronic devices have the function of shooting dynamic images. Dynamic images can produce dynamic effects during playback, allowing users to experience wonderful visual effects.
[0004] In some application scenarios, users want to further edit dynamic images to obtain static images that meet their personalized needs. How to conveniently and efficiently implement the editing of dynamic images is an urgent problem that needs to be solved in the industry.
[0005] Summary of the Invention
[0006] The present application provides an image processing method and electronic device, which can conveniently and efficiently edit each static image frame in a dynamic image.
[0007] In a first aspect, the present application provides an image processing method, applied to an electronic device, the method comprising:
[0008] Displaying a first interface, the first interface including a first static image and a first control, the first static image corresponding to the first dynamic image, the first dynamic image including multiple frames of static images;
[0009] In response to a user operation on the first control, a first editing interface is displayed, the first editing interface including a first thumbnail, a second thumbnail, and a second static image, the first thumbnail and the second thumbnail being thumbnails corresponding to two static image frames in the first dynamic image, the first thumbnail being in a selected state, the first thumbnail corresponding to the second static image, the first static image and the second static image corresponding to the same static image frame in the first dynamic image, and the first editing interface also including a second control;
[0010] In response to a user operation on the second thumbnail, a third static image corresponding to the second thumbnail is displayed at the position of the second static image, with the second thumbnail being in a selected state;
[0011] In response to a user operation on the second control, a second editing interface is displayed, wherein the second editing interface includes a fourth static image and a third control, and the third static image and the fourth static image correspond to the same static image frame in the first dynamic image;
[0012] In response to a user operation on the fourth static image, displaying an editing effect of the fourth static image;
[0013] In response to a user operation on the third control, a first editing interface is displayed, which displays the editing effect of the fourth static image at the position of the third static image and the editing effect of the fourth static image at the position of the second thumbnail.
[0014] In an embodiment of the present application, after a user selects any static image from a dynamic image and selects a second control (such as a graffiti control), the electronic device can display a second editing interface for the user to edit, and then display the edited static image. In this method, the user does not need to perform additional operations such as setting the selected image as the cover, which reduces user operations and improves the user experience.
[0015] The editing effect of the fourth static image may be the display content after the editing effect is superimposed on the fourth static image, for example, the display content after graffiti traces or filters are superimposed on the fourth static image, or the display content after a portion of the fourth static image is cropped.
[0016] In combination with the first aspect, in some embodiments, the first editing interface includes a first save control; the method also includes: generating a target image based on the editing effect of the fourth static image in response to a user operation acting on the first save control; and saving the target image.
[0017] In the embodiment of the present application, the user can save the editing effect of the fourth static image as a static image based on the first save control in the first editing interface. This method can meet the user's need to save an edited static image.
[0018] In combination with the first aspect, in some embodiments, the method also includes: in response to a user operation on a first save control, displaying a first prompt box on the first editing interface, the first prompt box being used to indicate that the image is being saved; after saving the target image, displaying a second prompt box on the first editing interface, the second prompt box being used to indicate that the image has been successfully saved; and canceling the display of the second prompt box.
[0019] In an embodiment of the present application, the electronic device can display a prompt box during and after saving the target image; then, the prompt box can be canceled while the current interface, i.e., the first editing interface, remains displayed. Furthermore, the electronic device can reset the first editing interface and reselect a static image within the dynamic image for editing. This method can meet the user's need to edit multiple static images within a dynamic image, avoid the tedious operation of manually re-entering the current interface after exiting the current interface, and effectively improve the user experience.
[0020] In combination with the first aspect, in some embodiments, the second editing interface also includes a second save control, and the method also includes: when receiving a user operation acting on the second save control, generating a target image based on the editing effect of the fourth static image; saving the target image; and displaying the second interface after saving the target image, the second interface including the target image.
[0021] In an embodiment of the present application, the electronic device can exit the current interface, i.e., the first editing interface, after saving the target image, and then display the second interface including the target image. This method can meet the user's need to view the target image.
[0022] Optionally, the second interface may also include processing controls such as editing controls and sharing controls. Furthermore, the electronic device can process the target image in response to user operations on these processing controls, for example, sharing the target image in response to user operations on the sharing controls. This method can satisfy the user's need for further operations on the target image, reducing the user's need to exit the first editing interface and then enter the second interface from the gallery application, effectively improving the user experience.
[0023] In combination with the first aspect, in some embodiments, generating a target image includes: determining the position information of a fourth static image in a video corresponding to the first dynamic image based on the second thumbnail; obtaining the first image from the video based on the position information; improving the resolution of the first image to obtain the second image; and processing the second image based on the editing effect of the fourth static image to obtain the target image.
[0024] In an embodiment of the present application, the electronic device can obtain a fourth static image at a high resolution and perform editing on the fourth static image at a high resolution to achieve the same editing effect as the fourth static image. However, the resolution of the target image can be higher than the resolution of the editing effect of the fourth static image displayed on the screen. This method can save the higher-resolution image, allowing the user to view the higher-resolution image when subsequently viewing or processing the image, thereby improving the user experience.
[0025] In combination with the first aspect, in some embodiments, displaying the second editing interface includes: taking a screenshot of the location area where the third static image is displayed to obtain a fourth static image.
[0026] In an embodiment of the present application, when the electronic device jumps from the first editing interface to the second editing interface, it can take a screenshot of the area where the third static image is displayed, thereby obtaining a fourth static image. Because the screenshot speed is faster than the speed of re-acquiring the third static image, this method can quickly display the second editing interface, reducing the time the user waits for the interface to be displayed, thereby improving the user experience.
[0027] In combination with the first aspect, in some embodiments, the first editing interface includes a reset control; the method also includes: in response to a user operation on the reset control, displaying the first editing interface, the first editing interface including a first thumbnail, a second thumbnail and a second static image, and the first thumbnail is selected.
[0028] In an embodiment of the present application, the electronic device can reset the first editing interface and then reselect a static image within the dynamic image for editing. This method can meet the user's need to edit multiple static images within a dynamic image, avoid the tedious operation of manually re-entering the current interface after exiting the current interface, and effectively improve the user experience. In conjunction with the first aspect, in some embodiments, the first static image is the cover image of the first dynamic image.
[0029] In conjunction with the first aspect, in some embodiments, the electronic device saves the target image, including:
[0030] Obtaining a storage path, an initial exchangeable image file Exif, and initial database information corresponding to the first dynamic image; the initial Exif includes parameters of the first dynamic image, including time;
[0031] The electronic device obtains a storage path corresponding to the target image based on the storage path corresponding to the first dynamic image and the current time;
[0032] Based on the storage path corresponding to the target image, create a target file corresponding to the target image;
[0033] Modify the time in the initial Exif to the current time to get the target Exif;
[0034] Write the target Exif and target image to the target file;
[0035] Update the initial database information with the file information of the target image to obtain the target database information; the file information of the target image includes the storage path corresponding to the target image and the creation time of the target file;
[0036] Save the target database information to the database.
[0037] In an embodiment of the present application, the electronic device can generate target image data based on the data of the first dynamic image. This method modifies the data of the first dynamic image, which is faster than regenerating the target image data, and can increase the speed of saving the target image.
[0038] In combination with the first aspect, in some embodiments, displaying the first editing interface includes: acquiring a video corresponding to the first dynamic image; and decoding the video through a codec module to obtain multiple frames of static images.
[0039] In combination with the first aspect, in some embodiments, the second control is any one of a crop control, a graffiti control, a watermark control, a filter control, a text control, a mosaic control, a blur control, a photo frame control, and a retain color control.
[0040] In the embodiment of the present application, the specific function of the second control is not limited. The electronic device can perform any editing operation on any frame image in the first dynamic image. This method can meet the personalized needs of users and effectively improve user experience.
[0041] In a second aspect, the present application provides an image processing method, applied to an electronic device, the method comprising:
[0042] Displaying a first interface, the first interface including a first static image and a first control, the first static image corresponding to the first dynamic image, the first dynamic image including multiple frames of static images;
[0043] In response to a user operation on the first control, a first editing interface is displayed, the first editing interface including a first thumbnail, a second thumbnail, and a second static image, the first thumbnail and the second thumbnail being thumbnails corresponding to two static image frames in the first dynamic image, the first thumbnail being in a selected state, the first thumbnail corresponding to the second static image, the first static image and the second static image corresponding to the same static image frame in the first dynamic image, and the first editing interface also including a second control;
[0044] In response to a user operation on the second thumbnail, a third static image corresponding to the second thumbnail is displayed at the position of the second static image, with the second thumbnail being in a selected state;
[0045] In response to a user operation on the second control, a third static image is saved.
[0046] In an embodiment of the present application, after a user selects any static image from a dynamic image, the electronic device can save any static image in response to the user's operation. In this method, the user does not need to perform additional operations such as setting the selected image as the cover, which reduces user operations and improves the user experience.
[0047] In conjunction with the second aspect, in some embodiments, the method further includes:
[0048] In response to a user operation on the second control, displaying a first prompt box on the first editing interface, the first prompt box being used to indicate that the image is being saved;
[0049] After the third static image is saved, a second prompt box is displayed on the first editing interface, where the second prompt box is used to indicate that the image has been successfully saved;
[0050] Cancel the display of the second prompt box.
[0051] In an embodiment of the present application, the electronic device can display a prompt box during and after saving the third static image. Furthermore, the prompt box can be canceled while the current interface, i.e., the first editing interface, remains displayed. Furthermore, the electronic device can reselect a static image within the dynamic image for operations such as saving or editing. This method can meet the user's need to edit multiple static images within a dynamic image, avoid the tedious operation of manually re-entering the current interface after exiting the current interface, and effectively improve the user experience.
[0052] In conjunction with the second aspect, in some embodiments, the method further includes:
[0053] After the third static image is saved, a second interface is displayed, where the second interface includes the third static image.
[0054] In conjunction with the second aspect, in some embodiments, saving the third static image includes:
[0055] Determining, based on the second thumbnail, position information of the third static image in the video corresponding to the first dynamic image;
[0056] Acquire a first image from the video based on the position information;
[0057] Improving the resolution of the first image to obtain a second image;
[0058] Save the second image.
[0059] In an embodiment of the present application, the electronic device can save a third static image at a higher resolution. The resolution of the saved third static image can be higher than the third static image currently displayed on the interface. This method can save a higher-resolution image, allowing the user to view the higher-resolution image when subsequently viewing or processing the image, thereby improving the user experience.
[0060] In conjunction with the second aspect, in some embodiments, the first editing interface further includes a third control; and the method further includes:
[0061] In response to a user operation on the third control, a second editing interface is displayed, wherein the second editing interface includes a fourth static image and a fourth control, and the third static image and the fourth static image correspond to the same static image frame in the first dynamic image;
[0062] In response to a user operation on the fourth static image, displaying an editing effect of the fourth static image;
[0063] In response to a user operation on the fourth control, a first editing interface is displayed, which displays the editing effect of the fourth static image at the position of the third static image and the editing effect of the fourth static image at the position of the second thumbnail.
[0064] In an embodiment of the present application, after a user selects any static image from a dynamic image and selects a second control (such as a graffiti control), the electronic device can display a second editing interface for the user to edit, and then display the edited static image. In this method, the user does not need to perform additional operations such as setting the selected image as the cover, which reduces user operations and improves the user experience.
[0065] The editing effect of the fourth static image may be the display content after the editing effect is superimposed on the fourth static image, for example, the display content after graffiti traces or filters are superimposed on the fourth static image, or the display content after a portion of the fourth static image is cropped.
[0066] In conjunction with the second aspect, in some embodiments, the second editing interface further includes a fifth control, and the method further includes:
[0067] When a user operation acting on the fifth control is received, generating a target image based on the editing effect of the fourth static image;
[0068] Save the target image;
[0069] After the target image is saved, a third interface is displayed, where the third interface includes the target image.
[0070] In an embodiment of the present application, the electronic device can exit the current interface, i.e., the first editing interface, after saving the target image, and then display a third interface including the target image. This method can meet the user's need to view the editing effect of the fourth static image.
[0071] In conjunction with the second aspect, in some embodiments, the first editing interface includes a reset control; and the method further includes:
[0072] In response to a user operation on a reset control, a first editing interface is displayed, the first editing interface including a first thumbnail, a second thumbnail, and a second static image, and the first thumbnail is in a selected state.
[0073] In the embodiment of the present application, the electronic device can reset the first editing interface, and then reselect a static image within a dynamic image for editing, saving, and other operations. This method can meet the user's needs for operating multiple static images within a dynamic image, avoid the tedious operation of manually re-entering the current interface after exiting the current interface, and effectively improve the user experience.
[0074] In combination with the second aspect, in some embodiments, the first static image is a cover image of the first dynamic image.
[0075] In conjunction with the second aspect, in some embodiments, the electronic device saves the third static image, including:
[0076] Obtaining a storage path, an initial exchangeable image file Exif, and initial database information corresponding to the first dynamic image; the initial Exif includes parameters of the first dynamic image, including time;
[0077] The electronic device obtains a storage path corresponding to the third static image based on the storage path corresponding to the first dynamic image and the current time;
[0078] creating a target file corresponding to the third static image based on the storage path corresponding to the third static image;
[0079] Modify the time in the initial Exif to the current time to get the target Exif;
[0080] Write the target Exif and the third static image to the target file;
[0081] Update the initial database information with the file information of the third static image to obtain the target database information; the file information of the third static image includes the storage path corresponding to the third static image and the creation time of the target file;
[0082] Save the target database information to the database.
[0083] In an embodiment of the present application, the electronic device can generate data for a third static image based on data for the first dynamic image. This method modifies the data for the first dynamic image faster than regenerating the data for the third static image, thereby increasing the speed of saving the third static image.
[0084] In conjunction with the second aspect, in some embodiments, displaying the first editing interface includes:
[0085] Obtaining a video corresponding to the first dynamic image;
[0086] The video is decoded through the codec module to obtain multiple frames of static images.
[0087] In combination with the second aspect, in some embodiments, the second interface is a large image interface corresponding to the third static image in the gallery application of the electronic device, and the second interface includes at least one of an editing control, a collection control, a sharing control, and a deletion control.
[0088] In an embodiment of the present application, the electronic device can process the third static image in response to a user operation on at least one of the aforementioned edit control, favorite control, share control, and delete control. For example, in response to a user operation on the aforementioned share control, the electronic device can share the third static image. This method can satisfy the user's need to perform further operations on the third static image, reduce the user's need to exit the first editing interface and then enter the second interface from the gallery application, and effectively improve the user experience.
[0089] In a third aspect, the present application provides an electronic device comprising one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code comprises computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in the first aspect and any possible implementation method of the first aspect.
[0090] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions to enable the electronic device to execute the method described in the first aspect and any possible implementation method of the first aspect.
[0091] In a fifth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect and any possible implementation of the first aspect.
[0092] In a sixth aspect, the present application provides a computer program product comprising instructions, which, when the computer program product is run on an electronic device, enables the electronic device to execute the method described in the first aspect and any possible implementation of the first aspect.
[0093] It is understandable that the electronic device provided in the third aspect, the chip system provided in the fourth aspect, the computer storage medium provided in the fifth aspect, and the computer program product provided in the sixth aspect are all used to perform the methods provided in this application. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects of the corresponding methods and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] 1A to 1D exemplarily illustrate user interfaces for enabling an "edit" function for any static image in a dynamic image;
[0095] 2A to 2K exemplarily illustrate user interfaces of an electronic device when graffiti is performed on a static image in a dynamic image;
[0096] 3A to 3C exemplarily illustrate user interfaces of an electronic device when cropping a static image from a dynamic image;
[0097] FIG4 is a flow chart of an image processing method provided by an embodiment of the present application;
[0098] FIG5 is a file format structure diagram of a dynamic image provided by an embodiment of the present application;
[0099] FIG6A is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0100] FIG6B is a schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
[0101] 7 and 8 are flow charts of the image processing method provided in the embodiments of the present application;
[0102] 9 and 10A to 10D exemplarily illustrate user interfaces when an electronic device saves a static image in a dynamic image;
[0103] FIG11 is a flowchart of an image processing method provided in an embodiment of the present application;
[0104] FIG12 is a diagram showing a file format structure of a dynamic image provided by an embodiment of the present application;
[0105] 13 and 14 are flow charts of the image processing method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0106] The terms used in the following examples of the present application are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular expressions "a," "an," "said," "above," "the," and "this" are intended to include plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in the present application refers to and encompasses any or all possible combinations of one or more of the listed items.
[0107] Currently, many electronic devices have the function of shooting dynamic images, where dynamic images can also be called dynamic photos.
[0108] For example, if the shooting interface of the camera application of the electronic device includes a control for turning on dynamic images, then the electronic device can turn on the function of shooting dynamic images in response to a user operation of clicking the control; further, when the electronic device detects a user operation instructing to shoot, the electronic device can shoot a dynamic image in response to the user operation. In the embodiment of the present application, there is no limit on the number of frames and duration of the dynamic image. For example, the duration of the dynamic image can include 3 seconds, which is 1.5 seconds before and 1.5 seconds after the moment when the electronic device detects the user operation instructing to shoot. The dynamic image is composed of static images captured by the electronic device during these 3 seconds, and can be 90 frames.
[0109] In some application scenarios, users may need to capture and edit a static frame within a dynamic image due to their individual needs. For example, when capturing a close-up of a person in a dynamic image, the user may be satisfied with a specific frame and wish to save it separately. Another example is when capturing a moving object in a dynamic image, the user may wish to perform text editing or other operations on a specific frame within the image.
[0110] Currently, electronic devices need to set a static image selected by a user from a dynamic image as a cover image before the image can be saved, edited, etc. This method results in numerous operations for the user and a poor user experience.
[0111] In view of this, an embodiment of the present application provides an image processing method that can improve the efficiency of processing static images in dynamic images. The processing includes two parts: editing and saving. These two parts are introduced separately below.
[0112] (1) Editorial section
[0113] In an embodiment of the present application, an electronic device can display a first editing interface corresponding to a dynamic image; a user can select a target frame from the first editing interface and trigger a first edit of the target frame. Accordingly, in response to the user operation of selecting the target frame from the dynamic image for the first edit, the electronic device displays a second editing interface for the first edit of the target frame; in response to the user operation on the second editing interface, the target frame is edited on the second editing interface and the edited target frame is displayed. In this method, the user can select any static image frame of the dynamic image for editing, which reduces user operation and improves the user experience.
[0114] The electronic device is an electronic device with a display service, such as a smart phone, a tablet computer, a large-screen device, etc. The image processing method provided in the embodiment of the present application can be embodied as an "editing" function on the electronic device.
[0115] First, the embodiment of the present application is described in conjunction with a user interface (UI) provided on an electronic device to provide an "editing" function for any static image in a dynamic image.
[0116] FIG1A to FIG1D exemplarily illustrate the UI for enabling the “Edit” function for any static image in a dynamic image.
[0117] FIG1A exemplarily illustrates a user interface 11 according to an embodiment of the present application. This user interface 11 is an example of an application interface for a gallery application provided in this embodiment of the present application. This user interface 11 includes a thumbnail 110 of a first dynamic image. Optionally, this user interface 11 may also include static images and videos, etc., which are not limited herein.
[0118] Among them, a dynamic image refers to an image with a dynamic effect. The dynamic effect can be reflected as a dynamic effect generated by switching the display or video playback of multiple static images according to preset rules; a static image is an image with a static picture. In an embodiment of the present application, a dynamic image may include a static image (such as a cover image) and a video (such as an MP4 file). For example, when an electronic device displays a dynamic image, it can display the cover image of the dynamic image when it does not receive user operation, and display the video corresponding to the dynamic image when it receives user operation (such as a long press operation).
[0119] It should be noted that the dynamic image includes a video, that is, the dynamic image may include multiple frames of static images obtained based on the video.
[0120] The cover image may also be referred to as a cover frame. For example, the cover image has the same content as a frame of image in the video, but has a different resolution.
[0121] As shown in FIG. 1A , the electronic device may detect a user operation instructing to display a thumbnail 110 , and in response to the operation, the electronic device may display a user interface 12 as shown in FIG. 1B .
[0122] Figure 1B illustrates an exemplary preview interface corresponding to a first dynamic image provided in an embodiment of the present application. As shown in Figure 1B , the preview interface may include an identifier 120A, parameters 120B, a preview window 121, and an edit control 122. It should be noted that the preview interface corresponding to the first dynamic image may also be referred to as the first interface, and the edit control 122 may also be referred to as the first control.
[0123] Among them, identifier 120A is used to indicate that the image currently displayed on the interface is a dynamic image; parameter 120B is used to display information such as the shooting parameters of the image currently displayed on the interface; preview window 121 is used to display the first dynamic image. For example, preview window 121 plays a dynamic image in a loop, that is, the image displayed in preview window 121 may not be static; editing control 122 is used to edit the first dynamic image. Optionally, the preview interface may also include sharing controls and collection controls, etc., which are not limited in this embodiment of the application.
[0124] As shown in Figure 1B, when the electronic device detects a user operation on the editing control 122, it can respond to the user operation by opening the editing function for the first dynamic image and displaying the editing interface corresponding to the first dynamic image. For example, when the electronic device detects the user operation, it can display the user interface 13 shown in Figure 1C, that is, the user interface 13 is the editing interface corresponding to the first dynamic image. It should be noted that the editing interface corresponding to the first dynamic image (that is, the user interface 13) can also be referred to as the first editing interface.
[0125] The user interface 13 includes a preview window 131, a Set as Cover control 132, a Save as control 133 (also referred to as a first save control), a slider 134, an options bar 135, and a Return control 136. The image displayed in the preview window 131 may be the cover image of the first dynamic image, and the thumbnail 134a selected in the slider 134 is the thumbnail corresponding to the cover image. The cover image may be any frame in the first dynamic image, which is not limited in this embodiment of the present application.
[0126] The slider 134 is used to display thumbnails of the static images in the dynamic image (i.e., the first dynamic image) in the preview window 131, such as the thumbnail 134a corresponding to the cover image and the thumbnail 134b of the first static image shown in Figure 1C; Figure 1C exemplarily shows 6 frames of static images in the user interface 13. The embodiment of the present application does not limit the number of images displayed by the slider, and it can also be 10 frames, etc.
[0127] Optionally, the image in the slider 134 can be displayed by sliding in response to user operation. For example, the slider 134 in the user interface 13 can only display thumbnails of partial static images of the first dynamic image. When the electronic device detects a left sliding operation on the slider 134, the slider 134 can display thumbnails of static images not shown in Figure 1B.
[0128] In the embodiment of the present application, a bold border is used to represent the image currently selected in the slider. For example, a user can select a thumbnail from the slider, and the thumbnail can be displayed with a bold border to indicate the selected state.
[0129] Optionally, when the user does not perform a selection operation on the slider, such as when the interface entered after clicking the above-mentioned editing control 122 receives the user's selection operation, the thumbnail in the selected state can be a thumbnail corresponding to a preset static image, such as a thumbnail corresponding to a cover image. As shown in Figure 1C, the border of thumbnail 134a corresponding to the cover image in slider 134 is bold, that is, the image selected in slider 134 is thumbnail 134a corresponding to the cover image. In other embodiments of the present application, a color image can also be used to represent the selected image, and a grayscale static image can be used to represent the unselected image. This embodiment of the present application is not limited to this.
[0130] The preview window 131 is used to display the static image selected from the dynamic image. As shown in FIG1C , the image selected in the slide bar 134 is the thumbnail 134 a corresponding to the cover image, and the image displayed in the preview window 131 is the cover image.
[0131] The Set as Cover control 132 is used to set the image displayed in the preview window 131 as the cover image of the static image.
[0132] The save as control 133 is used to save the image displayed in the preview window 131 as a static image in the gallery.
[0133] The options bar 135 may include a dynamic image homepage option 135a and various editing options, including a crop option 135b and a graffiti option 135c. The present embodiment does not limit the specific content and number of editing options. The editing options may also be referred to as the second control, and the dynamic image homepage option 135a may be referred to as the third control.
[0134] In this embodiment, boldface indicates the selected option interface in option bar 135, which is the current interface. As shown in FIG1C , the dynamic image homepage option 135a in option bar 135 is in boldface, indicating that dynamic image homepage option 135a is selected and the current user interface 13 is the editing interface corresponding to the dynamic image.
[0135] The return control 136 is used to display the previous interface of the current interface. For example, when the electronic device detects a user operation on the return control 136, it can display the user interface 12 shown in Figure 1B in response to the user operation. It should be noted that in some embodiments of the present application, after the cover image of the dynamic image is modified, the preview window 121 in the user interface 12 shown in Figure 1B can display the modified dynamic image.
[0136] In some embodiments, the user can select any static image frame in the first dynamic image using a slider (such as slider 142 ) in an editing interface (such as user interface 14 ) corresponding to the first dynamic image.
[0137] As shown in FIG1C , upon detecting a user operation of sliding to the thumbnail 134 b of the first static image, the electronic device may, in response to the user operation, display an editing interface corresponding to the first static image, such as the user interface 14 shown in FIG1D . It should be noted that the above-described sliding operation is merely an exemplary implementation, and may also be a click or voice operation. For example, upon detecting a user operation of clicking the thumbnail 134 b of the first static image, the electronic device may display the editing interface corresponding to the first static image.
[0138] It should be noted that in the embodiment of the present application, any one of the user operations can be a user's touch operation (such as a click operation, a long press operation, an up-swipe operation, a down-swipe operation, or a side-swipe operation), or a non-contact operation (such as an air gesture), or a user's voice command. The embodiment of the present application does not impose any specific restrictions on this.
[0139] User interface 14 includes a preview window 141, a slider 134, a Set as Cover control 132, a Save as control 133, an options bar 135, and a Back control 136. The selected static image in slider 134 is a thumbnail 134b of the first static image, and the image displayed in preview window 141 is the first static image. Thumbnail 134a corresponding to the cover image in slider 134 is unselected. User interface 14 differs from user interface 13 in that the selected image in slider 134 is different, and the displayed content in preview window 131 and preview window 141 is different.
[0140] The method of turning on the "editing" function of the electronic device for the static image in the dynamic image as shown in Figures 1A-1D can also be used by other methods to turn on the "editing" function, such as long pressing the dynamic image to turn on the "editing" function, and long pressing any frame in the dynamic image to turn on the "editing" function for the frame.
[0141] In some embodiments, after the electronic device turns on the editing function for a static image frame in a dynamic image, it can perform editing operations such as graffiti, cropping, filtering, and watermarking on the static image.
[0142] The following description takes the graffiti function as an example.
[0143] Please refer to FIG. 2A to FIG. 2K , which exemplarily show UI diagrams involved when an electronic device graffiti on a static image in a dynamic image.
[0144] FIG2A is a user interface 14 for editing a first static image 1410 in a first dynamic image, exemplarily shown in an embodiment of the present application. The user interface 14 includes a slider 134 and a preview window 141. The image selected in the slider 134 is a thumbnail 134b of the first static image 1410, and the image displayed in the preview window 141 is the first static image 1410.
[0145] As shown in Figure 2A, when the electronic device detects a user operation on the graffiti option 135c, it can respond to the operation by displaying the user interface 21 shown in Figure 2B. It should be understood that, in this exemplary description, the second control is the graffiti option 135c, and the user interface 21 is the second editing interface corresponding to the second control.
[0146] The user interface 21 includes an editing window 211, a graffiti function area 212, an option bar 213, a save control 214 (also referred to as a second save control) and a return control 215.
[0147] The editing window 211 is used to display the first static image 1410 and a graffiti effect of graffiti on the first static image 1410 .
[0148] The graffiti function area 212 includes multiple graffiti function controls, such as a straight line control, a pencil setting, and an eraser, etc., which are not limited in this embodiment of the present application.
[0149] The options bar 213 includes a selected option (i.e., the graffiti option 213c) and unselected options (such as the dynamic image homepage option 213a, the cropping option, and the filter option). In FIG2B , the graffiti option 213c is in bold, indicating that the graffiti option 213c is the selected option, that is, indicating that the current interface (i.e., the user interface 22) is an interface for graffiti on a static image. It can be understood that the interface when the graffiti option is in bold is a graffiti interface for the image in the preview window, which is used to perform graffiti operations on the image in the preview window. For example, the user interface 21 is a graffiti interface for the first static image 1410.
[0150] The return control 215 is used to return to the preview interface corresponding to the first dynamic image. When the electronic device detects a user operation on the return control 215, it can display the user interface 12 as shown in FIG1B.
[0151] In some embodiments, the user can doodle on the first static image 1410 in the editing window 211 using the doodle function in the doodle function area 212. As shown in FIG2B , upon detecting a doodle operation (e.g., a line with an arrow) on the editing window 211, the electronic device can display the user interface 22 shown in FIG2C in response to the doodle operation.
[0152] It should be noted that in the embodiment of the present application, the first static image 1410 may also be referred to as the fourth static image, and the aforementioned graffiti operation is a user operation performed on the fourth static image. The number of user operations performed on the fourth static image is not limited herein, and may be performed by one user or multiple users. For example, the aforementioned graffiti operation may include a user operation of selecting a graffiti function control in the graffiti function area 212 and a user operation of graffiti in the editing window 211.
[0153] The user interface 22 includes an editing window 221, a graffiti function area 212, an option bar 213, a save control 214, and a return control 215. Among them, the editing window 221 is used to display the static image after graffiti. The difference between the user interface 22 and the user interface 21 can be that the images displayed in the editing window are different. It should be noted that in the embodiment of the present application, the first static image 1410 can also be referred to as the fourth static image. Then, the content displayed in the editing window 221 is the editing effect of the fourth static image, specifically the first static image 1410 with graffiti traces.
[0154] In some embodiments, after the user graffiti the static image in the dynamic image, the user can instruct the electronic device to save the static image after graffiti through user operation. The specific process of the electronic device saving the static image after graffiti can be referred to the relevant content of the following embodiments.
[0155] In one implementation, after graffitiing a static image in a dynamic image, the electronic device can display the graffitied static image in the editing interface corresponding to the dynamic image in response to a user operation of returning to the editing interface corresponding to the dynamic image; further, when receiving a user operation of saving the graffitied static image as a picture, the graffitied static image is saved.
[0156] As shown in FIG2C , when the electronic device detects a user operation on the dynamic image homepage option 213a in the user interface 22, it displays the user interface 23 shown in FIG2D . The user interface 23 includes a preview window 231 and a slider 232. The preview window 231 displays the static image after the graffiti, and the image selected in the slider 232 is also a thumbnail 232b of the static image after the graffiti. Optionally, the unselected image in the slider 232 can be in a closed state, for example, it cannot be touched.
[0157] It should be noted that the selected state is exemplarily indicated by a bold border in Figure 2D. In other embodiments of the present application, the thumbnail in the selected state can also be displayed in grayscale, or the thumbnail in the selected state can be displayed in color while the thumbnails in other unselected states can be displayed in gray. The embodiments of the present application are not limited to this.
[0158] Furthermore, when the electronic device detects a user operation on the Save As control 133, it can save the static image after graffiti in response to the user operation, and display the user interface 24 as shown in Figure 2E during the saving process. The user interface 24 includes a prompt box 240, and the prompt box 240 is used to prompt that the static image after graffiti is currently being saved. For example, the content of the prompt box 240 can be "Saving"; after successful saving, the user interface 25 as shown in Figure 2F is displayed. The user interface 25 may include a prompt box 250, and the prompt box 250 is used to prompt that the static image after graffiti has been successfully saved. For example, the content of the prompt box 250 can be "Saved to the gallery". Among them, except for the prompt box, the other display contents of the user interface 24 and the user interface 25 can be the same as the user interface 23, which will not be repeated here. Among them, the prompt box 240 can also be called the first prompt box; the prompt box 250 can also be called the second prompt box.
[0159] Furthermore, the electronic device may not display the prompt box 250 after displaying the prompt box 250 for a preset time, and display the user interface 23. That is to say, after the electronic device saves a static image frame in the dynamic image as a picture through the save control in the editing interface corresponding to the dynamic image, the electronic device does not exit the display of the current interface. Furthermore, the user can continue to edit the static image in the dynamic image in the current interface (i.e., the editing interface corresponding to the dynamic image). It can be understood that this method can meet the user's need to edit multiple static images in the dynamic image, and can improve the user experience.
[0160] Optionally, when the electronic device detects a user operation on the save control 133, it may save the static image after graffiti in response to the user operation, and not display the user interface 24 shown in Figure 2E and the user interface 25 shown in Figure 2F, but still display the current interface (such as user interface 23).
[0161] In another implementation, after graffiti is performed on a static image in a dynamic image, the electronic device may save the static image after graffiti in response to a save operation performed on a graffiti interface for the static image.
[0162] As shown in FIG2G , when the electronic device detects a user operation on the save control 214 in the user interface 22, it saves the graffiti image (hereinafter referred to as the graffiti image for ease of description), i.e., the image in the editing window 221, and then displays a preview interface corresponding to the graffiti image, such as the user interface 26 shown in FIG2H . The user interface 26 includes a preview window 261 and other controls, wherein the preview window is used to display the graffiti image.
[0163] In the embodiment of the present application, after the electronic device saves the edited image, it jumps to the large image interface of the image. Then, the user can edit or share the image. This method can meet the user's needs for processing the saved image and improve the user experience. Among them, the large image interface (such as user interface 26) to which the electronic device jumps after saving the edited image can also be called the second interface.
[0164] It should be noted that the resolution of the graffiti image displayed in the preview window of the electronic device and the saved graffiti image can be different. For example, the electronic device can increase the resolution of the graffiti image displayed in the preview window and then save the graffiti image with the increased resolution. In the embodiment of the present application, the high-resolution image is saved and the high-resolution image can be displayed when the user views the graffiti image, which can improve the user experience.
[0165] For example, the image displayed in the editing window 221 of the user interface 22 shown in FIG2G has a different resolution than the image displayed in the preview window 261 of the user interface 26 shown in FIG2H , with the image displayed in the user interface 26 having a higher resolution. The electronic device may obtain a graffiti image with a higher resolution as described in the relevant embodiments below and will not be elaborated on here.
[0166] In other embodiments of the present application, after the user graffiti the static image in the dynamic image, the user can abandon the graffiti operation and return to the preview interface. As shown in Figure 2I, when the electronic device detects a user operation on the return control 215 in the user interface 22, in response to the user operation, the electronic device can display the user interface 27 shown in Figure 2J. The user interface 27 includes an editing window 221, a graffiti function area 212, an option bar 213, a save control 214, a return control 215 and a prompt box 270. The prompt box 270 includes a confirmation control 270A and a cancel control 270B. If the electronic device detects a user operation on the confirmation control 270A, the electronic device can display the user interface 12 shown in Figure 1B; if the electronic device detects a user operation on the cancel control 270B, the electronic device can display the user interface 22 shown in Figure 2I.
[0167] In some embodiments, after the electronic device saves the graffiti image, when the user opens the gallery application, the electronic device displays a thumbnail of the graffiti image. For example, when the electronic device receives a user operation of clicking the Save As control 133 as shown in FIG2C or a user operation of clicking the Save control 214 as shown in FIG2G , the electronic device saves the graffiti image; after the electronic device saves the graffiti image, if the user receives a user operation of opening the gallery, the electronic device may display a user interface 28 as shown in FIG2K . The user interface 28 includes a thumbnail 280 corresponding to the graffiti image and a thumbnail 110 corresponding to the first dynamic image. The difference between the user interface 28 and the user interface 11 may be that the thumbnail 280 is added to the user interface 28, and the position of the thumbnail 110 in the two interfaces is different.
[0168] The following description takes the cropping function as an example.
[0169] Please refer to FIG. 3A to FIG. 3C , which exemplarily show UI diagrams involved when an electronic device crops a static image in a dynamic image.
[0170] FIG3A is a user interface 14 for editing a first static image in a first dynamic image, exemplarily shown in an embodiment of the present application. The user interface 14 includes a slider 134 and a preview window 141. The image selected in the slider 134 is a thumbnail 134b of the first static image, and the image displayed in the preview window 141 is the first static image.
[0171] As shown in Figure 3A, when the electronic device detects a user operation on the cropping option 135b, in response to the operation, it may display the user interface 31 shown in Figure 3B. The user interface 31 is a cropping interface for the first static image.
[0172] The user interface 31 may include a save control 311, a cropping window 312, a cropping function area 313, an option bar 314, and a return control 315.
[0173] The save control 311 is used to save the cropped image.
[0174] The cropping window 312 is used to display the cropping process.
[0175] The cropping function area 313 includes multiple cropping function controls, such as free adjustment controls, original scale controls, and rotation controls, which are not limited in the embodiment of the present application.
[0176] The options bar 314 includes a selected option (i.e., the crop option 314b) and unselected options (e.g., the dynamic image homepage option 314a, the graffiti option 314c, and the filter option 314d). In FIG3B , the selected crop option 314b indicates that the current interface (i.e., the user interface 32) is an interface for cropping a static image.
[0177] The return control 215 is used to return to the preview interface corresponding to the first dynamic image. When the electronic device detects a user operation on the return control 215, it can display the user interface 12 as shown in FIG1A.
[0178] In some embodiments, the user can crop a static image within the cropping window 312 by setting a cropping function area 313. As shown in FIG2B , the electronic device can detect a user operation on the cropping window 312 and, in response to the operation, display the user interface 32 shown in FIG3C .
[0179] It should be noted that, in the embodiment of the present application, the image displayed in the cropping window 312 may also be referred to as the fourth static image, and the user operations acting on the cropping window 312 are user operations acting on the fourth static image. The number of user operations acting on the fourth static image is not limited herein, and may be one user operation or multiple user operations. For example, the user operations acting on the cropping window 312 may include user operations such as selecting a cropping function control in the cropping function area 313 and performing cropping operations within the cropping window 312.
[0180] The user interface 32 includes a cropping window 320, a save control 311, a cropping function area 313, an option bar 314, and a return control 315. The cropping window 320 is used to display the cropped image. The difference between the user interface 23 and the user interface 22 may lie in the different images displayed in the cropping window. It should be noted that in the embodiment of the present application, the image displayed in the cropping window 312 may also be referred to as the fourth static image. In this case, the content displayed in the editing window 221 is the editing effect of the fourth static image, specifically, the cropped portion of the image displayed in the cropping window 312.
[0181] In some embodiments, after cropping a static image, the user can instruct the electronic device to save the cropped static image through user operation. The user interface used by the electronic device in saving the cropped static image can refer to the user interface used in saving the graffitied static image described above, and will not be described in detail here. In embodiments of the present application, the saved cropped static image after graffiti can be referred to as the target image.
[0182] Based on the user interface displayed on the above-mentioned electronic device, the image processing method provided in the embodiment of the present application is introduced below.
[0183] FIG4 shows an image processing method provided by an embodiment of the present application. The method includes some or all of the following steps:
[0184] Step S401: In response to a first user operation indicating display of a first dynamic image, the electronic device displays a preview interface corresponding to the first dynamic image, the preview interface including a preview area and an editing control, the preview area is used to display the first dynamic image, and the editing control is used to edit the first dynamic image.
[0185] In some embodiments, the electronic device can display an application interface of a gallery application (such as the user interface 11 shown in Figure 1A), which application interface includes a thumbnail of the first dynamic image (such as the thumbnail 110 in the user interface 11); when the electronic device detects a user operation on the thumbnail, it responds to the user operation by displaying a preview interface corresponding to the first dynamic image (such as the user interface 12 as shown in Figure 1B), which preview interface includes a preview area (such as the preview window 121 in the user interface 12) and an editing control (such as the editing control 122 in the user interface 12), the preview area is used to display the first dynamic image, and the editing control is used to edit the first dynamic image.
[0186] The first dynamic image may be a static image, a dynamic image, or a video.
[0187] Please refer to Figure 5, which is a file format structure diagram of a dynamic image provided by an embodiment of the present application. As shown in Figure 5, the file format of the dynamic image may include three fields. The first field is a JPEG image, which is the cover image of the dynamic image. The second field is the mixed video data, for example, an mp4 file. The third field is the description field (TAG) of the dynamic image, and the third field may include three subfields, wherein the first subfield is the version number (version), for example, if the current version is the second version, the version number may be v2; the second subfield includes the start time (start) and duration (duration), that is, the second subfield is used to record the start time and duration of playback during gallery preview, and the start time (start) is the time point in the video when the first frame is played during gallery preview; the third subfield is used to record the file length of the video data, and the file length of the video data may also be referred to as the video byte stream length.
[0188] Among them, the file length of the video data is used to determine the position information of the video in the file, and the position information may include the starting position and the ending position; the video offset is the sum of the length of the second field (that is, the file length of the video data) and the length of the third field. Based on the video offset, the starting position of the video in the file can be determined; based on the video offset and the length of the video byte stream, the ending position of the video in the file can be determined.
[0189] Step S402: The electronic device displays a first editing interface corresponding to the first dynamic image in response to a second user operation on the editing control. The first editing interface includes a sliding bar and a preview window. The sliding bar is used to determine the image to be edited in the first dynamic image, and the preview window is used to display the image to be edited.
[0190] The first editing interface is used to process the first dynamic image, wherein the processing includes updating the cover image of the first dynamic image, editing any static image frame in the first dynamic image, etc.
[0191] In some embodiments, upon detecting the second user operation, the electronic device displays the first editing interface in the initial state. The image to be edited in the first editing interface in the initial state may be a frame of the first dynamic image, a cover image, or a preset frame. For example, the preview window in the first editing interface in the initial state displays the cover image of the first dynamic image, and the slider in the first editing interface in the initial state also displays the cover image.
[0192] Optionally, the editing interface corresponding to the first dynamic image may also include at least one editing option and other controls, wherein at least one editing option includes a first editing option, and the first editing option is used to perform a first edit on the selected image, wherein the first edit can be graffiti, cropping, filters, watermarks, etc.
[0193] Exemplarily, the editing interface corresponding to the first dynamic image can refer to the user interface 13 shown in Figure 1C and the user interface 14 shown in Figure 1D above, wherein user interface 13 is the first editing interface in the initial state, and user interface 14 is the first editing interface after the user reselects the static image in the first dynamic image; the above-mentioned preview window can refer to the relevant introduction of preview window 131, the sliding bar can refer to the relevant introduction of sliding bar 134, and at least one editing option can refer to the relevant introduction of option bar 135.
[0194] In some embodiments, when the electronic device detects a second user operation on the editing control, the electronic device determines whether the image on the current interface is a dynamic image in response to the user operation. If the image is a dynamic image, the electronic device initializes the editing interface corresponding to the dynamic image. It is understood that the editing interfaces corresponding to dynamic images and static images may be different.
[0195] In one implementation, the process of the electronic device initializing the first editing interface corresponding to the first dynamic image may specifically include initializing the interface animation, initializing the slider, and initializing the cache, wherein the cache is used to store data during the editing process of the first dynamic image.
[0196] Exemplarily, the initialization interface animation of the electronic device may include: (1) executing the cover image moving animation, which refers to the interface change of the preview area of the preview interface switching to the preview window of the editing interface, the initial position is the preview area of the preview interface, and the end position is the preview window of the editing interface. For example, the animation is the cover image of the preview window 121 shown in Figure 1B moving to the preview window 131 shown in Figure 1C; (2) after the animation is executed, a callback is performed to load the video resource of the first dynamic image. At this time, the preview window of the editing interface has two layers of view, the upper layer is the cover image of the first dynamic image, and the lower layer is the surface view (surfaceview), which is used to display the video resource of the first dynamic image. In the embodiment of the present application, the image selected in the slider may be different from the cover image, such as different resolutions, so the cover image of the first dynamic image is covered on the upper layer to achieve visual consistency.
[0197] Among them, the specific process of the electronic device obtaining the video resource may include: the electronic device may obtain the address of the first dynamic image in the file system; then, obtain the file of the first dynamic image based on the address; obtain the position of the video in the file from the tag (TAG) at the end of the file; then, obtain the video based on the position of the video in the file; associate the video with the encoder, and the association setting is used to subsequently obtain a static image from the first dynamic image. For example, the encoder can be a media metadata retriever (MediaMetadataRetriever), and the electronic device sets the video to the retriever, which provides a unified interface for retrieving frames and metadata from the input media file; associate the video with the media player (MediaPlayer), that is, set the video to MediaPlayer, and combine MediaPlayer with surfaceview to play the video; the electronic device can call the positioning (seekTo) method of MediaPlayer to locate the position of the selected static image based on the percentage of the selected static image number and the total number of video frames; bind surfaceview to MediaPlayer; and then, the image displayed in surfaceview can be controlled by calling MediaPlayer seekTo.
[0198] Exemplarily, initializing a slider of an electronic device may include: initializing a basic view of the slider, which may be a custom view, that is, the custom view means that the size of the slider, the number of images in the slider, etc. may be pre-set; then, drawing the cover image as the background image of each frame image in the slider; drawing a selection box of the slider, and drawing the cover image in the box, or other effects, such as the size of the selection box being larger than the size of the image position at other positions; after obtaining the video, parsing multiple static images from the video, for example, the electronic device can use a media data extractor (MediaExtractor) and a decoder (MediaCodec) to parse specified frames in the video, and the number of frames is not limited, such as taking one frame from the video at a preset time interval to obtain 10 frames of static images; then, updating the above-mentioned multiple static images to the slider background image, for example, after obtaining the video of the first dynamic image in the preview window 121 shown in Figure 1B, obtaining multiple static images of the first dynamic image, and then updating the multiple static images to the slider 134 in Figure 1C through alpha (alpha animation).
[0199] Step S403: The electronic device updates the first editing interface in response to the user operation instructing to select the target frame in the first dynamic image as the image to be edited, and the preview window in the updated first editing interface is used to display the target frame.
[0200] In one implementation, when an electronic device detects a user sliding operation on a slider, it can set the dynamic image cover image of the preview window to invisible and display the underlying surfaceview; display the sliding position through a check box on the slider; when a user operation of sliding to a target frame is detected, the check box is displayed on the target frame; the percentage of the check box on the slider is calculated; based on the percentage, the time point of the target frame in the video is calculated; and then, the seekTo method of MediaPlayer is called to adjust the display content of MediaPlayer to the position corresponding to the time point in the video, so that the surfaceview is updated to the target frame corresponding to the time point, and the surfaceview is used to carry the display content of MediaPlayer.
[0201] For example, the target frame is the first static image corresponding to the thumbnail 134b shown in Figure 1C. When the electronic device detects a user operation of sliding to the thumbnail 134b of the first static image, it responds to the user operation and displays the user interface 14 shown in Figure 1D. The image of the surface view in the preview window 141 in the user interface 14 is the target frame, that is, the first static image.
[0202] Furthermore, based on the updated first edited image, in some embodiments, the electronic device can, in response to a user operation instructing to set the target frame as the cover image of the first dynamic image, update the cover image of the first dynamic image to the target frame, thereby obtaining a second dynamic image. For example, upon detecting a user operation on the cover control 132 in the user interface 14 shown in FIG. 1D , the electronic device can set the image to be edited displayed in the preview window 141 of the interface as the cover image of the first dynamic image, thereby obtaining the second dynamic image.
[0203] In one implementation, upon detecting a user operation to set a target frame as a cover image, the electronic device may pop up a loading box on the user interface, indicating that the image is currently being set as the cover image. Optionally, the electronic device may be configured to not respond to any user operation while the loading box is displayed, i.e., the user cannot perform other operations. While the loading box is displayed, the electronic device may set the target frame as the cover image of the first dynamic image.
[0204] Exemplarily, the execution process may specifically include: (1) first, obtaining the position percentage of the thumbnail of the target frame on the slider in the current interface (such as the first editing interface after the update); obtaining the video duration of the video corresponding to the first dynamic image through MediaMetadataRetriever, and then calculating the progress of the target frame in the video based on the above position percentage; using the search method (.(1) obtaining the bitmap corresponding to the progress from the video, scaling the bitmap to the same resolution as the cover image of the first dynamic image, and obtaining the target cover image corresponding to the second dynamic image; (2) obtaining the file corresponding to the first dynamic image according to the path of the first dynamic image, specifically obtaining the video data in the first dynamic image and the TAG data at the end of the file; (3) obtaining the original exchangeable image file (Exif) of the first dynamic image; changing the image update time in the original Exif to the current time, and obtaining the target Exif corresponding to the second dynamic image; (4) obtaining the original database information (ContentValues) of the first dynamic image; (5) deleting the relevant data of the first dynamic image in the database according to the file path, specifically deleting the data related to the first dynamic image in the media library (MediaLibrary) data, deleting the data related to the first dynamic image in the database (MediaProvider), and deleting the file corresponding to the first dynamic image; (6) creating a new file for the second dynamic image, specifically including creating a new file according to the absolute path of the first dynamic image; opening the file; writing the target Exif to the file (that is, writing the target file); The cover image is compressed in jpeg format and written to a file; the video data in the first dynamic image and the TAG data at the end of the file corresponding to the first dynamic image are appended to the end of the file; the file is closed; the cover image number data at the end of the image file is updated; ContentValues is updated, and ContentValues may include attributes such as time and date, whether it is a favorite, etc.; the relevant data of the second dynamic image is inserted into the database, for example, it may include inserting basic information such as the storage path, creation time, update time and file size of the second dynamic image into the MediaProvider database and inserting the above basic information and special file type information of the second dynamic image into the MediaLibrary database, where special file types include dynamic images and high dynamic range imaging (HDR), etc.; (7) triggering the display of the preview interface corresponding to the second dynamic image and the data refresh of the grid interface in the gallery (user interface 11 as shown in Figure 1A); (8) because the file of the first dynamic image is deleted, reinitializing MediaMetadataRetriever, MediaPlayer and surfaceview.
[0205] Among them, the Exif of the image may include information such as camera brand, mobile phone model, flash, shutter speed, aperture size, sensitivity and GPS coordinates, which is not limited in the embodiment of the present application; the database information of the image may include information such as the village school path, creation time, update time, special file type and file size of the image.
[0206] In other embodiments, after the user selects a target frame as an image to be edited via the slider, the user can save the target frame as a static image. Accordingly, the electronic device can save the target frame as a static image in response to the operation of saving the target frame.
[0207] For example, assuming that the first static image corresponding to the thumbnail 134b shown in Figure 1C is the target frame, the electronic device can, when detecting a user operation of sliding to the thumbnail 134b of the first static image, respond to the user operation and determine the first static image as the image to be edited, and display the editing interface corresponding to the first static image, such as the user interface 14 shown in Figure 1D; further, the electronic device can save the first static image in response to the user operation of the save as control 133 in the user interface 14.
[0208] In one implementation, the electronic device may pop up a loading box on the updated first editing interface, indicating that the target frame is being saved. Optionally, the electronic device may be configured to not respond to any user operations while the loading box is displayed, i.e., the user cannot perform other operations. While the loading box is displayed, the electronic device may save the target frame.
[0209] Exemplarily, the process of executing the target frame saving by the electronic device may specifically include: (1) first, obtaining the position percentage of the thumbnail of the target frame on the slider in the current interface (such as the first editing interface after the update); obtaining the video duration of the video corresponding to the first dynamic image through MediaMetadataRetriever, and then calculating the progress of the target frame in the video according to the above position percentage; using the search method (.getScaledFrameAtTime) of MediaMetadataRetriever to obtain the bitmap corresponding to the progress from the video, and the bitmap may be scaled to an image with the same resolution as the cover image of the first dynamic image to obtain a high-resolution target frame; (2) obtaining the original exchangeable image file (exchangeable image file) of the first dynamic image. (file, Exif); change the image update time in the original Exif to the current time, and obtain the target Exif corresponding to the target frame; (3) determine the absolute path of the target frame, for example, the parent path of the first dynamic image can be set to the parent path of the saved image, and the current time can be set to the name of the target frame to obtain the absolute path of the target frame; (4) create a new file for the target frame according to the absolute path, open the file; write the target Exif into the file, compress the high-resolution target frame in jpeg format, and write the compressed image to the file; close the file; (5) obtain the database information (ContentValues) of the first dynamic data, and replace the time date in ContentValues with the target image. (6) inserting the ContentValues of the high-resolution target frame into the database, which may include inserting basic information such as the storage path, creation time, update time and file size of the high-resolution target frame into the MediaProvider database and inserting the above basic information and special file type of the high-resolution target frame into the MediaLibrary database; (7) triggering the display of the preview interface corresponding to the high-resolution target frame and the data refresh of the grid interface in the gallery (user interface 11 as shown in Figure 1A).
[0210] Step S404: In response to the third user operation instructing to perform the first edit on the target frame, the electronic device displays a second editing interface for performing the first edit on the target frame, where the second editing interface includes an editing window including the target frame.
[0211] Among them, the first editing can be editing operations such as graffiti, cropping, filters and watermarks, and the second editing interface includes function controls corresponding to the first editing, such as function controls corresponding to graffiti and function controls corresponding to filters; the editing window is used to display the editing process when the user performs the first editing on the target frame.
[0212] In some embodiments, the updated first editing interface includes an editing option corresponding to the first editing, and the electronic device displays the second editing interface when detecting a user operation on the editing option.
[0213] For example, assuming that the target frame is the first static image corresponding to the thumbnail 134b in the user interface 14 shown in Figure 2A, the user interface 14 includes a preview window 141 and also includes multiple editing options, such as a graffiti option 135c; assuming that the editing option corresponding to the first edit is the graffiti option 135c, then when the electronic device detects a user operation on the graffiti option 135c, the electronic device can display an editing interface for graffiti on the first static image, such as the user interface 21 shown in Figure 2B, wherein the first static image is displayed in the editing window 211 in the user interface 21.
[0214] Optionally, the target frame displayed in the preview window of the second editing interface can be obtained by taking a screenshot from the updated first editing interface. In the embodiment of the present application, the display speed of the second editing interface can be increased by taking a screenshot.
[0215] For example, when the electronic device detects the above-mentioned third user operation acting on the updated first editing interface, it obtains the position percentage of the selected static image in the updated first editing interface in the slider; based on the position percentage, a screenshot of the surfaceview area is obtained through a screenshot tool (such as pixelCopy), wherein the speed of pixelCopy obtaining screenshots based on surfaceview can reach ms level, which greatly improves the display speed of the second editing interface; and then, the obtained screenshot is updated to the editing window of the second editing interface.
[0216] Step S405: The electronic device displays the editing effect of the target frame in response to the editing operation performed on the target frame.
[0217] Among them, the editing operation acting on the target frame can be one or more editing operations, which is not limited in the embodiments of the present application; the editing effect of the target frame refers to the display content at the location of the target frame. For example, when graffiti editing, the editing effect of the target frame is the target frame with graffiti traces. For example, when cropping editing, the editing effect of the target frame is the target frame whose size and content are changed after cropping.
[0218] It should be noted that, in the embodiment of the present application, the target frame displayed in the editing window is called the fourth static image, the above-mentioned editing operation acting on the target frame is the user operation acting on the fourth static image, and displaying the editing effect of the target frame is the editing effect of displaying the fourth static image.
[0219] For example, assuming that the editing operation is adding graffiti, the electronic device can respond to the editing operation by adding graffiti on the target frame and adding proportionally reduced graffiti on the thumbnail corresponding to the target frame, as shown in Figures 2B and 2C.
[0220] Step S406: the electronic device saves the edited target frame in response to the fourth user operation instructing to save the edited target frame.
[0221] In one implementation, upon detecting the fourth user operation, the electronic device may, in response to the user operation, obtain a high-resolution target frame; superimpose the editing effect on the target frame to obtain an edited target frame; and save the edited target frame. In this embodiment of the present application, the edited target frame saved by the electronic device may also be referred to as a target image.
[0222] For example, the electronic device can first obtain the position percentage of the thumbnail of the target frame in the slider; then, according to the position percentage, use the search method (.getScaledFrameAtTime) of MediaMetadataRetriever to obtain the bitmap of the current video progress; the bitmap is scaled to the same resolution as the cover image (or other resolutions) to obtain the original target frame without superimposed editing effects, and the editing effects of the second editing interface are superimposed on the original target frame to obtain the edited target frame; obtain the original Exif of the dynamic image (i.e., the first dynamic image) corresponding to the target frame, and the original Exif includes but is not limited to the following information Information: time information (such as shooting time or update time), shooting parameters, etc.; update the time information in the original Exif according to the current time to obtain the target Exif, and the time information in the target Exif includes the time information whose update time is the current time; determine the absolute path of the target frame, for example, the parent path of the first dynamic image can be set as the parent path of the target frame, and the current time can be set as the name of the target frame to obtain the absolute path of the target frame; create a new file according to the absolute path and open the corresponding read-write file of the file, write the target Exif into the file, compress the edited target frame in jpeg format, write the compressed image into the file, and close the file.
[0223] In other embodiments of the present application, after editing the target frame in the second editing interface, the user can trigger a return to the first editing interface (the trigger operation shown in the user interface 22 as shown in Figure 2C), wherein the preview window (such as preview window 231) in the returned first editing interface (the user interface 23 as shown in Figure 2D) displays the edited target frame, and the selected box in the slider (such as slider 232) is a thumbnail of the edited target frame, and the other areas of the slider except the selected box area are grayed out, wherein the grayed-out state can be displayed in gray and cannot be triggered.
[0224] Furthermore, assuming that the user triggers the first editing interface to start resetting, the electronic device can respond to the reset operation acting on the first editing interface (such as clicking the reset control 132 in the user interface shown in Figure 2D), delete the editing effects superimposed on the target frame, and display the first editing interface in the initial state (user interface 13 as shown in Figure 1C). Specifically, the electronic device can first delete the editing effects of the target frame in the preview window of the first editing interface and the thumbnail of the target frame on the slider; initialize the display content of MediaPlayer and surfaceview; seekMediaPlayer to the position of the cover image; update the preview window of the first editing interface to the cover image; ungray the slider, and set the slider progress to the position of the thumbnail of the cover image.
[0225] Next, the form and software and hardware architecture of the electronic device provided in the embodiments of the present application are introduced.
[0226] Electronic equipment can be equipped or portable terminal devices with other operating systems, such as mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, as well as cellular phones, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, in-vehicle devices, smart home devices and / or smart city devices, etc.
[0227] Figure 6A illustrates an exemplary hardware structure of an electronic device according to an embodiment of the present application. As shown in Figure 6A, the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 126, a camera 130, a display 140, an audio module 150, a speaker 150A, a receiver 150B, a microphone 150C, an earphone interface 150D, and a sensor module 160. The sensor module 160 may include a pressure sensor 160A, a distance sensor 160F, a proximity light sensor 160G, a touch sensor 160K, an ambient light sensor 160L, and the like.
[0228] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0229] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals based on instruction operation codes and timing signals to complete the control of instruction fetching and execution.
[0230] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly retrieve it from the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0231] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0232] In an embodiment of the present application, the processor 110 can be used to run a gallery application, and the processor 110 is used to control each module in the gallery application to execute the editing functions of the embodiments of Figures 1A-1D, 2A-2K, and 3A-3C above to implement the image processing method provided by the present application.
[0233] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only for illustrative purposes and does not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0234] The internal memory 126 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0235] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation of DDR SDRAM is generally referred to as DDR5 SDRAM), etc.
[0236] Non-volatile memory may include disk storage devices and flash memory.
[0237] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage cell potential level; universal flash storage (UFS) and embedded multi media card (eMMC) can be divided into UFS and eMMC according to the storage specification.
[0238] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0239] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0240] The external memory interface 120 can be used to connect to an external non-volatile memory device to expand the storage capacity of the electronic device. The external non-volatile memory device communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored in the external non-volatile memory device.
[0241] The electronic device implements its display functionality through a GPU, display screen 140, and an application processor. The GPU is a microprocessor for image processing that connects display screen 140 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0242] The display screen 140 is used to display images, videos, etc. The display screen 140 includes a display panel. The display panel can be a liquid crystal display (LCD). The display screen panel can also be made of an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniLED, a microLED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device can include one or N display screens 140, where N is a positive integer greater than one.
[0243] The electronic device can implement a shooting function through an ISP, a camera 130 , a video codec, a GPU, a display screen 140 , and an application processor.
[0244] The ISP processes data fed back by the camera 130. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and transformed into a visible image. The ISP can also perform algorithmic optimization for image noise, brightness, and other factors. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within the camera 130.
[0245] The camera 130 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device may include 1 or N cameras 130, where N is a positive integer greater than 1.
[0246] In the embodiment of the present application, the camera 130 may be a telephoto camera, a main camera, a wide-angle camera, or the like.
[0247] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when an electronic device selects a frequency, the DSP performs a Fourier transform on the frequency energy.
[0248] Video codecs are used to compress or decompress digital video. Electronic devices may support one or more video codecs. This allows them to play or record videos in a variety of encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0249] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU enables intelligent cognitive applications in electronic devices, such as image recognition, face recognition, speech recognition, and text comprehension.
[0250] The electronic device can implement audio functions such as music playback and recording through the audio module 150, the speaker 150A, the receiver 150B, the microphone 150C, the headphone jack 150D, and the application processor.
[0251] The audio module 150 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 150 can also be used to encode and decode audio signals. In some embodiments, the audio module 150 can be provided in the processor 110, or some functional modules of the audio module 150 can be provided in the processor 110.
[0252] The speaker 150A, also called a "speaker," is used to convert audio electrical signals into sound signals. The electronic device can listen to music or make hands-free calls through the speaker 150A.
[0253] The receiver 150B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device receives a call or voice message, the user can place the receiver 150B close to the ear to hear the voice.
[0254] Microphone 150C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 150C to input the sound signal into the microphone 150C. The electronic device can be provided with at least one microphone 150C. In other embodiments, the electronic device can be provided with two microphones 150C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device can also be provided with three, four or more microphones 150C to realize sound signal collection, noise reduction, and identification of sound sources, and realize directional recording function, etc.
[0255] The headphone jack 150D is used to connect a wired headphone and can be a USB interface, or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0256] The structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components can be implemented in hardware, software, or a combination of software and hardware. For example, the electronic device may further include buttons, motors, indicators, and subscriber identification module (SIM) card interfaces, etc. For another example, the sensor module may further include: a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a fingerprint sensor, a temperature sensor, a bone conduction sensor, and the like.
[0257] FIG6B exemplarily shows the software architecture of the electronic device according to an embodiment of the present application.
[0258] As shown in Figure 6B, the layered architecture divides the system into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the system is divided into four layers, from top to bottom: application layer, application framework layer (framework), system layer, and kernel layer. Among them:
[0259] The application layer (application) can include a series of application packages. For example, an application package can include applications such as a gallery application and a camera application.
[0260] The gallery application may include but is not limited to: an image preview module, a dynamic image editing module, a codec module, other editing modules, an image saving module, and an image cache module (not shown), etc.
[0261] The image preview module is mainly responsible for the human-computer interaction of the gallery application, such as controlling the gallery display interface (such as the preview interface mentioned below) and the display of the preview screen therein, and sensing and responding to user operations occurring in the preview interface.
[0262] The dynamic image editing module is used to display the editing interface corresponding to the dynamic image (such as the first editing interface described below) and process the displayed content on the editing interface (for example, capturing the displayed content on the preview window). The dynamic image editing module may specifically include a video track management module, which is used to edit the slider in the editing interface corresponding to the dynamic image.
[0263] The codec module is used to parse the video corresponding to the dynamic image into a static image.
[0264] The other editing modules are used to edit the static images in the dynamic images, wherein the other editing modules may specifically include multiple editing modules, such as a graffiti editing module, a watermark editing module, and a cropping editing module.
[0265] The image saving module is used to save the static image in the dynamic image as a separate static image. It should be noted that the static image in the dynamic image saved by the image saving module can be unedited or can be a static image edited by other editing modules.
[0266] The image cache module is a functional module shared by other modules outside the gallery. It is used to manage the image cache, as well as the storage of editing effects and editing effects (graffiti, cropping, etc.).
[0267] The application framework layer (framework) may mainly involve the camera framework, and may include camera access interfaces such as camera management and camera devices, playing a role of connecting the upper and lower levels. It can interact with the camera application through the application programming interface (API) and interact with the HAL through the HAL interface definition language (HIDL).
[0268] The software architecture may further include a hardware abstraction layer (HAL) not shown in FIG6B . The HAL is an interface layer between the application framework layer and the kernel layer, and provides a virtual hardware platform for the operating system.
[0269] The kernel layer is the layer between hardware and software. It includes various hardware drivers, such as display drivers, camera drivers, audio drivers, and sensor drivers. The kernel layer may also include a digital signal processor driver (not shown) and an image processor driver (not shown). The camera driver drives the image sensors of one or more cameras in the camera module to capture images and drives the image signal processor to pre-process the images. The digital signal processor driver drives the digital signal processor to process images. The image processor driver drives the graphics processor to process images.
[0270] Based on the software and hardware architecture of the electronic device described above, the image processing methods provided by various embodiments of the present application are respectively explained in depth in FIG. 7 and FIG. 8 .
[0271] FIG7 shows an image processing method for editing a static image in a dynamic image by an electronic device according to an embodiment of the present application. The method includes some or all of the following steps:
[0272] S11: The image preview module receives a request to display a first dynamic image.
[0273] In some embodiments, a user may trigger an electronic device to launch a gallery application, and further trigger the electronic device to display images in the gallery application, wherein the images in the gallery application may include dynamic images, static images, and videos. Assuming that the user triggers the display of a first dynamic image, as shown in FIG1A , the user may click on a thumbnail 110 of the first dynamic image displayed in the user interface 11, and accordingly, the image preview module of the electronic device may receive a request to display the first dynamic image.
[0274] It is understandable that the user can also trigger the display of the first dynamic image through voice, gestures, etc., and this application does not limit the specific method in which the user triggers the electronic device to display the first dynamic image.
[0275] S12: The image preview module obtains a first dynamic image.
[0276] In some embodiments, after receiving a request to display the first dynamic image, the image preview module obtains display data of the first dynamic image from the media library. Exemplarily, the file format of the first dynamic image obtained by the image preview module can be as shown in Figure 5. Furthermore, the image preview module extracts the first field (i.e., the cover image corresponding to the first dynamic image) and the second field (i.e., the video corresponding to the first dynamic image) from the first dynamic image or region based on the third field of the first dynamic image. The display data of the first dynamic image can be the first field and the second field in the first dynamic image.
[0277] S13: The image preview module displays a preview interface corresponding to the first dynamic image.
[0278] In some embodiments, after obtaining the display data of the first dynamic image, the gallery preview module displays a preview interface corresponding to the first dynamic image based on the display data. The preview interface includes a preview area, and the preview area is used to display the first dynamic image. The preview interface corresponding to the first dynamic image may also include other controls. The specific content of the preview interface can be found in the relevant description above. As shown in Figure 1A, the user can click on the thumbnail 110 of the first dynamic image displayed in the user interface 11. Accordingly, after obtaining the first dynamic image, the image preview module of the electronic device can display the user interface 12 as shown in Figure 1B, wherein the preview window 121 in the user interface 12 can display the cover image of the first dynamic image, and the video of the first dynamic image is played when the user long presses the preview window 121.
[0279] S14: The image preview module receives a request to edit the first dynamic image.
[0280] Exemplarily, the preview interface corresponding to the first dynamic image includes an editing control for editing the first dynamic image. When the user clicks the editing control, the preview module of the electronic device may receive a request to edit the first dynamic image.
[0281] For example, the preview interface corresponding to the first dynamic image is shown in FIG1B . The user may click the edit control 122 displayed in the user interface 12 as shown in FIG1B . Accordingly, the image preview module of the electronic device receives a request to edit the first dynamic image.
[0282] S15: The image preview module may send a display request to the dynamic image editing module. The display request is used to request display of a first editing interface corresponding to the first dynamic image. The request includes the first dynamic image.
[0283] The request may also include database information of the first dynamic image, which includes properties of the image file (such as storage path, file size, creation time, update time, etc.). The database information of the first dynamic image is used to browse, view and edit the first dynamic image.
[0284] In some embodiments, when the image preview module receives a user operation instructing to display a certain image, it can determine whether the image requested by the user to be edited is a dynamic image. If the image requested by the user to be edited is a dynamic image, it can send a request to the dynamic image editing module to display the first editing interface corresponding to the image; if the image requested by the user to be edited is not a dynamic image, it can obtain the data of the image and display the preview interface of the image based on the obtained data.
[0285] S16: The dynamic image editing module analyzes the first dynamic image to obtain a video.
[0286] In one implementation, the file format of the first dynamic image can be as shown in Figure 5. The dynamic image editing module reads the first dynamic image from the tail end, that is, the dynamic image editing module can first parse the tail mark of the third field of the first dynamic image to obtain the length of the video byte stream; add the length of the video byte stream and the length of the third field to obtain the video offset; then, determine the starting position of the video in the first dynamic image based on the video offset, and determine the ending position of the video in the first dynamic image based on the length of the third field; based on the starting position and the ending position, parse the video from the first dynamic image.
[0287] S17: The dynamic image editing module sends a request for parsing the video to the encoding and decoding module.
[0288] S18: The codec module parses the video to obtain multiple static images.
[0289] For example, the encoding and decoding module extracts multiple static images from the video at preset intervals. There is no limit on the number of extracted images.
[0290] S19: The encoding and decoding module sends multiple static images to the dynamic image editing module.
[0291] S20: The dynamic image editing module displays a first editing interface corresponding to the first dynamic image based on the multiple static images. The first editing interface includes a slide bar and a preview window.
[0292] The sliding bar is used to display thumbnails corresponding to the multiple static images; the sliding bar in the first editing interface can display thumbnails corresponding to some or all of the multiple static images.
[0293] In one implementation, the dynamic image editing module initializes the slider and preview window of the first editing interface based on the video, with the first editing interface in its initial state. The slider is used to display a thumbnail of the static image corresponding to the first dynamic image (the currently selected thumbnail may be a thumbnail corresponding to the cover image of the first dynamic image); the preview window is used to display the static image corresponding to the thumbnail selected in the slider 134 (the preview window may currently display the cover image of the first dynamic image). The specific initialization process can be found in the relevant description in S402 and will not be repeated here.
[0294] Exemplarily, the first editing interface can be the user interface 13 shown in Figure 1C, and the user interface 13 includes a slider 134 and a preview window 131, wherein the slider 134 is used to display a thumbnail of the static image corresponding to the first dynamic image, and the thumbnail in the selected state in the slider 134 is the thumbnail corresponding to the cover image of the first dynamic image; the preview window is used to display the cover image of the first dynamic image.
[0295] S21: The dynamic image editing module displays a target frame in a preview window in response to a user operation on the slide bar, where the target frame is a frame in the static image of the first dynamic image.
[0296] In one implementation, the dynamic image editing module responds to a user operation on the slider, displays a target frame in a preview window, and updates the image selected in the slider from the cover image to the target frame.
[0297] For example, as shown in FIG1C , the user can select the thumbnail 134 b of the first static image from the slider 134 of the user interface 13, and the first static image is the target frame. Accordingly, the electronic device can display the user interface 14 as shown in FIG1D , and the thumbnail of the target frame in the slider 134 in the user interface 14 (i.e., the thumbnail 134 b of the first static image) is selected, and the target frame is displayed on the preview window 141.
[0298] S22: When receiving the request to graffiti the target frame, the dynamic image editing module requests the graffiti editing module to display a second editing interface for graffiti on the target frame.
[0299] Exemplarily, as shown in FIG2A , in response to a user operation on the graffiti option 135 c , the electronic device captures the target frame displayed in the preview window 141 through the dynamic image editing module to obtain a screenshot, and then displays the screenshot on the second editing interface.
[0300] It should be understood that the operation here is performed using graffiti as an example. In other embodiments of the present application, the user can also perform editing operations such as cropping, filtering, and watermarking on the target frame, that is, the second editing interface includes functional controls corresponding to the first editing, such as functional controls corresponding to graffiti and functional controls corresponding to filters; the editing window is used to display the editing process when the user performs the first editing on the target frame.
[0301] S23: The graffiti editing module sends a request for obtaining a screenshot of the target frame to the dynamic image editing module.
[0302] S24: The dynamic image editing module copies pixels of the target frame displayed in the preview window to obtain a screenshot corresponding to the target frame. For example, the dynamic image editing module can use a screenshot tool (such as pixelCopy) to obtain a screenshot of the surfaceview area in the preview window to obtain a screenshot corresponding to the target frame.
[0303] In the embodiment of the present application, the display speed of the interface can be improved by taking screenshots. Among them, the speed of obtaining screenshots based on SurfaceView by using PixelCopy can reach the millisecond level, which greatly improves the speed of displaying images in the interface.
[0304] S25: The dynamic image editing module sends the screenshot to the graffiti editing module.
[0305] S26: The graffiti editing module displays a second editing interface, and the editing window of the second editing interface displays the screenshot.
[0306] Exemplarily, the second editing interface may be shown as the user interface 21 shown in FIG2B , where the electronic device displays a screenshot obtained by the dynamic image editing module from the preview window 141 shown in FIG2A on the editing window 211 of the user interface 21 .
[0307] S27: The graffiti editing module displays graffiti traces on the screenshot in response to the graffiti operation.
[0308] In some embodiments, upon detecting a user operation on an editing window of a second editing interface, the electronic device may display a graffiti trace corresponding to the graffiti operation on the screenshot. For example, the second editing interface may be user interface 21 as shown in FIG2B . As shown in FIG2B , a user may doodle on the screenshot displayed in editing window 211 , and the graffiti editing module of the electronic device may respond to the graffiti operation by displaying a graffiti trace (arrow) on the screenshot as shown in FIG2C .
[0309] In other embodiments of the present application, the user can trigger a return to the first editing interface after the electronic device displays the graffiti trace on the screenshot. Accordingly, the electronic device updates the first editing interface in response to the user operation. The preview window in the updated first editing interface adds the graffiti trace, and the thumbnail in the selected state in the slider also adds a proportionally reduced graffiti trace. For example, the user operation can be a user operation of clicking the dynamic image homepage option 213a as shown in Figure 2C, and the updated first editing interface can be the user interface 23 shown in Figure 2D.
[0310] Furthermore, after editing a static image in a dynamic image, the electronic device can save the edited image. Referring to FIG8 , FIG8 illustrates an image processing method for saving an edited static image by an electronic device according to an embodiment of the present application. The method includes some or all of the following steps:
[0311] S28: When receiving the request to save the edited target frame, the dynamic image editing module sends a saving request to the image saving module.
[0312] In one implementation, the electronic device can edit the target frame upon detecting user operation on the editing window of the second editing interface (the user interface 21 as shown in FIG2B ); and then display the edited target frame (the image in the editing window 221 as shown in FIG2C ) and a save control (the save control 214 as shown in FIG2C ); the user can click the save control, and accordingly, the dynamic image editing module of the electronic device can receive a request to save the edited target frame.
[0313] In another implementation, the user can trigger a return to the first editing interface after the electronic device displays the edited target frame. Accordingly, the electronic device updates the first editing interface in response to the user operation. The updated first editing interface (the user interface 23 as shown in FIG2D ) includes the edited target frame and a save control (the save control 133 as shown in FIG2D ); then, the user can click the save control, and accordingly, the dynamic image editing module of the electronic device can receive a request to save the edited target frame.
[0314] S29: The dynamic image editing module requests the dynamic image module to save the initialization data of the edited target frame.
[0315] S30: The dynamic image editing module obtains the current slider percentage, wherein the current slider percentage refers to the percentage of the thumbnail of the target frame in the slider.
[0316] S31: The dynamic image editing module sends a request to the video decoding module to obtain a high-resolution target frame.
[0317] In the embodiment of the present application, the electronic device can save high-resolution images, so that when the user views the saved images, the electronic device can display the high-resolution images, which can improve the user experience.
[0318] S32: The video decoding module obtains a high-resolution target frame according to the sliding bar percentage to obtain a first image.
[0319] Exemplarily, the video decoding module calculates the timestamp of the target frame according to the percentage of the sliding bar; and then, based on the timestamp, extracts a bitmap corresponding to the timestamp from the video of the first dynamic image to obtain the first image.
[0320] S33: The video decoding module sends the first image to the dynamic image editing module.
[0321] S34: The dynamic image editing module determines the target Exif, target absolute path and target database information corresponding to the edited target frame.
[0322] Exemplarily, the dynamic image editing module can obtain the original Exif of the first dynamic image, modify the image update time in the original Exif to the current time, and obtain the target Exif; obtain the path of the first dynamic image, change the name of the path to the current time and date, and obtain the target absolute path; obtain the database information of the first dynamic image, and obtain the target database information.
[0323] S35: The dynamic image editing module sends initialization data to the image saving module. The initialization data includes the first image and target Exif, target absolute path and target database information.
[0324] S36: The image saving module creates a first file according to the target absolute path.
[0325] Exemplarily, the image saving module may create a new first file according to the target absolute path.
[0326] S37: The image saving module writes the target Exif into the first file.
[0327] Exemplarily, the image saving module opens the first file and writes the target Exif into the first file.
[0328] S38: The image saving module superimposes the effect of the editing operation of the first editing on the first image to obtain a second image.
[0329] S39: The image saving module writes the second image into the first file.
[0330] Exemplarily, the image saving module may compress the second image in JPEG format, and then write the compressed second image into the first file; after writing, the file is closed.
[0331] S40: The image saving module uses the updated target database information as the database information of the second image.
[0332] In one implementation, the image saving module may update some fields in the database information of the first dynamic image and use the updated database information as the database information of the second image. The updated fields may include time, hash value, file size, special file type, and whether the file is saved. For example, the image saving module may update the time to the current time, update the file size to the file size of the second image, change the special file type to none, and update the saved to not saved.
[0333] S41: The image saving module inserts the database information of the first file and the second image into the database.
[0334] S42: The image saving module requests the image preview module to refresh the browsing interface of the gallery, and the refreshed browsing interface includes the second image.
[0335] For example, assuming that before the electronic device saves the edited target frame, the browsing interface of the electronic device's gallery is as shown in the user interface 11 of FIG1A , and the user interface 11 includes a thumbnail 110 of the first dynamic image; then, after the electronic device saves the edited target frame, the browsing interface of the electronic device's gallery may be as shown in the user interface 28 of FIG2K , and compared with the user interface 11, the user interface 28 adds a thumbnail 280 of the edited target frame.
[0336] S43: The image saving module sends a message to the dynamic image editing module indicating that the edited target frame has been successfully saved.
[0337] S44: The dynamic image editing module displays that the edited target frame has been successfully saved.
[0338] Exemplarily, the dynamic image editing module may display a prompt box on the current interface, where the prompt box is used to indicate that the edited target frame has been successfully saved.
[0339] Exemplarily, the electronic device displays a user interface 23 as shown in FIG2D . When detecting a user operation on the Save As control 133 , the electronic device can save the static image after graffiti in response to the user operation, and display a user interface 24 as shown in FIG2E during the saving process. The user interface 24 includes a prompt box 240, and the prompt box 240 is used to prompt that the static image after graffiti is currently being saved. For example, the content of the prompt box 240 may be “Saving”; after successful saving, the user interface 25 as shown in FIG2F is displayed. The user interface 25 may include a prompt box 250, and the prompt box 250 is used to prompt that the static image after graffiti has been successfully saved. For example, the content of the prompt box 250 may be “Saved to the gallery”.
[0340] S45: When receiving the reset request, the dynamic image editing module displays the first editing interface.
[0341] Exemplarily, the displayed first editing interface is the first editing interface in an initial state.
[0342] For example, assuming that the user triggers the first editing interface to start resetting, the electronic device can respond to the reset operation acting on the first editing interface (such as clicking the reset control 132 in the user interface shown in Figure 2D), delete the editing effects superimposed on the target frame, and display the first editing interface in the initial state (user interface 13 as shown in Figure 1C).
[0343] S46: When receiving the request to exit the first editing interface, the dynamic image editing module destroys the editing resources.
[0344] The editing resource includes cached data of the editing effect superimposed on the target frame.
[0345] S47: The dynamic image editing module requests to display a preview interface corresponding to the first dynamic image.
[0346] S48: The image preview module displays the preview interface.
[0347] For example, after resetting the first editing interface, the user clicks the return control, and the image preview module displays a preview interface of the first dynamic image. Assuming that the reset first editing interface is as shown in user interface 13 of FIG1C , upon receiving the user operation on return control 136 , the electronic device may display user interface 12 as shown in FIG1B , which is the preview interface corresponding to the first dynamic image.
[0348] (2) Preservation
[0349] The embodiment of the present application provides an image processing method, which can improve the efficiency of saving static images in dynamic images.
[0350] In an embodiment of the present application, an electronic device can display a first editing interface corresponding to a dynamic image; a user can select a target frame from the first editing interface and trigger the saving of the target frame. Accordingly, the electronic device saves the target frame as a static image in response to the user's operation to save the target frame in the dynamic image. In this method, the user can select any static image frame in the dynamic image and save it individually, which reduces user operations and improves the user experience.
[0351] In some embodiments, after the electronic device enables the editing function for a static image frame in a dynamic image (through the methods shown in FIG. 1A to FIG. 1D or other methods), the static image can be saved.
[0352] Assuming that the interface displayed by the electronic device after enabling the above-mentioned editing function is as shown in Figure 9, the following description will be made using the user interface 14 shown in Figure 9 as an example. The image selected in the slider 134 in the user interface 14 is the thumbnail 134b corresponding to the first static image, and the image displayed in the preview window 141 is the first static image. In one implementation, upon detecting a user operation on the Save As control 133 in the user interface 14, the electronic device may save the first static image in response to the user operation. During the saving process, the user interface 21 shown in Figure 10A may be displayed.
[0353] The user interface 21 may be different from the user interface 14 only in that the user interface 21 is newly provided with a prompt box 210 , which is used to prompt that the first static image is currently being saved. For example, the prompt box 210 may contain “saving”.
[0354] After the first static image is successfully saved, the electronic device may display user interface 22 as shown in FIG10B . User interface 22 may differ from user interface 21 only in that prompt box 210 is updated to prompt box 220. Prompt box 220 indicates that the first static image has been successfully saved. For example, prompt box 220 may contain the content "Saved to Gallery." Except for the prompt box, the other displayed content of user interfaces 21 and 22 may be the same as that of user interface 14 and will not be further described here.
[0355] It should be noted that the prompt box 210 may also be referred to as a first prompt box; and the prompt box 220 may also be referred to as a second prompt box.
[0356] In one implementation, the electronic device may not display the prompt box 220 after displaying the prompt box 220 for a preset period of time, while still displaying the user interface 14. In other words, after the electronic device saves a still image frame in the dynamic image as a picture using the Save As control in the editing interface corresponding to the dynamic image, the electronic device may not exit the display of the current interface. Furthermore, the user can continue to select the still image in the current interface (i.e., the editing interface corresponding to the dynamic image) to save or edit the still image.
[0357] In some embodiments, assuming that after saving the first static image, the user returns to the gallery application's image gallery interface, the image gallery interface may be as shown in user interface 23 of FIG10C , which includes a thumbnail 110 of the first dynamic image and a thumbnail 230 of the first static image. Furthermore, the user can click on thumbnail 230 to view the saved first static image. It should be noted that the resolution of the saved first static image may be different from the resolution of the first static image displayed in preview window 141. The specific saving process can be described in detail below.
[0358] In other embodiments of the present application, when the electronic device detects a user operation on the save control 133 in the user interface 14, the electronic device saves the selected static image in response to the user operation. During the saving process, the user interface 21 shown in FIG. 10A may not be displayed. After the saving is successful, the user interface 24 shown in FIG. 10D is displayed. The user interface 24 is a large image interface corresponding to the selected static image. In the embodiment of the present application, the large image interface corresponding to the saved static image (such as the user interface 24) can be referred to as the second interface.
[0359] The user interface 24 includes a prompt box 240 and a function area 241, and the function area 241 includes multiple function controls, wherein the prompt box 240 is used to display a saved static image in a selected state. Figure 10D exemplarily shows that the function controls include edit controls, favorite controls, share controls, delete controls and more controls, wherein the edit control is used to edit the image displayed in the prompt box 240; the favorite control sets the image displayed in the prompt box 240 to a favorite state; the share control is used to share the image displayed in the prompt box 240; the delete control is used to delete the image displayed in the prompt box 240; and the more controls are used to display other functions that can act on the image displayed in the prompt box 240.
[0360] It should be noted that the image displayed in the prompt box 240 has the same display content as the image displayed in the preview window 141 , but the resolution may be different. The resolution of the image displayed in the preview window 141 may be lower than that of the image displayed in the prompt box 240 .
[0361] In an embodiment of the present application, the static image in the first dynamic image displayed in the preview interface corresponding to the first dynamic image (the cover image of the first dynamic image displayed in the preview window 121 in the user interface 12 as shown in Figure 1B) can be called the first static image; the static image displayed in the initial state of the first editing interface (the cover image of the first dynamic image displayed in the preview window 131 in the user interface 13 as shown in Figure 1C) is called the second static image; the image displayed after the first editing interface is updated (the static image corresponding to the thumbnail 134b displayed in the selected state in the preview window 141 of the user interface 14 as shown in Figure 9) is called the third static image.
[0362] Based on the user interface displayed on the above-mentioned electronic device, the image processing method provided in the embodiment of the present application is introduced below.
[0363] FIG11 shows an image processing method provided by an embodiment of the present application. The method includes some or all of the following steps:
[0364] Step S301: In response to a first user operation indicating display of a first dynamic image, the electronic device displays a preview interface corresponding to the first dynamic image, the preview interface including a preview area and an editing control, the preview area is used to display the first dynamic image, and the editing control is used to edit the first dynamic image.
[0365] In some embodiments, the electronic device can display an application interface of a gallery application (such as the user interface 11 shown in Figure 1A), which application interface includes a thumbnail of the first dynamic image (such as the thumbnail 110 in the user interface 11); when the electronic device detects a user operation on the thumbnail, it responds to the user operation by displaying a preview interface corresponding to the first dynamic image (such as the user interface 12 as shown in Figure 1B), which preview interface includes a preview area (such as the preview window 121 in the user interface 12) and an editing control (such as the editing control 122 in the user interface 12), the preview area is used to display the first dynamic image, and the editing control is used to edit the first dynamic image.
[0366] The first dynamic image may be a static image, a dynamic image, or a video.
[0367] Please refer to Figure 12, which is a file format structure diagram of a dynamic image provided by an embodiment of the present application. As shown in Figure 12, the file format of the dynamic image may include three fields. The first field is a JPEG image, which is the cover image of the dynamic image. The second field is the mixed video data, for example, an mp4 file. The third field is the description field (TAG) of the dynamic image, and the third field may include three subfields, wherein the first subfield is the version number (version), for example, if the current version is the second version, the version number may be v2; the second subfield includes the start time (start) and duration (duration), that is, the second subfield is used to record the start time and duration of playback during gallery preview, and the start time (start) is the time point in the video when the first frame is played during gallery preview; the third subfield is used to record the file length of the video data, and the file length of the video data may also be referred to as the video byte stream length.
[0368] Among them, the file length of the video data is used to determine the position information of the video in the file, and the position information may include the starting position and the ending position; the video offset is the sum of the length of the second field (that is, the file length of the video data) and the length of the third field. Based on the video offset, the starting position of the video in the file can be determined; based on the video offset and the length of the video byte stream, the ending position of the video in the file can be determined.
[0369] Step S302: The electronic device displays a first editing interface corresponding to the first dynamic image in response to a second user operation on the editing control. The first editing interface includes a sliding bar and a preview window. The sliding bar is used to determine the image to be edited in the first dynamic image, and the preview window is used to display the image to be edited.
[0370] The first editing interface is used to process the first dynamic image, wherein the processing includes updating the cover image of the first dynamic image, editing any static image frame in the first dynamic image, etc.
[0371] In some embodiments, upon detecting the second user operation, the electronic device displays the first editing interface in the initial state. The image to be edited in the first editing interface in the initial state may be a frame of the first dynamic image, a cover image, or a preset frame. For example, the preview window in the first editing interface in the initial state displays the cover image of the first dynamic image, and the slider in the first editing interface in the initial state also displays the cover image.
[0372] Optionally, the editing interface corresponding to the first dynamic image may also include at least one editing option and other controls, wherein at least one editing option includes a first editing option, and the first editing option is used to perform a first edit on the selected image, wherein the first edit can be graffiti, cropping, filters, watermarks, etc.
[0373] Exemplarily, the editing interface corresponding to the first dynamic image can refer to the user interface 13 shown in Figure 1C and the user interface 14 shown in Figure 9, wherein the user interface 13 is the first editing interface in the initial state, and the user interface 14 is the first editing interface after the user reselects the static image in the first dynamic image; the above-mentioned preview window can refer to the relevant introduction of the preview window 131, the sliding bar can refer to the relevant introduction of the sliding bar 134, and the at least one editing option can refer to the relevant introduction of the option bar 135.
[0374] In some embodiments, when the electronic device detects a second user operation on the editing control, the electronic device determines whether the image on the current interface is a dynamic image in response to the user operation. If the image is a dynamic image, the electronic device initializes the editing interface corresponding to the dynamic image. It is understood that the editing interfaces corresponding to dynamic images and static images may be different.
[0375] In one implementation, the process of the electronic device initializing the first editing interface corresponding to the first dynamic image may specifically include initializing the interface animation, initializing the slider, and initializing the cache, wherein the cache is used to store data during the editing process of the first dynamic image.
[0376] Exemplarily, the initialization interface animation of the electronic device may include: (1) executing the cover image moving animation, which refers to the interface change of switching the preview area of the preview interface to the preview window of the editing interface, the initial position is the preview area of the preview interface, and the end position is the preview window of the editing interface. For example, the animation is the cover image of the preview window 121 shown in Figure 1B moving to the preview window 131 shown in Figure 1C; (2) performing a callback after the animation is executed to load the video resource of the first dynamic image. At this time, the preview window of the editing interface has two layers of view, the upper layer is the cover image of the first dynamic image, and the lower layer is the surface view (surfaceview), which is used to display the video resource of the first dynamic image. In the embodiment of the present application, the image selected in the slider may be different from the cover image, such as different resolutions, so the cover image of the first dynamic image is covered on the upper layer to achieve visual consistency.
[0377] Among them, the specific process of the electronic device obtaining the video resource may include: the electronic device may obtain the address of the first dynamic image in the file system; then, obtain the file of the first dynamic image based on the address; obtain the position of the video in the file from the tag (TAG) at the end of the file; then, obtain the video based on the position of the video in the file; associate the video with the encoder, and the association setting is used to subsequently obtain a static image from the first dynamic image. For example, the encoder can be a media metadata retriever (MediaMetadataRetriever), and the electronic device sets the video to the retriever, which provides a unified interface for retrieving frames and metadata from the input media file; associate the video with the media player (MediaPlayer), that is, set the video to MediaPlayer, and combine MediaPlayer with surfaceview to play the video; the electronic device can call the positioning (seekTo) method of MediaPlayer to locate the position of the selected static image based on the percentage of the selected static image number and the total number of video frames; bind surfaceview to MediaPlayer; and then, the image displayed in surfaceview can be controlled by calling MediaPlayer seekTo.
[0378] Exemplarily, initializing a slider of an electronic device may include: initializing a basic view of the slider, which may be a custom view, that is, the custom view means that the size of the slider, the number of images in the slider, etc. may be pre-set; then, drawing the cover image as the background image of each frame image in the slider; drawing a selection box of the slider, and drawing the cover image in the box, or other effects, such as the size of the selection box being larger than the size of the image position at other positions; after obtaining the video, parsing multiple static images from the video, for example, the electronic device can use a media data extractor (MediaExtractor) and a decoder (MediaCodec) to parse specified frames in the video, and the number of frames is not limited, such as taking one frame from the video at a preset time interval to obtain 10 frames of static images; then, updating the above-mentioned multiple static images to the slider background image, for example, after obtaining the video of the first dynamic image in the preview window 121 shown in Figure 1B, obtaining multiple static images of the first dynamic image, and then updating the multiple static images to the slider 134 in Figure 1C through alpha (alpha animation).
[0379] Step S303: The electronic device updates the first editing interface in response to the user operation instructing to select the target frame in the first dynamic image as the image to be edited, and the preview window in the updated first editing interface is used to display the target frame.
[0380] In one implementation, when an electronic device detects a user sliding operation on a slider, it can set the dynamic image cover image of the preview window to invisible and display the underlying surfaceview; display the sliding position through a check box on the slider; when a user operation of sliding to a target frame is detected, the check box is displayed on the target frame; the percentage of the check box on the slider is calculated; based on the percentage, the time point of the target frame in the video is calculated; and then, the seekTo method of MediaPlayer is called to adjust the display content of MediaPlayer to the position corresponding to the time point in the video, so that the surfaceview is updated to the target frame corresponding to the time point, and the surfaceview is used to carry the display content of MediaPlayer.
[0381] For example, the target frame is the first static image corresponding to the thumbnail 134b shown in Figure 1C. When the electronic device detects a user operation of sliding to the thumbnail 134b of the first static image, it responds to the user operation and displays the user interface 14 shown in Figure 9. The image of the surface view in the preview window 141 in the user interface 14 is the target frame, that is, the first static image.
[0382] Furthermore, based on the updated first edited image, in some embodiments, the electronic device can, in response to a user operation instructing to set the target frame as the cover image of the first dynamic image, update the cover image of the first dynamic image to the target frame, thereby obtaining a second dynamic image. For example, upon detecting a user operation on the cover control 132 in the user interface 14 shown in FIG. 9 , the electronic device can set the image to be edited displayed in the preview window 141 of the interface as the cover image of the first dynamic image, thereby obtaining the second dynamic image.
[0383] Step S304: In response to the operation of saving the target frame, the electronic device saves the target frame as a static image.
[0384] In one embodiment, after the user selects a target frame as an image to be edited via a slider, the user can save the target frame as a static image. Accordingly, the electronic device can save the target frame as a static image in response to the operation of saving the target frame.
[0385] For example, assuming that the first static image shown in Figure 1C is the target frame, the electronic device can display the first static image as the image to be edited in response to the user operation of sliding to the thumbnail 134b corresponding to the first static image, and the displayed interface can be as shown in the user interface 14 shown in Figure 9; further, the electronic device can save the first static image in response to the user operation of the save control 133 in the user interface 14.
[0386] In one implementation, the electronic device may pop up a loading box on the updated first editing interface, indicating that the target frame is being saved. Optionally, the electronic device may be configured to not respond to any user operations while the loading box is displayed, i.e., the user cannot perform other operations. While the loading box is displayed, the electronic device may save the target frame.
[0387] Exemplarily, the process of executing the target frame saving by the electronic device may specifically include: (1) first, obtaining the position percentage of the target frame on the slider in the current interface (such as the first editing interface after the update); obtaining the video duration of the video corresponding to the first dynamic image through MediaMetadataRetriever, and then calculating the progress of the target frame in the video according to the above position percentage; using the search method (.getScaledFrameAtTime) of MediaMetadataRetriever to obtain the bitmap corresponding to the progress from the video, and the bitmap may be scaled to an image with the same resolution as the cover image of the first dynamic image to obtain a high-resolution target frame; (2) obtaining the original exchangeable image file (exchangeable image file) of the first dynamic image. (file, Exif); change the image update time in the original Exif to the current time, and obtain the target Exif corresponding to the target frame; (3) determine the absolute path of the target frame, for example, the parent path of the first dynamic image can be set to the parent path of the saved image, and the current time can be set to the name of the target frame to obtain the absolute path of the target frame; (4) create a new file for the target frame according to the absolute path, open the file; write the target Exif into the file, compress the high-resolution target frame in jpeg format, and write the compressed image to the file; close the file; (5) obtain the database information (ContentValues) of the first dynamic data, and replace the time date in ContentValues with the target image. (6) inserting the ContentValues of the high-resolution target frame into the database, which may include inserting basic information such as the storage path, creation time, update time and file size of the high-resolution target frame into the MediaProvider database and inserting the above basic information and special file type of the high-resolution target frame into the MediaLibrary database; (7) triggering the display of the preview interface corresponding to the high-resolution target frame and the data refresh of the grid interface in the gallery (user interface 11 as shown in Figure 1A).
[0388] In some other embodiments of the present application, after executing the above step S303, the electronic device can set the target frame as the cover image or perform a first edit on the target frame.
[0389] In one implementation, upon detecting a user operation to set a target frame as a cover image, the electronic device may pop up a loading box on the user interface, indicating that the image is currently being set as the cover image. Optionally, the electronic device may be configured to not respond to any user operation while the loading box is displayed, i.e., the user cannot perform other operations. While the loading box is displayed, the electronic device may set the target frame as the cover image of the first dynamic image.
[0390] Exemplarily, the execution process may specifically include: (1) first, obtaining the position percentage of the thumbnail of the target frame on the slider in the current interface (such as the first editing interface after the update); obtaining the video duration of the video corresponding to the first dynamic image through MediaMetadataRetriever, and then calculating the progress of the target frame in the video based on the above position percentage; using the search method (.(1) obtaining the bitmap corresponding to the progress from the video, scaling the bitmap to the same resolution as the cover image of the first dynamic image, and obtaining the target cover image corresponding to the second dynamic image; (2) obtaining the file corresponding to the first dynamic image according to the path of the first dynamic image, specifically obtaining the video data in the first dynamic image and the TAG data at the end of the file; (3) obtaining the original exchangeable image file (Exif) of the first dynamic image; changing the image update time in the original Exif to the current time, and obtaining the target Exif corresponding to the second dynamic image; (4) obtaining the original database information (ContentValues) of the first dynamic image; (5) deleting the relevant data of the first dynamic image in the database according to the file path, specifically deleting the data related to the first dynamic image in the media library (MediaLibrary) data, deleting the data related to the first dynamic image in the database (MediaProvider), and deleting the file corresponding to the first dynamic image; (6) creating a new file for the second dynamic image, specifically including creating a new file according to the absolute path of the first dynamic image; opening the file; writing the target Exif to the file (that is, writing the target file); The cover image is compressed in jpeg format and written to a file; the video data in the first dynamic image and the TAG data at the end of the file corresponding to the first dynamic image are appended to the end of the file; the file is closed; the cover image number data at the end of the image file is updated; ContentValues is updated, and ContentValues may include attributes such as time and date, whether it is a favorite, etc.; the relevant data of the second dynamic image is inserted into the database, for example, it may include inserting basic information such as the storage path, creation time, update time and file size of the second dynamic image into the MediaProvider database and inserting the above basic information and special file type information of the second dynamic image into the MediaLibrary database, where special file types include dynamic images and high dynamic range imaging (HDR), etc.; (7) triggering the display of the preview interface corresponding to the second dynamic image and the data refresh of the grid interface in the gallery (user interface 11 as shown in Figure 1A); (8) because the file of the first dynamic image is deleted, reinitializing MediaMetadataRetriever, MediaPlayer and surfaceview.
[0391] Among them, the Exif of the image may include information such as camera brand, mobile phone model, flash, shutter speed, aperture size, sensitivity and GPS coordinates, which is not limited in the embodiment of the present application; the database information of the image may include information such as the village school path, creation time, update time, special file type and file size of the image.
[0392] In another implementation, based on the electronic device responding to a third user operation indicating a first edit to the target frame, a second editing interface for performing the first edit to the target frame is displayed, and the second editing interface includes an editing window, and the editing window includes the target frame; further, the electronic device can respond to the editing operation on the target frame and display the edited target frame in the editing window; further, it can also save the edited target frame in response to a fourth user operation indicating saving the edited target frame.
[0393] Among them, the first editing can be editing operations such as graffiti, cropping, filters and watermarks, and the second editing interface includes function controls corresponding to the first editing, such as function controls corresponding to graffiti and function controls corresponding to filters; the editing window is used to display the editing process when the user performs the first editing on the target frame.
[0394] The form and hardware and software structure of the electronic device for executing the (2) saving part can be found in the electronic device for the (1) editing part above, and will not be repeated here.
[0395] Based on the software and hardware architecture of the electronic device described above, the image processing methods provided by various embodiments of the present application are respectively explained in depth in FIG. 13 and FIG. 14 .
[0396] FIG13 shows an image processing method for editing a static image in a dynamic image by an electronic device according to an embodiment of the present application. The method includes some or all of the following steps:
[0397] S11: The image preview module receives a request to display a first dynamic image.
[0398] In some embodiments, a user may trigger an electronic device to launch a gallery application, and further trigger the electronic device to display images in the gallery application, wherein the images in the gallery application may include dynamic images, static images, and videos. Assuming that the user triggers the display of a first dynamic image, as shown in FIG1A , the user may click on a thumbnail 110 of the first dynamic image displayed in the user interface 11, and accordingly, the image preview module of the electronic device may receive a request to display the first dynamic image.
[0399] It is understandable that the user can also trigger the display of the first dynamic image through voice, gestures, etc., and this application does not limit the specific method in which the user triggers the electronic device to display the first dynamic image.
[0400] S12: The image preview module obtains a first dynamic image.
[0401] In some embodiments, after receiving a request to display the first dynamic image, the image preview module obtains display data of the first dynamic image from the media library. Exemplarily, the file format of the first dynamic image obtained by the image preview module can be as shown in FIG13. Furthermore, the image preview module extracts the first field (i.e., the cover image corresponding to the first dynamic image) and the second field (i.e., the video corresponding to the first dynamic image) from the first dynamic image or region based on the third field of the first dynamic image. The display data of the first dynamic image can be the first field and the second field in the first dynamic image.
[0402] S13: The image preview module displays a preview interface corresponding to the first dynamic image.
[0403] In some embodiments, after obtaining the display data of the first dynamic image, the gallery preview module displays a preview interface corresponding to the first dynamic image based on the display data. The preview interface includes a preview area, and the preview area is used to display the first dynamic image. The preview interface corresponding to the first dynamic image may also include other controls. The specific content of the preview interface can be found in the relevant description above. As shown in Figure 1A, the user can click on the thumbnail 110 of the first dynamic image displayed in the user interface 11. Accordingly, after obtaining the first dynamic image, the image preview module of the electronic device can display the user interface 12 as shown in Figure 1B, wherein the preview window 121 in the user interface 12 can display the cover image of the first dynamic image, and the video of the first dynamic image is played when the user long presses the preview window 121.
[0404] S14: The image preview module receives a request to edit the first dynamic image.
[0405] Exemplarily, the preview interface corresponding to the first dynamic image includes an editing control for editing the first dynamic image. When the user clicks the editing control, the preview module of the electronic device may receive a request to edit the first dynamic image.
[0406] For example, the preview interface corresponding to the first dynamic image is shown in FIG1B . The user may click the edit control 122 displayed in the user interface 12 as shown in FIG1B . Accordingly, the image preview module of the electronic device receives a request to edit the first dynamic image.
[0407] S15: The image preview module may send a display request to the dynamic image editing module. The display request is used to request display of a first editing interface corresponding to the first dynamic image. The request includes the first dynamic image.
[0408] The request may also include database information of the first dynamic image, which includes properties of the image file (such as storage path, file size, creation time, update time, etc.). The database information of the first dynamic image is used to browse, view and edit the first dynamic image.
[0409] In some embodiments, when the image preview module receives a user operation instructing to display a certain image, it can determine whether the image requested by the user to be edited is a dynamic image. If the image requested by the user to be edited is a dynamic image, it can send a request to the dynamic image editing module to display the first editing interface corresponding to the image; if the image requested by the user to be edited is not a dynamic image, it can obtain the data of the image and display the preview interface of the image based on the obtained data.
[0410] S16: The dynamic image editing module analyzes the first dynamic image to obtain a video.
[0411] In one implementation, the file format of the first dynamic image can be as shown in Figure 12. The dynamic image editing module reads the first dynamic image from the tail end, that is, the dynamic image editing module can first parse the tail mark of the third field of the first dynamic image to obtain the length of the video byte stream; add the length of the video byte stream and the length of the third field to obtain the video offset; then, determine the starting position of the video in the first dynamic image based on the video offset, and determine the ending position of the video in the first dynamic image based on the length of the third field; based on the starting position and the ending position, parse the video from the first dynamic image.
[0412] S17: The dynamic image editing module sends a request for parsing the video to the encoding and decoding module.
[0413] S18: The codec module parses the video to obtain multiple static images.
[0414] For example, the encoding and decoding module extracts multiple static images from the video at preset intervals. There is no limit on the number of extracted images.
[0415] S19: The encoding and decoding module sends multiple static images to the dynamic image editing module.
[0416] S20: The dynamic image editing module displays a first editing interface corresponding to the first dynamic image based on the multiple static images. The first editing interface includes a slide bar and a preview window.
[0417] The slide bar is used to display thumbnails corresponding to the multiple static images; the slide bar in the first editing interface can display thumbnails corresponding to some or all of the multiple static images.
[0418] In one implementation, the dynamic image editing module initializes the slider and preview window of the first editing interface based on the video, with the first editing interface in its initial state. The slider is used to display a thumbnail of the static image corresponding to the first dynamic image (the currently selected thumbnail may be a thumbnail corresponding to the cover image of the first dynamic image); the preview window is used to display the static image corresponding to the thumbnail selected in the slider 134 (the preview window may currently display the cover image of the first dynamic image). The specific initialization process can be found in the relevant description in S302 and will not be repeated here.
[0419] Exemplarily, the first editing interface can be the user interface 13 shown in Figure 1C, and the user interface 13 includes a slider 134 and a preview window 131, wherein the slider 134 is used to display a thumbnail of the static image corresponding to the first dynamic image, and the thumbnail in the selected state in the slider 134 is the thumbnail corresponding to the cover image of the first dynamic image; the preview window is used to display the cover image of the first dynamic image.
[0420] S21: The dynamic image editing module displays a target frame in a preview window in response to a user operation on the slide bar, where the target frame is a frame in the static image of the first dynamic image.
[0421] In one implementation, the dynamic image editing module responds to a user operation on the slider, displays a target frame in a preview window, and updates the image selected in the slider from the cover image to the target frame.
[0422] For example, as shown in FIG1C , the user can select the thumbnail 134 b of the first static image from the slider 134 of the user interface 13, and the first static image is the target frame. Accordingly, the electronic device can display the user interface 14 as shown in FIG9 , and the thumbnail of the target frame in the slider 134 in the user interface 14 (i.e., the thumbnail 134 b of the first static image) is selected, and the target frame is displayed on the preview window 141.
[0423] Furthermore, after selecting a target frame from a static image in a dynamic image, the electronic device can save the target frame. Referring to FIG. 14 , FIG. 14 illustrates an image processing method for saving a target frame by an electronic device in an embodiment of the present application. The method includes some or all of the following steps:
[0424] S22: When receiving the request to save the target frame, the dynamic image editing module sends a saving request to the image saving module.
[0425] In one implementation, when the electronic device detects a user operation on the save control 133 in the first editing interface (the user interface 14 shown in FIG9 ), the dynamic image editing module of the electronic device may receive a request to save the target frame accordingly.
[0426] S23: The dynamic image editing module requests the dynamic image module to save the initialization data of the target frame.
[0427] S24: The dynamic image editing module obtains the current slider percentage, wherein the current slider percentage refers to the percentage of the thumbnail of the target frame in the slider.
[0428] S25: The dynamic image editing module sends a request to the video decoding module to obtain a high-resolution target frame.
[0429] In the embodiment of the present application, the electronic device can save high-resolution images, so that when the user views the saved images, the electronic device can display the high-resolution images, which can improve the user experience.
[0430] S26: The video decoding module obtains a high-resolution target frame according to the sliding bar percentage to obtain a first image.
[0431] Exemplarily, the video decoding module calculates the timestamp of the target frame according to the percentage of the sliding bar; and then, based on the timestamp, extracts a bitmap corresponding to the timestamp from the video of the first dynamic image to obtain the first image.
[0432] S27: The video decoding module sends the first image to the dynamic image editing module.
[0433] S28: The dynamic image editing module determines the target Exif, target absolute path and target database information corresponding to the target frame.
[0434] Exemplarily, the dynamic image editing module can obtain the original Exif of the first dynamic image, modify the image update time in the original Exif to the current time, and obtain the target Exif; obtain the path of the first dynamic image, change the name of the path to the current time and date, and obtain the target absolute path; obtain the database information of the first dynamic image, and obtain the target database information.
[0435] S29: The dynamic image editing module sends initialization data to the image saving module. The initialization data includes the first image and the target Exif, the target absolute path and the target database information.
[0436] S30: The image saving module creates a first file according to the target absolute path.
[0437] Exemplarily, the image saving module may create a new first file according to the target absolute path.
[0438] S31: The image saving module writes the target Exif into the first file.
[0439] Exemplarily, the image saving module opens the first file and writes the target Exif into the first file.
[0440] S32: The image saving module superimposes the effect of the editing operation of the first editing on the first image to obtain a second image.
[0441] S33: The image saving module writes the second image into the first file.
[0442] Exemplarily, the image saving module may compress the second image in JPEG format, and then write the compressed second image into the first file; after writing, the file is closed.
[0443] S34: The image saving module uses the updated target database information as the database information of the second image.
[0444] In one implementation, the image saving module may update some fields in the database information of the first dynamic image and use the updated database information as the database information of the second image. The updated fields may include time, hash value, file size, special file type, and whether the file is saved. For example, the image saving module may update the time to the current time, update the file size to the file size of the second image, change the special file type to "none", and update the saved field to "not saved".
[0445] S35: The image saving module inserts the database information of the first file and the second image into the database.
[0446] S36: The image saving module requests the image preview module to refresh the browsing interface of the gallery, and the refreshed browsing interface includes the second image.
[0447] For example, assuming that before the electronic device saves the target frame, the browsing interface of the electronic device's gallery is as shown in the user interface 11 of FIG1A , and the user interface 11 includes a thumbnail 110 of the first dynamic image; then, after the electronic device saves the target frame, the browsing interface of the electronic device's gallery may be as shown in the user interface 23 of FIG10C , and compared with the user interface 11, the user interface 23 adds a thumbnail 230 of the target frame.
[0448] S37: The image saving module sends a message to the dynamic image editing module indicating that the target frame has been successfully saved.
[0449] S38: The dynamic image editing module shows that the target frame has been successfully saved.
[0450] Exemplarily, the dynamic image editing module may display a prompt box on the current interface, where the prompt box is used to indicate that the target frame has been successfully saved.
[0451] Exemplarily, the electronic device displays the user interface 14 as shown in Figure 9. When the electronic device detects a user operation on the save control 133, it can save the selected static image in response to the user operation, and display the user interface 21 as shown in Figure 10A during the saving process. The user interface 21 includes a prompt box 210, and the prompt box 210 is used to prompt that the selected static image is currently being saved. For example, the content of the prompt box 210 can be "Saving"; after successful saving, the user interface 22 as shown in Figure 10B is displayed. The user interface 22 may include a prompt box 220, and the prompt box 220 is used to prompt that the selected static image has been saved successfully. For example, the content of the prompt box 220 can be "Saved to the gallery".
[0452] Furthermore, in some embodiments, when the dynamic image editing module receives a request to exit the first editing interface, the image preview module displays a preview interface corresponding to the first dynamic image.
[0453] The term "user interface (UI)" in the specification, claims and drawings of this application refers to the media interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface of an application is a source code written in a specific computer language such as Java and Extensible Markup Language (XML). The interface source code is parsed and rendered on the terminal device, and finally presented as content that the user can recognize, such as pictures, text, buttons and other controls. Controls, also known as widgets, are the basic elements of the user interface. Typical controls include toolbars, menu bars, text boxes, buttons, scroll bars, pictures and text. The properties and contents of controls in the interface are defined by tags or nodes, such as XML through <textview> 、 <imgview> 、 <videoview>The controls contained in the interface are specified by nodes such as <head> and <body>. A node corresponds to a control or attribute in the interface, and the node is presented as user-visible content after parsing and rendering. In addition, many applications, such as hybrid applications, usually also contain web pages in their interfaces. A web page, also known as a page, can be understood as a special control embedded in the application interface. A web page is a source code written in a specific computer language, such as hypertext markup language (HTML), cascading style sheets (CSS), JavaScript (JS), etc. The web page source code can be loaded and displayed as user-recognizable content by a browser or a web page display component with similar functions to a browser. The specific content contained in a web page is also defined by tags or nodes in the web page source code, such as HTML through <body>. 、 、 <video> 、 <canvas>To define the elements and attributes of a web page.
[0454] A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operations that uses graphics. It can be an icon, window, control, or other interface element displayed on the display of an electronic device. Controls can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, and other visual interface elements.
[0455] It should be understood that each step in the above method embodiments provided herein can be implemented by hardware integrated logic circuits in a processor or by software instructions. The method steps disclosed in the embodiments of this application can be directly implemented as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0456] The present application also provides an electronic device, which may include a memory and a processor, wherein the memory may be used to store a computer program, and the processor may be used to call the computer program in the memory so that the electronic device executes the method in any one of the above embodiments.
[0457] This application also provides a chip system, which includes at least one processor for implementing the functions involved in the method performed by the electronic device in any of the above embodiments. In one possible design, the chip system also includes a memory for storing program instructions and data, and the memory is located within or outside the processor. The chip system can be composed of a chip or can include a chip and other discrete devices.
[0458] Optionally, there may be one or more processors in the chip system. The processor may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0459] Optionally, the memory in the chip system may be one or more. The memory may be integrated with the processor or may be provided separately from the processor, which is not limited in the embodiments of the present application. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or provided on different chips. The embodiments of the present application do not specifically limit the type of memory or the configuration of the memory and the processor.
[0460] Exemplarily, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0461] The present application also provides a computer program product, which includes: a computer program (also referred to as code, or instruction), which enables a computer to execute the method executed by the electronic device in any of the above embodiments when the computer program is executed.
[0462] The present application also provides a computer-readable storage medium storing a computer program (also referred to as code or instruction). When the computer program is executed, the computer executes the method executed by the electronic device in any of the above embodiments.
[0463] The various implementation modes of this application can be combined arbitrarily to achieve different technical effects.
[0464] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive).
[0465] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0466] In short, the above are only embodiments of the technical solution of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made based on the disclosure of the present invention should be included in the scope of protection of the present invention.< / canvas> < / video> < / videoview> < / imgview> < / textview>
Claims
1. An image processing method, It is characterized in that Applied to electronic equipment, the method comprises: Display a first interface, the first interface includes a first static image and a first control, the first static image corresponds to a first dynamic image, and the first dynamic image includes multiple frames of static images; In response to a user operation on the first control, a first editing interface is displayed, the first editing interface includes a first thumbnail, a second thumbnail, and a second static image, the first thumbnail and the second thumbnail are thumbnails corresponding to two static image frames in the first dynamic image, the first thumbnail is in a selected state, the first thumbnail corresponds to the second static image, the first static image and the second static image correspond to the same static image frame in the first dynamic image, and the first editing interface also includes a second control; In response to a user operation on the second thumbnail, displaying a third static image corresponding to the second thumbnail at the position of the second static image, with the second thumbnail being in a selected state; In response to a user operation on the second control, a second editing interface is displayed, wherein the second editing interface includes a fourth static image and a third control, and the third static image and the fourth static image correspond to the same static image frame in the first dynamic image; In response to a user operation acting on the fourth static image, displaying an editing effect of the fourth static image; In response to a user operation acting on the third control, the first editing interface is displayed, and the first editing interface displays the editing effect of the fourth static image at the position of the third static image, and displays the editing effect of the fourth static image at the position of the second thumbnail.
2. The method according to claim 1, It is characterized in that The first editing interface includes a first saving control; the method further includes: In response to a user operation acting on the first saving control, generating a target image based on the editing effect of the fourth static image; The target image is saved.
3. The method according to claim 2, It is characterized in that The method further comprises: In response to a user operation on the first saving control, displaying a first prompt box on the first editing interface, wherein the first prompt box is used to indicate that the image is being saved; After the target image is saved, a second prompt box is displayed on the first editing interface, wherein the second prompt box is used to indicate that the image has been successfully saved; Cancel displaying the second prompt box.
4. The method according to any one of claims 1 to 3, It is characterized in that The second editing interface further includes a second saving control, and the method further includes: When a user operation acting on the second saving control is received, generating the target image based on the editing effect of the fourth static image; Saving the target image; After the target image is saved, a second interface is displayed, where the second interface includes the target image.
5. The method according to any one of claims 2 to 4, It is characterized in that The generating of the target image comprises: Based on the second thumbnail, determining position information of the fourth static image in the video corresponding to the first dynamic image; Based on the position information, acquiring a first image from the video; Improving the resolution of the first image to obtain a second image; Based on the editing effect of the fourth static image, the second image is processed to obtain the target image.
6. The method according to any one of claims 1 to 5, It is characterized in that The displaying of the second editing interface includes: A screenshot is taken of the location area where the third static image is displayed to obtain the fourth static image.
7. The method according to any one of claims 1 to 6, It is characterized in that The first editing interface includes a reset control; the method further includes: In response to a user operation on the reset control, the first editing interface is displayed, the first editing interface includes the first thumbnail, the second thumbnail and the second static image, and the first thumbnail is in a selected state.
8. The method according to any one of claims 1 to 7, It is characterized in that The first static image is a cover image of the first dynamic image.
9. The method according to any one of claims 2 to 8, It is characterized in that The electronic device storing the target image includes: Acquire a storage path, an initial exchangeable image file Exif, and initial database information corresponding to the first dynamic image; the initial Exif includes parameters of the first dynamic image, and the parameters include time; The electronic device obtains the storage path corresponding to the target image based on the storage path corresponding to the first dynamic image and the current time; Based on the storage path corresponding to the target image, create a target file corresponding to the target image; Modify the time in the initial Exif to the current time to obtain the target Exif; Writing the target Exif and the target image into the target file; The target image file information is used to update the initial database information to obtain the target database information; the target image file information includes the storage path corresponding to the target image and the creation time of the target file; The target database information is saved in a database.
10. The method according to any one of claims 1 to 9, It is characterized in that The displaying of the first editing interface includes: Acquire a video corresponding to the first dynamic image; The video is decoded by a coding and decoding module to obtain the multiple frames of static images.
11. The method according to any one of claims 1 to 10, It is characterized in that The second control is any one of a crop control, a graffiti control, a watermark control, a filter control, a text control, a mosaic control, a blur control, a photo frame control, and a retain color control.
12. An image processing method, It is characterized in that Applied to electronic equipment, the method comprises: Display a first interface, the first interface includes a first static image and a first control, the first static image corresponds to a first dynamic image, and the first dynamic image includes multiple frames of static images; In response to a user operation on the first control, a first editing interface is displayed, the first editing interface includes a first thumbnail, a second thumbnail, and a second static image, the first thumbnail and the second thumbnail are thumbnails corresponding to two static image frames in the first dynamic image, the first thumbnail is in a selected state, the first thumbnail corresponds to the second static image, the first static image and the second static image correspond to the same static image frame in the first dynamic image, and the first editing interface also includes a second control; In response to a user operation on the second thumbnail, displaying a third static image corresponding to the second thumbnail at the position of the second static image, with the second thumbnail being in a selected state; In response to a user operation on the second control, the third static image is saved.
13. The method according to claim 12, It is characterized in that The method further comprises: In response to a user operation on the second control, displaying a first prompt box on the first editing interface, wherein the first prompt box is used to indicate that the image is being saved; After saving the third static image, displaying a second prompt box on the first editing interface, wherein the second prompt box is used to indicate that the image has been successfully saved; Cancel displaying the second prompt box.
14. The method according to claim 12, It is characterized in that The method further comprises: After the third static image is saved, a second interface is displayed, wherein the second interface includes the third static image.
15. The method according to any one of claims 12 to 14, It is characterized in that The step of saving the third static image comprises: Based on the second thumbnail, determining position information of the third static image in the video corresponding to the first dynamic image; Based on the position information, acquiring a first image from the video; Improving the resolution of the first image to obtain a second image; Save the second image.
16. The method according to any one of claims 12 to 15, It is characterized in that The first editing interface further includes a third control; and the method further includes: In response to a user operation on the third control, a second editing interface is displayed, wherein the second editing interface includes a fourth static image and a fourth control, and the third static image and the fourth static image correspond to the same static image frame in the first dynamic image; In response to a user operation acting on the fourth static image, displaying an editing effect of the fourth static image; In response to a user operation on the fourth control, the first editing interface is displayed, the first editing interface displays the editing effect of the fourth static image at the position of the third static image, and displays the editing effect of the fourth static image at the position of the second thumbnail.
17. The method according to claim 16, It is characterized in that The second editing interface further includes a fifth control, and the method further includes: When a user operation acting on the fifth control is received, generating the target image based on the editing effect of the fourth static image; Saving the target image; After the target image is saved, a third interface is displayed, where the third interface includes the target image.
18. The method according to claim 16 or 17, It is characterized in that The first editing interface includes a reset control; the method further includes: In response to a user operation on the reset control, the first editing interface is displayed, the first editing interface includes the first thumbnail, the second thumbnail and the second static image, and the first thumbnail is in a selected state.
19. The method according to any one of claims 12 to 18, It is characterized in that The first static image is a cover image of the first dynamic image.
20. The method according to any one of claims 13 to 19, It is characterized in that The electronic device storing the third static image includes: Acquire a storage path, an initial exchangeable image file Exif, and initial database information corresponding to the first dynamic image; the initial Exif includes parameters of the first dynamic image, and the parameters include time; The electronic device obtains the storage path corresponding to the third static image based on the storage path corresponding to the first dynamic image and the current time; Based on the storage path corresponding to the third static image, create a target file corresponding to the third static image; Modify the time in the initial Exif to the current time to obtain the target Exif; Writing the target Exif and the third static image into the target file; The file information of the third static image is used to update the initial database information to obtain the target database information; the file information of the third static image includes the storage path corresponding to the third static image and the creation time of the target file; The target database information is saved in a database.
21. The method according to any one of claims 12 to 20, It is characterized in that The displaying of the first editing interface includes: Acquire a video corresponding to the first dynamic image; The video is decoded by a coding and decoding module to obtain the multiple frames of static images.
22. The method according to any one of claims 14 to 21, It is characterized in that The second interface is a large image interface corresponding to the third static image in the gallery application of the electronic device, and the second interface includes at least one of an edit control, a collection control, a share control, and a delete control.
23. An electronic device, It is characterized in that The method comprises one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the method as claimed in any one of claims 1 to 22 is executed.
24. A chip system, the chip system is applied to electronic equipment, the chip system includes one or more processors, It is characterized in that The processor is configured to call computer instructions so as to execute the method according to any one of claims 1 to 22.
25. A computer-readable storage medium comprising instructions, It is characterized in that When the instructions are executed on an electronic device, the method according to any one of claims 1 to 22 is executed.
Citation Information
Patent Citations
Image processing method and electronic equipment
CN119031235A
Image processing method and electronic equipment
CN119031236A
Dynamic picture processing method, device, storage medium and electronic equipment
CN107610206A
Video editing method, video editing device and intelligent terminal
CN107992246A
Video processing method and device and terminal equipment
CN112995746A
