Picture processing method and related device

Through content-aware compression and cropping technology based on pre-trained image analysis model, the problem of inefficient image optimization in the existing technology is solved, and faster web page loading speed and better multi-device adaptation effect are achieved.

CN119645278APending Publication Date: 2025-03-18SHENZHEN TCL NEW-TECH CO LTD

Patent Information

Application Number
CN202411668259.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The prior art has problems such as inefficiency and difficulty in achieving dynamic optimization and multi-device adaptation in improving image optimization efficiency and front-end page loading speed.

Method used

By receiving the original pictures uploaded by the user, the image information is extracted, and the key content and general content of the picture are determined based on the pre-trained image analysis model. Based on this information, different processing strategies are used for compression and cropping, intermediate pictures are generated, and multiple target pictures with different resolutions are generated based on intermediate pictures.

Benefits of technology

Improves image optimization efficiency, significantly shortens web page loading time, reduces bandwidth consumption, and ensures the best visual experience in different devices and network environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645278A_ABST
    Figure CN119645278A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a picture processing method and a related device, which are used for improving the picture optimization efficiency and improving the loading speed of a front-end page. The picture processing method comprises the following steps: receiving an original picture uploaded by a user, and extracting picture information of the original picture; analyzing the original picture based on a pre-trained picture analysis model to determine key content and general content of the original picture; according to picture information of the original picture, compression processing and cutting processing are carried out on the key content and the general content through different processing strategies, an intermediate picture is obtained, and the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content; and generating a plurality of target pictures with different resolutions according to the intermediate picture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method and related devices. Background Art

[0002] With the rapid development of the Internet, the complexity and richness of web page content have increased significantly. Multimedia resources such as pictures and videos have become an important part of web pages, and web page loading speed has become an important consideration for user experience. However, with the increase of these multimedia resources, image files occupy a large part of web page transmission data. Especially on mobile devices and slow network environments, the bottleneck of image loading speed will significantly affect user experience, and then affect the website's bounce rate and user retention.

[0003] In the existing technology, image optimization technology mainly relies on manual compression, cropping, format conversion and other methods, which is not only inefficient, but also difficult to achieve dynamic optimization and multi-device adaptation. Therefore, how to provide an image optimization method to improve the efficiency of image optimization and thus increase the loading speed of the front-end page is a problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present application provide an image processing method and related devices for improving image optimization efficiency and increasing the loading speed of front-end pages.

[0005] A first aspect of an embodiment of the present application provides an image processing method, including: receiving an original image uploaded by a user, and extracting image information of the original image; analyzing the original image based on a pre-trained image analysis model to determine the key content and general content of the original image; according to the image information of the original image, compressing and cropping the key content and the general content using different processing strategies to obtain an intermediate image, wherein the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content; and generating multiple target images with different resolutions based on the intermediate image.

[0006] Optionally, in a possible implementation, the analyzing the original image based on a pre-trained image analysis model includes: inputting the original image into a pre-trained neural network model to obtain key areas and general areas of the original image; highlighting the important content of the key areas, and analyzing and determining detailed information of the original image.

[0007] Optionally, in a possible implementation, after analyzing the original image based on the pre-trained image analysis model, the method further includes: detecting the browser information of the client to determine the image format supported by the client; switching the format of the original image to a target format based on the detailed information of the original image and the image format supported by the client, wherein the target format is included in the image format supported by the client.

[0008] Optionally, in a possible implementation, the compression and cropping of the key content and the general content using different processing strategies respectively according to the picture information of the original picture includes: analyzing the difference information between the key content and the general content in the original picture; compressing the key content and the general content respectively based on the difference information; obtaining the resolution information of the client, and cropping the original picture based on the resolution information of the client and the key content.

[0009] Optionally, in a possible implementation, after generating multiple target images with different resolutions, the method further includes: monitoring whether the network status of the terminal meets a preset condition; if so, sending the first image to the terminal through a content distribution network; if not, sending the second image to the terminal; wherein the first image and the second image are both included in the target image, the image quality of the first image is higher than that of the second image, and the image quality includes but is not limited to image resolution.

