Picture editing method and device, electronic equipment and storage medium

By determining the color of the element to be edited based on the color of the image in social applications, the problem of unclear difference between the default color of the element and the color of the image is solved, achieving clear display and flexible adjustment of the element, thus improving the effect of image editing and user experience.

CN114549693BActive Publication Date: 2026-07-10BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2021-12-27
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In social applications, the default colors of elements during image editing are not significantly different from the image colors, making it difficult for users to distinguish them and requiring additional steps, thus affecting the user experience.

Method used

By acquiring the color information of the image, the color of the element to be edited is determined, and the element is output on the image using this color to ensure that the element is clearly visible. This includes using relative brightness parameters and preset thresholds to determine the color information and selecting colors with contrast effects.

Benefits of technology

It improves the display effect and reliability of image editing, reduces the user's operating cost, optimizes the editing experience, and adapts to image editing under different lighting conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549693B_ABST
    Figure CN114549693B_ABST
Patent Text Reader

Abstract

The present disclosure provides a picture editing method and device, electronic equipment and storage medium, relates to the technical field of computers, in particular to the technical field of image processing, and in particular to the technical field of computer vision, image synthesis and the like. The specific implementation scheme is: in response to the operation of a user based on the application interface of a social application, a picture to be processed is acquired, the color of an element to be edited on the picture is determined according to the color condition of the picture, and in response to the operation of the user based on the picture, the element to be edited is output on the picture by using the color.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, specifically to the fields of computer vision, image synthesis technology, and other related technologies. Background Technology

[0002] With the widespread use of mobile applications and software, image editing functions are a frequently used and fundamental feature. When using these applications and software, users often edit and process images according to their own needs, such as adding personalized text, graphics, and annotations.

[0003] Currently, when editing images, the displayed colors of elements are generally fixed colors, which are the default color options in the application or software. Summary of the Invention

[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for image editing.

[0005] According to one aspect of this disclosure, a method for image editing is provided, comprising:

[0006] Responding to user actions on the application interface of a social application, retrieve the image to be processed;

[0007] Based on the color characteristics of the image, determine the color of the element to be edited in the image;

[0008] In response to the user's operation based on the image, the element to be edited is output on the image using the color.

[0009] According to another aspect of this disclosure, an apparatus for image editing is provided, comprising:

[0010] The acquisition unit is used to acquire the image to be processed in response to user operations based on the application interface of the social application;

[0011] The determining unit is used to determine the color of the element to be edited in the image based on the color characteristics of the image;

[0012] An output unit is configured to, in response to a user's operation based on the image, output the element to be edited on the image using the color.

[0013] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0014] At least one processor; and

[0015] A memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the methods described above and any possible implementations.

[0017] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions for causing the computer to perform the methods described above and any possible implementation thereof.

[0018] According to another aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the aspects and any possible implementations described above.

[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0020] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0021] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;

[0022] Figure 2A and Figure 2B This is a schematic diagram showing an image of an element to be edited output according to the first embodiment of this disclosure;

[0023] Figure 3 This is a schematic diagram according to the second embodiment of the present disclosure;

[0024] Figure 4 This is a schematic diagram according to the third embodiment of the present disclosure;

[0025] Figure 5 This is a block diagram of an electronic device used to implement the image editing method of the embodiments of this disclosure. Detailed Implementation

[0026] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0027] Obviously, the described embodiments are only some, not all, of the embodiments disclosed herein. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0028] It should be noted that the terminal devices involved in the embodiments of this disclosure may include, but are not limited to, smart devices such as mobile phones, personal digital assistants (PDAs), wireless handheld devices, and tablet computers; the display devices may include, but are not limited to, personal computers, televisions, and other devices with display functions.

[0029] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0030] With the widespread use of mobile social applications and software, in addition to using professional image editing software, users can also use the image editing functions within social applications and software to edit images.

[0031] Typically, when using social media applications and software, users edit and process images according to their own needs, such as adding personalized text, graphics, and annotations.

[0032] Currently, when editing images using image editing functions in social media applications and software, the displayed colors of elements are generally fixed colors, which are the default color options in the application or software. For example, when editing general images using social media applications or image editing software, the default color of added elements is often white; when editing screenshots obtained from social media applications, the default color of added elements is often red.