[0010] Optionally, in a possible implementation, generating multiple target images with different resolutions based on the intermediate image includes: scaling the intermediate image based on device information of the client to obtain the multiple target images, and the device information includes but is not limited to at least one of the following information: screen size and resolution information.

[0011] Optionally, in a possible implementation, extracting the image information of the original image includes: determining the image format of the original image through the file header information of the original image; extracting basic information of the original image, the basic information including but not limited to at least one of the following information: size information, resolution information and color space information.

[0012] The second aspect of the present application provides a processing device, including: a transceiver unit, used to receive an original picture uploaded by a user and extract image information of the original picture; an analysis unit, used to analyze the original picture based on a pre-trained image analysis model to determine the key content and general content of the original picture; a processing unit, used to compress and crop the key content and the general content using different processing strategies according to the image information of the original picture, to obtain an intermediate picture, wherein the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content; a generation unit, used to generate multiple target pictures with different resolutions based on the intermediate picture.

[0013] A third aspect of the present application provides an electronic device, comprising a memory and a processor, wherein the processor is used to implement the steps of the image processing method as described in any one of the first aspects above when executing a computer management program stored in the memory.

[0014] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the image processing methods described in the above aspects.

[0015] The fifth aspect of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the image processing methods described in the above aspects.

[0016] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: receiving the original picture uploaded by the user and extracting the picture information of the original picture; analyzing the original picture based on the pre-trained picture analysis model to determine the key content and general content of the original picture; according to the picture information of the original picture, using different processing strategies to compress and crop the key content and the general content respectively to obtain an intermediate picture, the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content; generating multiple target pictures with different resolutions based on the intermediate picture. The present application is based on artificial intelligence-based content-aware compression and optimization technology to intelligently identify and retain key visual content. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A flowchart of a possible image processing method provided in an embodiment of the present application;

[0018] Figure 2 A schematic diagram of a possible processing device provided in an embodiment of the present application;

[0019] Figure 3 A schematic diagram of the hardware structure of another possible electronic device provided in an embodiment of the present application;

[0020] Figure 4 A schematic diagram of a possible hardware structure of a computer-readable storage medium provided in an embodiment of the present application;

[0021] Figure 5 A possible system structure diagram provided for an embodiment of the present application. DETAILED DESCRIPTION

[0022] For ease of understanding, the relevant technologies involved in the embodiments of the present application are first described below.

[0023] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0024] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship. It should be noted that the naming of the parameters in this article is for the convenience of description. Other names can be used in practice, and this application does not limit it.

[0025] With the advancement of artificial intelligence (AI) and machine learning technology, AI-based large models can automatically perform intelligent image optimization processing, improve the loading speed of front-end pages, and enhance user experience. However, there is currently no mature automatic image optimization technology based on AI models on the market to comprehensively solve the multidimensional problems in image optimization. In view of this, the present application proposes a web page graphics processing method and system based on AI large models to achieve intelligent optimization of images.

[0026] To facilitate a better understanding of this application, some of the terms that may appear are explained below, including:

[0027] Convolutional Neural Network (CNN) is a deep learning model specifically designed to process grid-structured data (such as images). CNN extracts local features of images through convolution operations and captures abstract features at different levels through the stacking of multiple convolutional layers. It is widely used in image recognition, classification, segmentation and other tasks.

[0028] The Visual Attention Mechanism is designed based on the human visual system, allowing the model to automatically assign attention weights based on the content of the input image and focus on important image areas, thereby improving the accuracy and efficiency of the task. This mechanism is commonly used in tasks such as image generation, object detection, and semantic segmentation.

[0029] Content-Aware Compression is an intelligent compression technology that analyzes the content of the image and specifically compresses unimportant image areas, retaining the quality of important areas (such as faces or main objects), thereby minimizing file size while maintaining high-quality visual effects.

[0030] Structural Similarity Index (SSIM) is an indicator used to measure the similarity between two images based on the comparison of brightness, contrast and structural information.

[0031] Content Delivery Network (CDN) is a technology that optimizes the loading speed and availability of web pages and other online content by distributing content to server nodes in different geographical locations around the world. CDN helps speed up the transmission of media files such as images and videos, reduce latency, and improve user experience.

[0032] Based on this, see Figure 1 , is a flow chart of a possible image processing method provided in an embodiment of the present application, which specifically includes the following steps:

[0033] 101. Receive an original picture uploaded by a user, and extract picture information of the original picture;

[0034] The processing device receives the original image uploaded by the user, such as the original image uploaded by the developer to the website or content management system (CMS), and extracts the image information of the original image. Specifically, the image format of the original image is determined through the file header information of the original image, and the basic information of the original image is extracted. The basic information includes but is not limited to at least one of the following information: size information, resolution information and color space information. That is, by reading the file header information of the original image, the format of the original image such as JPEG, PNG, WebP, AVIF, etc. is identified, and then the basic information such as the width, height, resolution, color space, etc. of the original image is extracted. In this application, the specific extraction method can be to use a Python library such as Pillow, or other methods, which are not limited here.

[0035] Optionally, after receiving the uploaded original image, the original image may also be stored in a local database or cloud storage for future rollback or reprocessing.

[0036] 102. Analyze the original image based on a pre-trained image analysis model to determine key content and general content of the original image;

[0037] Specifically, after receiving the uploaded original image, the original image is input into the pre-trained image analysis model for content analysis, that is, the pre-trained CNN (such as YOLO) is used to identify the content type of the original image, determine the important visual area, such as human face, main object, text, etc., and the important visual area is called key content in this application, so as to realize the division of the original image into key content and general content. The specific process may include the following steps: 1 Input: convert the original image into an expression form suitable for computer processing, such as converting a three-dimensional object scene into a two-dimensional plane image for processing and analysis; 2 Segmentation: decompose the object and its components from the object scene image, and the components are composed of image primitives, and the object scene is decomposed into a hierarchical structure. In practical applications, segmentation can be regarded as a decision-making process, and its algorithm can be divided into two categories: image point technology and regional technology. Among them, the image point technology uses the threshold method to classify each image point, for example, the strokes in the text image are obtained by comparing the grayscale of the image point with the threshold; the regional technology uses the characteristics of texture, grayscale contrast of local area, etc. to detect boundaries, lines, regions, etc., and uses regional growth, merging, decomposition and other technologies to obtain the various components of the image. 3. Recognition: Give corresponding names to the objects segmented from the image, such as roads, bridges, buildings in natural scenes, or various machine parts on industrial automatic assembly lines. They can be classified according to shape and grayscale information using decision theory and structural methods, or a series of image models of known objects can be constructed to match and compare the objects to be identified with each image model. 4. Interpretation: Use heuristic methods or human-computer interaction technology combined with recognition methods to establish a hierarchical structure of the scene, explain what objects are in the scene, and the relationship between objects. In the case of three-dimensional scenes, various known information about the scene and the knowledge of the constraints between the objects in the scene can be used. For example, the surface direction of the three-dimensional scene can be inferred from the grayscale shadows, texture changes, and surface contour shapes in the two-dimensional image; the description and explanation of the three-dimensional scene can also be obtained based on ranging data or the calculation of depth of field from two-dimensional images at several different angles. For the description and explanation of the content of the scene, distinguish the key content and general content. For example, in a figure picture, including people, houses, and grass, the output result of the picture analysis model is: people as key content, houses and grass as general content.

[0038] Optionally, after determining the key content and general content, the key content is highlighted, or the key content is distinguished from the general content. For example, the key content is highlighted through a visual attention mechanism such as the Attention mechanism in Faster R-CNN to ensure that the key content is not damaged during the subsequent compression process, or the general content or the key content is marked so that it can be accurately distinguished later.