[0033] However, because a fixed color is used as the default color option for elements, if the color of the added element and the image color are not significantly different, making it difficult for users to identify the element, the element's display color needs to be adjusted. For example, for automatically placed elements like text, when the image color is similar to the fixed color of the text, users may easily miss the target text, creating the illusion that the text was not successfully added. This also increases the difficulty of selecting text subsequently, resulting in a poor user experience.

[0034] Moreover, due to the limited screen space and touch operation of mobile terminals, completing a single image editing operation often requires switching between multiple views. If color adjustments are also required, the operation becomes even more cumbersome, increasing the user's operational costs.

[0035] Therefore, there is an urgent need to provide a method for image editing that can clearly display the elements to be edited in the image, thereby improving the display effect and reliability of the edited image.

[0036] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure, as shown below. Figure 1 As shown.

[0037] 101. Respond to user actions on the application interface of the social application and obtain the image to be processed.

[0038] 102. Determine the color of the element to be edited in the image based on its color characteristics.

[0039] 103. In response to the user's operation based on the image, output the element to be edited on the image using the color.

[0040] It should be noted that the images to be processed can include stored images as well as images captured using social media applications, i.e., screenshots.

[0041] The elements to be edited can include at least one of the following elements added to the image: text, graphics, lines, brushes, and annotations.

[0042] It should be noted that user actions within the social application's interface can refer to actions performed within the social application itself, such as accessing the image editing interface. For example, a user might access the photo album application through the social application's interface and select an image from their album; or, a user might use the screenshot tool within the social application's interface to capture the desired image.

[0043] It should be noted that user operations based on the image can refer to the user performing corresponding editing operations on the elements to be edited within the image. For example, editing added text, graphics, or annotation styles.

[0044] It should be noted that some or all of the execution entities of 101 to 103 can be applications located on the local terminal, or they can be plugins or software development kits (SDKs) or other functional units set in applications located on the local terminal, or they can be processing engines located on the network-side server, or they can be distributed systems located on the network side, such as processing engines or distributed systems in image processing platforms on the network side. This embodiment does not impose any special limitations on these.

[0045] It is understood that the application may be a native program installed on the local terminal, or it may be a web application of a browser on the local terminal. This embodiment does not limit this.

[0046] In this way, by responding to user operations based on the application interface of the social application, the image to be processed is obtained. Then, based on the color characteristics of the image, the color of the element to be edited on the image can be determined. This allows the element to be edited to be displayed on the image using the color, in response to the user's operation based on the image. Since the color of the element to be edited on the image is determined by the color characteristics of the image, the element to be edited can be displayed in the image based on that color when the user performs image editing operations, ensuring that the element to be edited in the image is clearly visible, thereby improving the display effect and reliability of the edited image.

[0047] Optionally, in one possible implementation of this embodiment, before step 102, the relative brightness parameter of the image can be further determined, and then the color condition of the image can be determined based on the relative brightness parameter of the image and a preset threshold.

[0048] In this implementation, the relative brightness parameter can be relative luminance, which is relative light brightness. It can refer to the relative brightness of any point in the color mode. The relative luminance can be the normalized relative luminance. A relative luminance of 0 indicates deep black, and a relative luminance of 1 indicates bright white.

[0049] Specifically, the preset threshold can be a preset relative brightness threshold. This preset threshold can be determined based on a preset contrast threshold. This preset contrast threshold can be a preset contrast threshold between the element to be edited in the image and the image background. This preset contrast threshold can be determined based on the size of the element to be edited in the image and the image size.

[0050] For example, the preset contrast threshold could be the minimum contrast specified in the Web Content Accessibility Guidelines (WCAG). This minimum contrast is 4.5 between plain text and the background.

[0051] Understandably, the WCAG guidelines here can be WCAG 2.1 guidelines, plain text can correspond to the elements to be edited, and background can correspond to images.

[0052] In one specific implementation of this method, a preset color mode can be used to obtain the color value of each pixel in the image. Then, based on the color value of each pixel, the relative brightness parameter of each pixel can be determined. Finally, based on the relative brightness parameter of each pixel and a preset threshold, the color condition of the image can be determined.

[0053] Specifically, the preset color modes may include at least one of the following: red-green-blue (RGB) color mode, hue-saturation-value / brightness (HSV / HSB) color mode, and hue-saturation-intensity / lightness (HSI / HSL) color mode.

[0054] In one specific implementation, the RGB color mode can be used to obtain the color value of each pixel in the image. Then, based on the color value of each pixel, the relative brightness parameter of each pixel can be calculated. Finally, the color status of the image can be determined based on the relative brightness parameter of each pixel and a preset threshold.

[0055] Here, the color value of each pixel can be the RGB value of each pixel, namely the R value, G value, and B value.

[0056] Specifically, after obtaining the RGB values ​​of each pixel in the image, the RGB values ​​of each pixel can be normalized. Then, based on the normalized RGB values ​​of each pixel and a preset brightness algorithm, the relative brightness parameter of each pixel is calculated. Finally, based on the relative brightness parameter of each pixel and a preset threshold, the color state of the image is determined.

[0057] In another specific implementation, the color value of each pixel in the image can be obtained using the HSV / HSB color mode. Then, based on the color value of each pixel, the relative brightness parameter of each pixel can be determined. Finally, based on the relative brightness parameter of each pixel and a preset threshold, the color condition of the image can be determined.

[0058] In this implementation, the color scheme of the image can include both light and dark colors.

[0059] In another specific implementation of this method, the relative brightness parameter of each pixel in the image can be compared with a preset threshold to obtain the color status of each pixel, thereby determining the color status of the image.

[0060] In this specific implementation, for any pixel in the image, if the relative brightness parameter of that pixel exceeds a preset threshold, then the color of that pixel can be determined to be light.

[0061] Alternatively, if the relative brightness parameter of the pixel does not exceed the preset threshold, then the color of the pixel can be determined to be dark.

[0062] Furthermore, the color characteristics of the image can be determined based on the color characteristics of each pixel.

[0063] In one specific implementation, if the number of pixels whose relative brightness parameter exceeds a preset threshold is greater than or equal to a preset proportion, then the color of the image can be determined to be light.

[0064] In another specific implementation, if the number of pixels whose relative brightness parameter exceeds a preset threshold is less than a preset ratio, then the color of the image can be determined to be dark.

[0065] Specifically, the preset ratio can be 50%, which means that the percentage of pixels whose relative brightness parameters exceed the preset threshold is 50% of the total number of pixels in the image.

[0066] In another specific implementation of this method, the average or weighted average of the relative brightness parameters of each pixel in the image can be calculated to obtain the relative brightness parameters of the image. Then, the relative brightness parameters of the image are compared with a preset threshold to determine the color condition of the image.

[0067] In one specific implementation, if the relative brightness parameter of the image exceeds a preset threshold, the color of the image can be determined to be light.

[0068] In another specific implementation, if the relative brightness parameter of the image does not exceed a preset threshold, then the color of the image can be determined to be dark.

[0069] In this way, by using the relative brightness parameter and preset threshold of the image, the color of the image can be determined more accurately, that is, whether the image is a light or dark color. This allows for the determination of the color of the elements to be edited based on the image's color, thus ensuring that all elements edited in the image are clearly displayed and guaranteeing the effectiveness and reliability of the edited image.

[0070] Optionally, in one possible implementation of this embodiment, in step 102, a color that has a contrasting effect with the color of the image can be selected from the available colors based on the color of the image, and used as the color of the element to be edited on the image.

[0071] In one specific implementation of this method, at least one optional color that has a contrasting effect with the color of the image can be determined based on the color of the image. Then, a color can be selected from the optional colors as the color of the element to be edited on the image.

[0072] For example, if the image is light-colored, then black can be used as the color of the element to be edited in the image, such as... Figure 2A shown. Specifically, Figure 2A The image in the middle is light-colored, while the element to be edited, namely the text "Image Editing," is black.

[0073] Alternatively, for example, if the image is dark in color, then white can be used as the color of the element to be edited in the image, such as... Figure 2B shown. Specifically, Figure 2B The image in the middle is dark in color, while the element to be edited, i.e., the text "Image Editing," is white.

[0074] Understandably, in addition to the selected color, other available colors can serve as alternative colors for the element to be edited, and these alternative colors can be displayed on the application interface for users to select colors.

[0075] In another specific implementation of this method, at least one selectable color that has a contrast effect with the color of the image can be determined based on the color of the image and a preset contrast threshold. Then, a color can be selected from the selectable colors as the color of the element to be edited on the image.

[0076] In this specific implementation process, the relative brightness parameter corresponding to at least one color whose contrast parameter exceeds the preset contrast threshold can be calculated based on the relative brightness parameter corresponding to the color situation of the image and the preset contrast threshold, so as to determine at least one optional color that has a contrast effect with the color situation of the image.