[0039] Optionally, in this application, different models can be used to analyze images, including but not limited to ResNet or EfficientNet, which are not specifically limited here.

[0040] 103. Switch the format of the original image to a target format;

[0041] Since different terminals support different image formats in actual applications, in this application, the browser information of the client, including User-Agent information, is obtained to determine the image formats supported by the client, and the format of the original image is switched to the target format according to the detailed information of the original image and the image formats supported by the client. The target format is included in the image formats supported by the client. For example, if the browser supports image formats such as JPEG, PNG, WebP, and AVIF, one or more formats can be randomly selected as the target format. Optionally, based on actual application conditions, such as considering that WebP and AVIF have more advantages in scenarios with high compression rates and low file sizes, the format of the original image is preferentially converted to WebP and / or AVIF format. If the device or browser does not support these formats, it is converted to the image format supported by the client.

[0042] It should be noted that the specific format conversion method can use image processing libraries such as Libvips, or different image processing libraries such as Pillow or FFmpeg to convert the image format. In view of the fact that the image format conversion is a relatively mature technology in the prior art, this application will not go into details.

[0043] 104. According to the picture information of the original picture, the key content and the general content are compressed and cropped using different processing strategies to obtain an intermediate picture;

[0044] In this application, the original image is compressed and cropped. In order to ensure that important content is not lost during the compression and cropping process, the difference information between the key content and the general content in the original image is analyzed, and then the key content and the general content are compressed respectively based on the difference information, and the resolution information of the client is obtained, and the original image is cropped based on the resolution information of the client and the key content. For example, using image analysis tools (such as Scikit-Image or OpenCV library), calculate indicators such as the edge complexity and color change frequency of the image, evaluate the richness of details of the image, and select a suitable compression strategy.

[0045] The image compression evaluation model based on structural similarity (Structural Similarity, SSIM) uses a perceptual compression algorithm (Perceptual Compression) to analyze the difference between the key content and unimportant content of the picture, and applies a higher compression rate to the unimportant parts in a targeted manner. The image segmentation algorithm based on deep learning (such as MaskR-CNN) crops the picture to retain the main content. It should be noted that in this application, the cropping strategy can be adaptively adjusted based on the device resolution and picture content. Optionally, in terms of content compression perception, this application can also use different picture evaluation models, such as Multi Scale Structural Similarity (MS-SSIM), etc., which are not limited here.

[0046] It should be noted that in this application, there are multiple ways to compress images. In addition to AI content perception, existing image compression algorithms and customized rule sets can also be used to set different compression rules according to the properties of the image (such as file size, resolution, color saturation, etc.), and automatically select appropriate compression algorithms and parameters. The specific compression method is not limited in this application.

[0047] Different compression algorithms and optimization strategies are selected based on the application scenario and importance level of the image. For example, images with core content use high-quality compression algorithms, while images with secondary content use fast but lossy compression methods. Each layer can be processed according to specific needs, thus achieving flexible optimization.

[0048] Optionally, in this application, if there are multiple original images, different compression algorithms and optimization strategies can be selected according to the application scenarios and importance levels of the original images. For example, images with key content use a high-quality compression algorithm, while images with general content use a fast but lossy compression method. Each layer can be processed according to specific needs, thereby achieving flexible optimization.

[0049] In addition, in order to improve the loading speed of pictures, the present application can compress and cache pictures in advance. Specifically, pre-optimization based on user behavior analysis. Using user behavior analysis technology, pictures that users may access are optimized and compressed in advance. By analyzing the user's browsing history, click habits, and access frequency, the system can predict the pictures that the user may need to load, and compress and cache them in advance to improve the loading speed of pictures.

[0050] 105. Generate a plurality of target images with different resolutions according to the intermediate image;