[0077] It is understood that the preset contrast threshold may be the minimum contrast specified in the WCAG guidelines, or it may be a contrast threshold determined by existing technology, which will not be elaborated here.

[0078] In this way, by selecting a color from the available colors that has a contrasting effect with the color scheme of the image, and using the selected color as the color of the element to be edited on the image, the element to be edited can be clearly and effectively displayed on the image, further improving the display effect of the element to be edited in the image, thereby enhancing the effectiveness and reliability of the edited image.

[0079] It should be noted that the various specific implementation processes for determining the color of an image and the color of the element to be edited on the image provided in the aforementioned implementation methods can be combined with the various specific implementation processes for determining the color of the element to be edited on the image provided in this implementation method to realize the image editing method of this embodiment. Detailed descriptions can be found in the relevant content of the aforementioned implementation methods, and will not be repeated here.

[0080] Optionally, in one possible implementation of this embodiment, in step 102, the color of the image at the position to be output on the image can be determined specifically based on the position of the element to be edited at the position to be output, and then the color of the element to be edited can be determined based on the color of the image at the position to be output.

[0081] In this implementation, the position of the element to be edited on the image to be output can be the default output position of the application.

[0082] Alternatively, the position of the element to be edited on the image to be output may be a position determined in response to user operations based on the image.

[0083] Specifically, the position of the element to be edited on the image may include position coordinates and at least one of the position regions.

[0084] The location region can be a region determined according to different division methods. For example, the location region can include the upper, middle, and lower parts of the image, or the left, middle, and right parts of the image.

[0085] In this implementation, the color of the image at the position to be output can be the color of the image corresponding to the position to be output.

[0086] In one specific implementation of this method, the color of the image at the position to be output can be directly obtained based on the position of the element to be edited on the image.

[0087] In another specific implementation of this method, the relative brightness parameter of the image at the position to be output on the image can be obtained first, based on the position of the element to be edited on the image. Then, based on the relative brightness parameter of the image at the position to be output and a preset threshold, the color of the image at the position to be output is determined.

[0088] In another specific implementation of this method, the color of the image at the position to be output can be determined based on the position of the element to be edited on the image. Then, based on the color of the image at the position to be output, a color with a contrasting effect with the color of the image can be selected from the available colors to be used as the color of the element to be edited on the image.

[0089] In this way, by determining the color of the image at the position where the element to be edited is to be output on the image, the color of the element to be edited is determined. Since the color of the element to be edited is determined using the color of the image at the position corresponding to the element's output location—that is, the color of a local area of ​​the image—the display effect of the element to be edited can be further guaranteed, improving the effectiveness and reliability of the edited image. Moreover, since the color of the element to be edited only needs to be determined based on the color of a local area of ​​the image, the efficiency of image editing is improved.

[0090] It should be noted that the various specific implementation processes for determining the color of an image and the color of the element to be edited on the image provided in the aforementioned implementation methods can be combined with the various specific implementation processes for determining the color of the element to be edited on the image provided in this implementation method to realize the image editing method of this embodiment. Detailed descriptions can be found in the relevant content of the aforementioned implementation methods, and will not be repeated here.

[0091] Optionally, in one possible implementation of this embodiment, after step 103, the color of the image at the position where the element to be edited has been output on the image can be further determined based on the position of the element to be edited at the output position, and then the color of the output element to be edited can be adjusted based on the color of the image at the output position.

[0092] In one specific implementation of this method, after the position of the element to be edited on the image has been output, in response to the user's editing operation on the element to be edited, the color of the image at the position of the element to be edited on the image can be determined according to the position of the element to be edited on the image, and then the color of the output element to be edited can be adjusted according to the color of the image at the position of the image.

[0093] Specifically, when a user performs an editing operation on an element to be edited, the color of the element to be edited can be adjusted in real time according to the color of the image corresponding to the position of the element to be edited.

[0094] For example, when a user adds text to an image, the position of the text changes as the amount of text increases, potentially occupying more of the image area. Therefore, the text color can be adjusted based on the color of the image area it occupies.

[0095] In this way, by determining the color of the image at the already output position of the element to be edited on the image, and adjusting the color of the output element to be edited, the color of the output element to be edited can be dynamically adjusted in real time during the image editing process. This enables the application to flexibly adjust the color of the elements to be edited in the image, improves the flexibility of color adjustment for each element being edited, optimizes the display effect of each element being edited in the image, and thus further improves the display effect and reliability of the edited image.

[0096] Optionally, in one possible implementation of this embodiment, after step 103, it can further respond to the user's adjustment operation on the position of the element to be edited on the image, that is, respond to the user's movement operation on the element to be edited, obtain the adjusted position of the element to be edited on the image, determine the color of the image at the adjusted position, and then adjust the color of the output element to be edited according to the color of the image at the adjusted position.

[0097] Understandably, users can move the element to be edited in the image, that is, adjust the position of the element to be edited in the image. Therefore, after the user moves the element to be edited, they can determine the color of the image at that position based on the adjusted position of the element to be edited in the image, and then adjust the color of the output element to be edited based on the color of the image at that position.

[0098] In this way, by responding to the user's movement of the element to be edited and adjusting the color of the output element to be edited, the flexibility of color adjustment of the element to be edited can be further improved.

[0099] It should be noted that the various specific implementation processes for outputting the editable element on the image using color provided in the aforementioned implementation methods can be combined with the various specific implementation processes for adjusting the color of the output editable element provided in this implementation method to realize the image editing method of this embodiment. Detailed descriptions can be found in the relevant content of the aforementioned implementation methods, and will not be repeated here.

[0100] In this embodiment, by responding to user operations based on the application interface of a social application, an image to be processed is acquired. Then, based on the color characteristics of the image, the color of the element to be edited on the image is determined. This allows the element to be displayed on the image using its color in response to user operations. Because the color of the element to be edited is determined by the image's color characteristics, the element can be displayed in the image based on that color during image editing, ensuring that the element is clearly visible and thus improving the display effect and reliability of the edited image. Furthermore, it enables flexible adjustment of the color of the element to be edited in the image by the application, optimizing the user's image editing experience.

[0101] Furthermore, by employing the technical solution provided in this embodiment, the color condition of an image can be determined through the relative brightness parameter and a preset threshold. This allows for a more accurate determination of the image's color condition, i.e., whether the image is light or dark. This enables the subsequent determination of the color of the element to be edited based on the image's color condition, thereby ensuring that all elements edited in the image are clearly displayed and guaranteeing the effectiveness and reliability of the edited image.

[0102] Furthermore, by employing the technical solution provided in this embodiment, a color with a contrasting effect to the color of the image can be selected from the available colors based on the color characteristics of the image. This selected color can then be used as the color of the element to be edited on the image, thereby enabling the element to be edited to be displayed clearly and effectively on the image. This further enhances the display effect of the element to be edited in the image, thereby improving the effectiveness and reliability of the edited image.

[0103] Furthermore, by employing the technical solution provided in this embodiment, the color of the image at the position to be output on the image can be determined based on the position of the element to be edited, thereby determining the color of the element to be edited. Since the color of the image at the position corresponding to the element's output position—that is, the color of a local portion of the image—is used to determine the color of the element to be edited, the display effect of the element to be edited can be further guaranteed, improving the effectiveness and reliability of the edited image. Moreover, since the color of the element to be edited only needs to be determined based on the local color of the image, the efficiency of image editing is improved.

[0104] Furthermore, by employing the technical solution provided in this embodiment, the color of the image at the already output position of the element to be edited can be determined, thereby adjusting the color of the output element to be edited. This enables real-time dynamic adjustment of the color of the output element to be edited during image editing, allowing the application to flexibly adjust the color of the elements to be edited in the image. This improves the flexibility of color adjustment for each element being edited, optimizes the display effect of each element being edited in the image, and further enhances the display effect and reliability of the edited image.

[0105] Furthermore, by adopting the technical solution provided in this embodiment, the color of the output element to be edited can be adjusted in response to the user's movement operation of the element to be edited, which can further improve the flexibility of color adjustment of the element to be edited.

[0106] Furthermore, by adopting the technical solution provided in this embodiment, the display color of the editable element that is easy for the user to identify can be automatically determined according to the color of the image. This enables the application to flexibly adjust the color of the editable element in the image, provides the user with more appropriate default color settings, reduces the user's operation of adjusting the display color of the editable element, reduces the user's operating cost, brings a smoother image editing experience, and optimizes the user experience during the image editing process.

[0107] Figure 3 This is a schematic diagram based on the second embodiment of the present disclosure, as shown below. Figure 3 As shown.

[0108] 301. Respond to user actions on the application interface of a social application and obtain the image to be processed.