[0051] Based on the client's device information, the intermediate image is scaled to obtain the multiple target images. The device information includes but is not limited to at least one of the following information: screen size and resolution information. Specifically, according to the client's screen size and resolution, the system uses image scaling technology (such as Lanczos or Bicubic algorithm for high-quality scaling) to generate different resolution versions based on the original image through Libvips or Pillow library, such as 1x, 2x, and 3x resolution images. Each version is used for different terminal devices (such as mobile phones, tablets, and desktop devices). The generated responsive images will automatically match the front-end code. <picture>Or integrate the srcset tag to ensure that different devices load the appropriate image version.

[0052] 106. Send a corresponding picture to the terminal according to the network status of the terminal.

[0053] Monitor whether the network status of the terminal meets the preset conditions; if so, send the first picture to the terminal through the content distribution network; if not, send the second picture to the terminal; wherein the first picture and the second picture are both included in the target picture, and the picture quality of the first picture is higher than that of the second picture, and the picture quality includes but is not limited to the picture resolution. Specifically, the generated and optimized target picture is distributed through CDN, and the user's network status is monitored through JavaScript or other front-end detection technologies, and the information is fed back to the server. For example, if the network status of the terminal is detected, such as the network speed is less than the first preset value, it is considered that the terminal's network speed is poor, and a low-resolution target picture is sent to the terminal. Correspondingly, if the network speed is greater than the first preset value, a high-quality or higher-resolution target picture is sent to the terminal.

[0054] It should be noted that the present application can adjust the image quality or load a lower resolution version in real time through the edge computing node to adapt to different network conditions.

[0055] In this application, the above-mentioned image processing method is used to realize the uploading of original images, content analysis of AI models, format optimization, content-aware compression and cropping, and finally generate responsive images according to conditions such as devices and networks, and distribute and dynamically adjust them in real time. It has the following beneficial effects: (1) Improve the loading speed of web pages: The system dynamically selects the optimal image format and compression scheme according to network conditions, device performance and image content. Through effective content-aware compression and cropping algorithms, the size of image files is greatly reduced, and the loading time of web pages is significantly shortened. When users browse web pages on different devices, they do not need to wait for a long time for images to load, and the web page response is faster and smoother. (2) Reduce bandwidth consumption: The system uses efficient compression technology, such as WebP or AVIF format, to reduce the file size of images while maintaining high-quality images. This not only reduces the user's network traffic consumption, but also reduces the bandwidth burden of the website server. Especially in the case of large traffic, it can greatly reduce the occupation of network resources. (3) Responsive image optimization: By generating multiple versions of responsive images, the system ensures that users can see the most suitable resolution images on various devices (such as smartphones, tablets and desktop devices). In actual applications, regardless of the screen size, images can be presented at the best resolution and quality, reducing the overloading of unnecessary high-resolution resources. (4) Visual quality assurance: The system uses intelligent cropping and content-aware compression technology to reduce the file size while maintaining the core visual effect of the image. Key content (such as faces, main objects, etc.) will not be deformed or blurred due to compression, and the user's visual experience is guaranteed. (5) Dynamic optimization and real-time adjustment: The system can make real-time adjustments based on the user's network conditions. If the user's network condition is not good, the system will automatically reduce the image quality or load a smaller version of the image to ensure that the web page can still load quickly, while providing clearer images and optimizing loading performance. (6) Cross-platform compatibility: With the help of automated format selection, the system can dynamically adjust the image format based on the compatibility of the user's device and browser. Even with old devices or browsers, users can still enjoy optimized images without encountering problems with image loading failures. In short, image optimization technology based on AI large models can not only improve web page loading speed and user experience, but also effectively reduce bandwidth consumption and server pressure. Through intelligent and automated optimization processes, the system provides website developers with a seamless solution that enables websites to perform well on a variety of devices and network environments.