[0109] 302. Determine the relative brightness parameters of the image.

[0110] 303. Determine the color characteristics of the image based on its relative brightness parameters and preset threshold.

[0111] Specifically, we can first use the RGB color mode to obtain the color value of each pixel in the image.

[0112] Specifically, the color value of each pixel in an image is the RGB value of each pixel, namely the R value, G value, and B value of each pixel.

[0113] Then, the relative brightness algorithm in the WCAG 2.1 guideline can be used to calculate the relative brightness parameter of each pixel based on the color value of each pixel.

[0114] Specifically, the RGB values ​​of each pixel can be normalized using the calculation formula (1), i.e., standardized:

[0115] RsRGB = R8bit / 255

[0116] GsRGB = G8bit / 255 (1)

[0117] BsRGB = B8bit / 255

[0118] If RsRGB ≤ 0.03928, then R = RsRGB / 12.92.

[0119] Otherwise, R = ((RsRGB + 0.055) / 1.055)^2.4;

[0120] If GsRGB ≤ 0.03928, then G = GsRGB / 12.92.

[0121] Otherwise, G = ((GsRGB + 0.055) / 1.055)^2.4;

[0122] If BsRGB ≤ 0.03928, then B = BsRGB / 12.92.

[0123] Otherwise, G = ((BsRGB + 0.055) / 1.055)^2.4.

[0124] RsRGB, GsRGB, and BsRGB can be calculation parameters, and ^ is the exponentiation operator.

[0125] After calculating the normalized RGB value of each pixel, the relative brightness parameter of each pixel, i.e., the relative brightness L, can be calculated using the following formula (2). A normalized value of 0 represents deep black, and a value of 1 represents bright white.

[0126] L=0.2126R+0.7152G+0.0722B (2)

[0127] Next, the relative brightness parameter of each pixel in the image can be compared with a preset threshold to determine the color of each pixel.

[0128] Specifically, for any pixel in an image, if the relative brightness parameter of that pixel exceeds a preset threshold, then the color of that pixel can be determined to be light.

[0129] Alternatively, if the relative brightness parameter of the pixel does not exceed the preset threshold, then the color of the pixel can be determined to be dark.

[0130] Furthermore, the color scheme of the image is determined based on the color characteristics of each pixel.

[0131] If the number of pixels whose relative brightness parameter exceeds a preset threshold is greater than or equal to a preset proportion, then the color of the image can be determined to be light.

[0132] If the number of pixels whose relative brightness parameter exceeds a preset threshold is less than a preset ratio, then the color of the image can be determined to be dark.

[0133] In addition, the preset threshold can be determined based on the minimum contrast specified in the WCAG 2.1 guidelines.

[0134] Specifically, in the WCAG 2.1 guidelines, the specific formula for calculating contrast is shown in formula (3):

[0135] (L1+0.05) / (L2+0.05) (3)

[0136] Where L1 is the relative brightness of light colors, which have a larger relative brightness, and L2 is the relative brightness of dark colors.

[0137] In the WCAG 2.1 guidelines, the text-to-background contrast ratio must not be lower than 4.5:1, meaning the minimum contrast ratio is 4.5. Based on this, when setting the preset threshold, the background image can be set to a light color, meaning the relative brightness of the image corresponds to L1. When the relative brightness of the dark color L2 is 0, the calculated L1, according to formula (4), needs to be greater than 0.175. Therefore, the preset threshold for the relative brightness of the image can be 0.175.

[0138] (L1+0.05) / (0.05)>4.5 (4)

[0139] 304. Based on the color scheme of the image, select a color from the available colors that has a contrasting effect with the color scheme of the image, and use it as the color of the element to be edited on the image.

[0140] Understandably, the selectable colors and contrast of these elements to be edited are in line with the standards of the WCAG 2.1 guidelines, and visually impaired individuals can clearly identify the elements to be edited.

[0141] In this embodiment, the color of the image at the position to be output can be determined based on the position of the element to be edited on the image. Then, based on the color of the image at the position to be output, a color with a contrasting effect with the color of the image can be selected from the available colors to be used as the color of the element to be edited on the image.

[0142] 305. In response to user actions based on an image, output the element to be edited on the image using color.

[0143] 306. Based on the position of the element to be edited on the image, determine the color of the image at the position that has already been output.

[0144] 307. Adjust the color of the element to be edited in the output based on the color of the image in the output position.