[0056] Therefore, compared with the prior art, improvements have been made in the following aspects: 1. Combination of deep content analysis and compression optimization. Many existing image optimization solutions (such as JPEG, PNG compression algorithms, WebP format, etc.) mainly rely on pixel-based compression technology. Although these solutions can effectively reduce file size, they usually lack the ability to analyze content, which easily leads to the loss of important image content (such as subject or face). This application uses a large AI model, combined with a convolutional neural network and a visual attention mechanism, to achieve deep analysis and perception of image content, and to perform targeted content compression to ensure that the high quality of important visual areas is maintained during the compression process; 2. Dynamic responsive image generation based on device and network status. Existing responsive image technologies usually automatically select appropriate image versions through srcset or CDN based on preset rules. However, these technologies cannot be dynamically adjusted according to actual network status and user behavior. This solution uses the predictive ability of the AI ​​model to generate dynamic images based on real-time device and network conditions, which can not only improve loading speed, but also maintain good visual effects in poor network conditions; 3. AI-driven end-to-end automated image optimization. Most existing image optimization solutions still rely on manual adjustment or pre-set optimization rules, such as automated image optimization technology in CDN services. Although these methods can reduce file size to a certain extent, they cannot optimize according to the specific content and purpose of each image. This application implements an end-to-end fully automatic image optimization process, which automatically analyzes image content, selects compression parameters, and generates responsive images suitable for different scenarios through AI models; 4. Content-aware cropping and compression. Most image compression technologies focus on how to reduce file size without considering the importance of different areas in the image. Through content-aware technology, this solution can identify important parts of the image (such as faces and main objects) and give priority to protecting the quality of these areas, while performing stronger compression and cropping on unimportant parts such as the background. This refined compression strategy can significantly reduce file size while ensuring the visual effect of the image. 5. Real-time image distribution optimization. Some image optimization products on the market can already achieve basic image compression and distribution optimization. However, these products are usually based on static optimization and cannot dynamically adjust the way images are loaded according to the real-time needs of users. This application combines AI and edge computing to analyze user behavior and network conditions in real time, make dynamic distribution and image adjustments, and further optimize the user experience.

[0057] The above describes the embodiment of the present application from the perspective of the image processing method, and the following describes the embodiment of the present application from the perspective of the processing device.

[0058] See also Figure 2 , Figure 2 A schematic diagram of a possible processing device provided in an embodiment of the present application, wherein the processing device specifically includes:

[0059] The transceiver unit 201 is used to receive the original picture uploaded by the user and extract the picture information of the original picture;

[0060] An analysis unit 202, configured to analyze the original image based on a pre-trained image analysis model to determine key content and general content of the original image;

[0061] The processing unit 203 is used to compress and crop the key content and the general content using different processing strategies according to the picture information of the original picture, so as to obtain an intermediate picture, wherein the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content;

[0062] The generating unit 204 is configured to generate a plurality of target images with different resolutions according to the intermediate image.

[0063] In a possible embodiment, the analysis unit 202 is specifically used to: input the original image into a pre-trained neural network model to obtain the key area and general area of ​​the original image; highlight the important content of the key area, and analyze and determine the detail information of the original image.

[0064] In a possible embodiment, the processing unit 203 is also used to: detect the browser information of the client and determine the image format supported by the client; and switch the format of the original image to a target format based on the detailed information of the original image and the image format supported by the client, wherein the target format is included in the image format supported by the client.

[0065] In a possible embodiment, the processing unit 203 is specifically used to: analyze the difference information between the key content and the general content in the original picture; compress the key content and the general content respectively based on the difference information; obtain the resolution information of the client, and crop the original picture based on the resolution information of the client and the key content.

[0066] In a possible embodiment, the processing unit 203 is also used to: monitor whether the network status of the terminal meets a preset condition; if so, send the first picture to the terminal through a content distribution network; if not, send the second picture to the terminal; wherein the first picture and the second picture are both included in the target picture, the picture quality of the first picture is higher than that of the second picture, and the picture quality includes but is not limited to picture resolution.

[0067] In a possible embodiment, the generating unit 204 is specifically configured to scale the intermediate image based on device information of the client to obtain the multiple target images, wherein the device information includes but is not limited to at least one of the following information: screen size and resolution information.

[0068] In a possible embodiment, the recording unit is also used to record and store the user's behavior data in real time.

[0069] See also Figure 3 , Figure 3 A schematic diagram of an embodiment of an electronic device provided in an embodiment of the present application.

[0070] like Figure 3 As shown, an embodiment of the present application provides an electronic device, including a memory 310, a processor 320, and a computer program 311 stored in the memory 320 and executable on the processor 320, wherein the processor 320 implements the following steps when executing the computer program 311: receiving an original image uploaded by a user, and extracting image information of the original image; analyzing the original image based on a pre-trained image analysis model to determine key content and general content of the original image; according to the image information of the original image, compressing and cropping the key content and the general content using different processing strategies, respectively, to obtain an intermediate image, wherein the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content; and generating multiple target images with different resolutions according to the intermediate image.

[0071] Optionally, in a possible embodiment, the processor 320 is specifically used to: input the original image into a pre-trained neural network model to obtain key areas and general areas of the original image; highlight the important content of the key areas, and analyze and determine the detailed information of the original image.

[0072] Optionally, in a possible embodiment, the processor 320 is specifically used to: detect the browser information of the client and determine the image format supported by the client; and switch the format of the original image to a target format according to the detailed information of the original image and the image format supported by the client, wherein the target format is included in the image format supported by the client.

[0073] Optionally, in a possible embodiment, the processor 320 is also used to: analyze the difference information between the key content and the general content in the original picture; compress the key content and the general content respectively based on the difference information; obtain the resolution information of the client, and crop the original picture based on the resolution information of the client and the key content.

[0074] Optionally, in a possible embodiment, the processor 320 is specifically used to: monitor whether the network status of the terminal meets a preset condition; if so, send the first picture to the terminal through a content distribution network; if not, send the second picture to the terminal; wherein the first picture and the second picture are both included in the target picture, the picture quality of the first picture is higher than that of the second picture, and the picture quality includes but is not limited to picture resolution.

[0075] Optionally, in a possible embodiment, the processor 320 is further used to scale the intermediate image based on the device information of the client to obtain the multiple target images, and the device information includes but is not limited to at least one of the following information: screen size and resolution information.

[0076] Optionally, in a possible embodiment, the processor 320 is also used to determine the image format of the original image through the file header information of the original image; extract basic information of the original image, and the basic information includes but is not limited to at least one of the following information: size information, resolution information and color space information.

[0077] Since the electronic device introduced in this embodiment is a device used to implement a processing device in the embodiment of the present application, based on the method introduced in the embodiment of the present application, technical personnel in this field can understand the specific implementation method of the electronic device of this embodiment and its various variations. Therefore, how the electronic device implements the method in the embodiment of the present application is not introduced in detail here. As long as the equipment used by technical personnel in this field to implement the method in the embodiment of the present application is within the scope of protection of this application.

[0078] See also Figure 4 , Figure 4 A schematic diagram of an embodiment of a computer-readable storage medium provided in an embodiment of the present application.

[0079] like Figure 4 As shown, this embodiment provides a computer-readable storage medium 400, on which a computer program 411 is stored. When the computer program 411 is executed by a processor, the following steps are implemented: receiving an original picture uploaded by a user, and extracting image information of the original picture; analyzing the original picture based on a pre-trained image analysis model to determine the key content and general content of the original picture; according to the image information of the original picture, compressing and cropping the key content and the general content using different processing strategies respectively to obtain an intermediate picture, wherein the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content; and generating multiple target pictures with different resolutions based on the intermediate picture.