[0145] In this embodiment, the color of the element to be edited in the image is determined by the color of the image. When the user performs image editing operations, the element to be edited can be displayed in the image based on this color. This enables the application to flexibly adjust the color of the element to be edited in the image, ensuring that the elements displayed in the image are clearly visible. This improves the display effect of each element in the edited image and enhances the effectiveness and reliability of the edited image.

[0146] Furthermore, by employing the technical solution provided in this embodiment, the colors of the elements to be edited in the image can be determined based on the WCAG 2.1 guidelines, according to the image's color characteristics. This allows even visually impaired individuals to clearly identify the elements to be edited in the output image, thereby further improving the display effect of each element in the edited image and enhancing the reliability of the edited image.

[0147] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this disclosure.

[0148] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0149] Figure 4 This is a schematic diagram based on the third embodiment of the present disclosure, as shown below. Figure 4 As shown. The image editing apparatus 400 of this embodiment may include an acquisition unit 401, a determination unit 402, and an output unit 403. The acquisition unit 401 is used to acquire an image to be processed in response to a user's operation based on the application interface of a social application; the determination unit 402 is used to determine the color of the element to be edited on the image based on the color characteristics of the image; and the output unit 403 is used to output the element to be edited on the image using the color in response to the user's operation based on the image.

[0150] It should be noted that some or all of the image editing device in this embodiment may be an application located on a local terminal, or it may be a plugin or software development kit (SDK) or other functional unit set in an application located on a local terminal, or it may be a processing engine located on a network-side server, or it may be a distributed system located on the network side, such as a processing engine or distributed system in a network-side image processing platform, etc. This embodiment does not impose any particular limitations on this.

[0151] It is understood that the application may be a native program installed on the local terminal, or it may be a web application of a browser on the local terminal. This embodiment does not limit this.

[0152] Optionally, in one possible implementation of this embodiment, the determining unit 402 can also be used to determine the relative brightness parameter of the image, and determine the color status of the image based on the relative brightness parameter of the image and a preset threshold.

[0153] Optionally, in one possible implementation of this embodiment, the determining unit 402 may be specifically used to select a color from the selectable colors that has a contrasting effect with the color of the image, based on the color of the image, as the color of the element to be edited on the image.

[0154] Optionally, in one possible implementation of this embodiment, the determining unit 402 can also be used to determine the color of the image at the position to be output on the image based on the position of the element to be edited on the image, and to determine the color of the element to be edited based on the color of the image at the position to be output.

[0155] Optionally, in one possible implementation of this embodiment, the output unit 403 can also be used to determine the color of the image at the position where the element to be edited has been output on the image, and adjust the color of the output element to be edited according to the color of the image at the position where the element to be edited has been output.

[0156] In this embodiment, the acquisition unit acquires the image to be processed in response to the user's operation based on the application interface of the social application. Then, the determination unit determines the color of the element to be edited on the image based on the color of the image. This allows the output unit to respond to the user's operation based on the image and output the element to be edited on the image using the color. Since the color of the element to be edited on the image is determined by the color of the image, the element to be edited can be displayed in the image based on that color when the user performs image editing operations. This enables the application to flexibly adjust the color of the element to be edited in the image, ensuring that the element to be edited displayed in the image is clearly visible, thereby improving the display effect and reliability of the edited image.

[0157] Furthermore, by employing the technical solution provided in this embodiment, the color condition of an image can be determined through the relative brightness parameter and a preset threshold. This allows for a more accurate determination of the image's color condition, i.e., whether the image is light or dark. This enables the subsequent determination of the color of the element to be edited based on the image's color condition, thereby ensuring that all elements edited in the image are clearly displayed and guaranteeing the effectiveness and reliability of the edited image.

[0158] Furthermore, by employing the technical solution provided in this embodiment, a color with a contrasting effect to the color of the image can be selected from the available colors based on the color characteristics of the image. This selected color can then be used as the color of the element to be edited on the image, thereby enabling the element to be edited to be displayed clearly and effectively on the image. This further enhances the display effect of the element to be edited in the image, thereby improving the effectiveness and reliability of the edited image.

[0159] Furthermore, by employing the technical solution provided in this embodiment, the color of the image at the position to be output on the image can be determined based on the position of the element to be edited, thereby determining the color of the element to be edited. Since the color of the image at the position corresponding to the element's output position—that is, the color of a local portion of the image—is used to determine the color of the element to be edited, the display effect of the element to be edited can be further guaranteed, improving the effectiveness and reliability of the edited image. Moreover, since the color of the element to be edited only needs to be determined based on the local color of the image, the efficiency of image editing is improved.