[0080] The embodiment of the present application also provides a system, which may include one or more central processors 522 and memory 532, one or more storage media 530 (e.g., one or more mass storage devices) storing application programs 542 or data 544. Among them, the memory 532 and the storage medium 530 may be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the system. Further, the central processor 522 may be configured to communicate with the storage medium 530 and execute a series of instruction operations in the storage medium 530 on the system 500. The system 500 may also include one or more power supplies 526, one or more wired or wireless network interfaces 550, one or more input and output interfaces 558, and / or, one or more operating systems 541, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.

[0081] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0082] 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 described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may 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 may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0083] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0084] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0085] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0086] In addition, each functional unit in the embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0088] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.< / picture>

Claims

1. A method for processing an image, characterized in that: include: Receive the original picture uploaded by the user, and extract the picture information of the original picture; Analyze the original image based on a pre-trained image analysis model to determine key content and general content of the original image; According to the picture information of the original picture, the key content and the general content are respectively compressed and cropped using different processing strategies to obtain an intermediate picture, wherein the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content; A plurality of target images with different resolutions are generated according to the intermediate image.

2. The method according to claim 1, characterized in that: The analyzing the original image based on the pre-trained image analysis model includes: Inputting the original image into a pre-trained neural network model to obtain the key area and the general area of ​​the original image; The important content in the key area is highlighted, and detailed information of the original image is analyzed and determined.

3. The method according to claim 2, characterized in that After analyzing the original image based on the pre-trained image analysis model, the method further includes: Detecting the browser information of the client and determining the image format supported by the client; According to the detailed information of the original picture and the picture format supported by the client, the format of the original picture is switched to a target format, where the target format is included in the picture format supported by the client.

4. The method according to claim 1, characterized in that: The step of using different processing strategies to compress and crop the key content and the general content according to the picture information of the original picture includes: Analyzing difference information between the key content and the general content in the original image; Based on the difference information, the key content and the general content are compressed respectively; The resolution information of the client is obtained, and based on the resolution information of the client and the key content, the original image is cropped.

5. The method according to claim 1, characterized in that After generating a plurality of target images with different resolutions, the method further includes: Monitoring whether the network status of the terminal meets a preset condition; If the conditions are met, sending the first picture to the terminal via a content distribution network; If not satisfied, sending the second picture to the terminal; The first picture and the second picture are both included in the target picture, and the picture quality of the first picture is higher than that of the second picture. The picture quality includes but is not limited to picture resolution.

6. The method according to claim 1, characterized in that Generating a plurality of target images with different resolutions according to the intermediate image comprises: The intermediate image is scaled based on the device information of the client to obtain the multiple target images, wherein the device information includes but is not limited to at least one of the following information: screen size and resolution information.

7. The method according to claim 1, characterized in that The image information of the original image is extracted including: Determine the image format of the original image through the file header information of the original image; Extract basic information of the original image, where the basic information includes but is not limited to at least one of the following information: size information, resolution information, and color space information.

8. A processing device, characterized in that: include: A transceiver unit, used to receive the original picture uploaded by the user and extract the picture information of the original picture; An analysis unit, configured to analyze the original image based on a pre-trained image analysis model to determine key content and general content of the original image; A processing unit, configured to compress and crop the key content and the general content using different processing strategies according to the picture information of the original picture, to obtain an intermediate picture, wherein the compression rate corresponding to the general content is higher than the compression rate corresponding to the key content; A generating unit is used to generate a plurality of target images with different resolutions according to the intermediate image.

9. A computer-readable storage medium comprising instructions, which, when executed on a computer, enables the computer to execute the method according to any one of claims 1 to 7.

10. A computer program product comprising instructions, which, when executed on a computer, enables the computer to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Operation method, server and electronic equipment

    CN111145077A

  • Webpage picture preprocessing method and system, storage medium and computer equipment

    CN112752107A

  • Picture compression method and system based on Huffman and GAN feature fusion network

    CN118945366A

  • Image processor, image processing method and medical image system

    JP2005287927A

Cited By

  • Image processing method and device, computer equipment and storage medium

    CN121579806A