[0160] Furthermore, by employing the technical solution provided in this embodiment, the color of the image at the already output position of the element to be edited can be determined, thereby adjusting the color of the output element to be edited. This enables real-time dynamic adjustment of the color of the output element to be edited during the image editing process, improving the flexibility of color adjustment for each element being edited, optimizing the display effect of each element being edited in the image, and further enhancing the display effect and reliability of the edited image.

[0161] Furthermore, by adopting the technical solution provided in this embodiment, the color of the output element to be edited can be adjusted in response to the user's movement operation of the element to be edited, which can further improve the flexibility of color adjustment of the element to be edited.

[0162] Furthermore, by adopting the technical solution provided in this embodiment, the display color of the editable element that is easy for the user to identify can be automatically determined according to the color of the image. This enables the application to flexibly adjust the color of the editable element in the image, provides the user with more appropriate default color settings, reduces the user's operation of adjusting the display color of the editable element, reduces the user's operating cost, brings a smoother image editing experience, and optimizes the user experience during the image editing process.

[0163] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in this technical solution comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0164] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0165] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0166] like Figure 5As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. The RAM 503 may also store various programs and data required for the operation of the electronic device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0167] Multiple components in electronic device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows electronic device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0168] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as the image editing method. For example, in some embodiments, the image editing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the image editing method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the image editing method by any other suitable means (e.g., by means of firmware).

[0169] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0170] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

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

[0172] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0173] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0174] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0175] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0176] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for image editing, comprising: In response to a user's operation of entering an image editing interface in the application interface of a social application, an image to be processed is obtained, wherein the image is a stored image or an image captured using the social application; Based on the color characteristics of the image, determine the color of the element to be edited on the image, where the element to be edited is the element to be added to the image; In response to the user's editing operation on the element to be edited in the image, the element to be edited is output on the image using the color; The step of determining the color of the element to be edited in the image based on its color characteristics includes: Based on the position of the element to be edited on the image to be output, determine the color of the image at the position to be output, wherein the position to be output is either a default position or a position determined in response to the user's operation based on the image; The color of the element to be edited is determined based on the color of the image at the position to be output. In response to the user's editing operation on the element to be edited in the image, after outputting the element to be edited on the image using the color, the method further includes: Based on the position of the element to be edited on the image, determine the color of the image at the position it has already been output; Adjust the color of the element to be edited in the output based on the color of the image at the output position.

2. The method according to claim 1, wherein, Before determining the color of the element to be edited in the image based on its color characteristics, the process includes: Determine the relative brightness parameters of the image; The color of the image is determined based on the relative brightness parameter and a preset threshold.

3. The method according to claim 1 or 2, wherein, Determining the color of the element to be edited in the image based on its color characteristics includes: Based on the color scheme of the image, select a color from the available colors that has a contrasting effect with the color scheme of the image, and use it as the color of the element to be edited on the image.

4. An image editing apparatus, comprising: The acquisition unit is used to acquire an image to be processed in response to a user's operation of entering the image editing interface in the application interface of a social application. The image is either a stored image or an image captured using the social application. The determining unit is used to determine the color of the element to be edited on the image based on the color characteristics of the image, wherein the element to be edited is an element to be added to the image; An output unit is configured to output the element to be edited on the image using the color in response to the user's editing operation on the image. The determining unit is further used for Based on the position of the element to be edited on the image to be output, determine the color of the image at the position to be output, wherein the position to be output is either a default position or a position determined in response to the user's operation based on the image; The color of the element to be edited is determined based on the color of the image at the position to be output. The output unit is also used for Based on the position of the element to be edited on the image, determine the color of the image at the position it has already been output; Adjust the color of the element to be edited in the output based on the color of the image at the output position.

5. The apparatus according to claim 4, wherein, The determining unit is also used for Determine the relative brightness parameters of the image; The color of the image is determined based on the relative brightness parameter and a preset threshold.

6. The apparatus according to claim 4 or 5, wherein, The determining unit is specifically used for Based on the color scheme of the image, select a color from the available colors that has a contrasting effect with the color scheme of the image, and use it as the color of the element to be edited on the image.

7. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-3.

8. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-3.

9. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-3.