Picture display method and system and electronic equipment

By compressing and sampling the original image, generating thumbnails and displaying sampled images, the problem of disk occupancy and low-end devices crashing in graphics and text applications is solved, and the user experience and device performance are improved.

CN120354022APending Publication Date: 2025-07-22GUANGZHOU HUYA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510492494.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

In the prior art, when graphic and text applications or web pages display pictures, there are problems such as large disk usage, large memory usage, and low-end devices crashing, especially when loading large-resolution pictures, resulting in poor user experience.

Method used

By compressing the original picture, the thumbnail image is generated, and the target compression quality value and size is determined based on the original picture information and the preset compression strategy. After obtaining the original picture request, the target sampling frequency is determined according to the preset sampling strategy to sample, and the sampled picture is displayed.

Benefits of technology

Effectively reduce storage space usage and network transmission traffic, improve the flexibility and efficiency of picture display, avoid memory overflow and crashes of low-end devices, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120354022A_ABST
    Figure CN120354022A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a picture display method and system, electronic equipment and a storage medium. The method comprises the following steps: according to information of an original picture and a preset compression strategy, compressing the original picture to obtain a thumbnail, so that the thumbnail is displayed on a platform; obtaining an original picture request of the displayed thumbnail, and obtaining original picture information corresponding to the thumbnail according to the request; determining a target sampling frequency according to the corresponding original picture information and a preset sampling strategy; and sampling the corresponding original picture information according to the sampling frequency to obtain a sampling picture, and displaying the sampling picture on a platform. According to the method, the problem of large disk and memory occupation in picture display can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and more specifically, to a method, a system and an electronic device for displaying pictures. Background Art

[0002] In the prior art, in the display of relevant pages of picture-and-text applications or picture-and-text web pages, the display of pictures is involved; because a large number of pictures may need to be displayed on relevant pages, they will be displayed in the form of thumbnails of pictures, so that users can obtain more picture summary information on one page as much as possible, increasing the probability that users can find the content they are interested in among numerous picture information, thereby improving the user experience.

[0003] In the conventional operations of the prior art, the thumbnails of pictures Figure 1 are generally the original pictures and are displayed in a small size, and the process of picture preview is completed with a thumbnail entrance animation. The thumbnails generated by this method will have problems of large disk occupation and large memory occupation; furthermore, if the original picture is a high-resolution picture, users need to spend more time waiting for the picture to be downloaded, which goes against the original intention of quick preview of thumbnails. And on low-end device with poor performance, the memory required for the picture is greater than the available running memory of the device, resulting in the device crashing; therefore, improvements need to be made to the picture display method. Summary of the Invention

[0004] The present invention aims to overcome at least one defect (shortcoming) of the above prior art, and provides a method, a system, an electronic device and a storage medium for displaying pictures, which are used to solve the problems of large disk and memory occupation in picture display.

[0005] According to a first aspect of the present application, there is provided a method for displaying pictures, the method comprising:

[0006] Compressing the original picture according to the information of the original picture and a preset compression strategy to obtain a thumbnail, and displaying the thumbnail on a platform;

[0007] Obtaining an original picture request for the displayed thumbnail, and obtaining the original picture information corresponding to the thumbnail according to the request;

[0008] Determining a target sampling frequency according to the corresponding original picture information and a preset sampling strategy;

[0009] Sampling the corresponding original picture information according to the target sampling frequency to obtain a sampled picture, and displaying the sampled picture on a platform.

[0010] It is understandable that the present application obtains and displays a thumbnail by compressing the original image, effectively reducing the storage space occupation and network transmission traffic; for the original image request for obtaining the thumbnail, the original image information corresponding to the thumbnail can be accurately obtained, and then the target sampling frequency is determined according to the corresponding original image information and the preset sampling strategy, and the original image information is sampled to obtain a sampled image and displayed on the platform, which not only meets the user's need to view the details of the original image based on the platform, but also avoids unnecessary transmission of complete image data, improving the flexibility and efficiency of image display.

[0011] Optionally, the compressing the original image to obtain a thumbnail according to the information of the original image and a preset compression strategy includes:

[0012] The information of the original image includes the original resolution of the original image;

[0013] A preset resolution threshold is used to compare the original resolution with the resolution threshold to obtain a first comparison result, and a target compression quality value of the original image is determined according to the first comparison result; according to the target compression quality value, the original image is compressed to obtain the thumbnail.

[0014] It is understandable that by comparing the original resolution of the original image with the preset resolution threshold to determine the target compression quality value, and thus compressing the original image to generate a thumbnail, the image storage space and transmission traffic can be effectively reduced. And determining the target compression quality value based on the characteristics of the original image itself can accurately balance the compression efficiency and image quality, ensuring that while the thumbnail meets the display requirements, the key information of the original image is retained to the greatest extent, improving the user experience and device performance.

[0015] Optionally, the preset resolution threshold is used to compare the original resolution with the resolution threshold to obtain a first comparison result, and a target compression quality value of the original image is determined according to the first comparison result, including:

[0016] A first resolution threshold and a second resolution threshold are preset;

[0017] A number of gradually increasing compression quality values are preset, each of the compression quality values corresponding to a compression quality coefficient, and the magnitudes of all the compression quality coefficients increase with the growth trend of the corresponding compression quality value;

[0018] A compression quality value is selected from all the compression quality values as a first target compression quality value, wherein the first target compression quality value is at least greater than one of the compression quality values;

[0019] If the original resolution is less than or equal to the first resolution threshold, the first target compression quality value is set as the target compression quality value;

[0020] If the original resolution is greater than the first resolution threshold and less than or equal to the second resolution threshold, determine a corresponding compression quality coefficient according to the original resolution and the first resolution threshold, and obtain the target compression quality value according to the determined compression quality coefficient;

[0021] If the original resolution is greater than the second resolution threshold, determine a corresponding compression quality coefficient according to the original resolution and the second resolution threshold, and obtain the target compression quality value according to the determined compression quality coefficient.

[0022] It can be understood that different original pictures have different information contents, so their picture qualities will also vary. By setting different resolution thresholds to classify and compare different original pictures, adaptively select the compression quality for each original picture to be compressed into a thumbnail, so that the obtained thumbnail can display as much information of the original picture as possible while ensuring the normal operation of the device and the balance of traffic consumption and time for platform loading, so that when previewing the thumbnail, the basic content of the original picture corresponding to the thumbnail can also be obtained, improving the user's initial experience during browsing.

[0023] Optionally, the step of determining a corresponding compression quality coefficient according to the original resolution and the first resolution threshold, and obtaining the target compression quality value according to the determined compression quality coefficient includes:

[0024] Take the compression quality coefficient corresponding to the first target compression quality value as the first target compression quality coefficient;

[0025] Select a compression quality value from all the compression quality values as the second target compression quality value, and take the compression quality coefficient corresponding to the second target compression quality value as the second target compression quality coefficient;

[0026] Divide the first resolution threshold by the original resolution to obtain a first quotient value;

[0027] When the first quotient value is equal to or greater than the first target compression quality coefficient, take the first target compression quality value as the target compression quality value; when the first quotient value is less than or equal to the second target compression quality coefficient, take the second target compression quality value as the target compression quality value;

[0028] When the first quotient value is greater than the second target compression quality coefficient and less than the first target compression quality coefficient, match the first quotient value with the compression quality coefficient, and take the compression quality value corresponding to the matched compression quality coefficient as the target compression quality value;

[0029] And / or

[0030] Determining a corresponding compression quality coefficient according to the original resolution and the second resolution threshold, and obtaining the target compression quality value according to the determined compression quality coefficient includes:

[0031] Taking the compression quality coefficient corresponding to the first target compression quality value as the first target compression quality coefficient;

[0032] Selecting a compression quality value from all the compression quality values as the second target compression quality value, and taking the compression quality coefficient corresponding to the second target compression quality value as the second target compression quality coefficient;

[0033] Dividing the second resolution threshold by the original resolution to obtain a second quotient value;

[0034] When the second quotient value is equal to or greater than the first target compression quality coefficient, taking the first target compression quality value as the target compression quality value; when the second quotient value is less than or equal to the second target compression quality coefficient, taking the second target compression quality value as the target compression quality value;

[0035] When the second quotient value is greater than the second target compression quality coefficient and less than the first target compression quality coefficient, matching the second quotient value with the compression quality coefficient, and taking the compression quality value corresponding to the matched compression quality coefficient as the target compression quality value.

[0036] It can be understood that setting the first target compression quality value and the second target compression quality value of the original picture can limit the critical compression quality of the original picture compressed into a thumbnail, so that the obtained thumbnail will not have too low quality resulting in too little picture information for the user, nor too high quality causing excessive resource and memory occupation for network loading of the thumbnail.

[0037] Optionally, compressing the original picture according to the information of the original picture and a preset compression strategy to obtain a thumbnail includes:

[0038] The information of the original picture includes the original wide-side pixels and the original high-side pixels;

[0039] A preset pixel threshold and a width-to-height ratio threshold;

[0040] If both the original wide-side pixels and the original high-side pixels are less than or equal to the pixel threshold, using the original wide-side pixels and the original high-side pixels as the target compression size of the original picture;

[0041] If the original wide-side pixel or the original high-side pixel is greater than the pixel threshold, obtain the original aspect ratio of the original picture according to the original wide-side pixel and the original high-side pixel, and determine the target compression size of the original picture according to the original aspect ratio and the aspect ratio threshold;

[0042] Compress the original picture according to the target compression size to obtain the thumbnail.

[0043] It can be understood that the sizes of original pictures are different, and the width and height lengths of the pictures will also vary. There will be pictures with relatively large heights in the original pictures, which are usually regarded as vertical pictures. At the same time, there will also be pictures with relatively large widths, which are usually regarded as horizontal pictures. There are also square pictures with little difference between the width and height. If pictures with different aspect ratios are compressed according to the same size, it may occur that a certain compression size is larger than the size corresponding to the original picture, resulting in a phenomenon of partial blank screen in the compressed thumbnail, affecting the preview effect of users; according to different sizes of the original pictures, this application selects corresponding different target compression sizes, which can make the obtained thumbnails more unified in format and achieve a better preview effect.

[0044] Optionally, the determining the target compression size of the original picture according to the original aspect ratio and the aspect ratio threshold includes:

[0045] Preset a first size and a second size, where the first size includes a first width pixel value and a first height pixel value, and the second size includes a second width pixel value and a second height pixel value;

[0046] The aspect ratio threshold includes a first aspect ratio threshold and a second aspect ratio threshold greater than the first aspect ratio threshold;

[0047] If the original aspect ratio is less than the first aspect ratio threshold, use the first size as the target compression size;

[0048] If the original aspect ratio is equal to or greater than the first aspect ratio threshold and less than or equal to the second aspect ratio threshold, calculate a third size as the target compression size according to the original wide-side pixel, the original high-side pixel, and the pixel threshold;

[0049] If the original aspect ratio is greater than the second aspect ratio threshold, use the second size as the target compression size.

[0050] It can be understood that selecting an adaptive target compression size for the original picture according to different aspect ratio thresholds can be compatible with the normal compression of original pictures of different sizes, and improve the flexibility and adaptability of obtaining size compression.

[0051] Optionally, the preset sampling strategy is specifically:

[0052] Preset an interception decoding dynamic factor and several sampling frequencies;

[0053] Obtain the original resolution and the memory occupied by a single pixel according to the corresponding original image information;

[0054] Obtain the device screen resolution;

[0055] Obtain an interception decoding threshold according to the interception decoding dynamic factor, the device screen resolution, and the memory occupied by a single pixel;

[0056] Obtain the decoding memory required for the corresponding original image information according to the original resolution and the memory occupied by a single pixel;

[0057] Compare the decoding memory with the interception decoding threshold to obtain a second comparison result, and select a sampling frequency from the several sampling frequencies as the target sampling frequency according to the second comparison result.

[0058] It can be understood that the user obtains the general information of the original image through the thumbnail. The user decides whether to further understand the original image according to the general information. If more information about the original image is needed, the original image corresponding to the thumbnail needs to be decoded to obtain all the information of the original image, including enlarging it to the original size and improving its image quality; because for some low-end devices, the total operating memory of the device is small. If the memory required for decoding the original image is greater than the total operating memory of the device, it may cause the platform or application to crash; to avoid this problem, it is necessary to sample the original image to reduce the memory used for loading the original image, so that more information can be displayed as much as possible in the limited total operating memory of the device; without the device crashing, more information can also be provided to the user to meet the user's information acquisition and needs.

[0059] Optionally, comparing the decoding memory with the interception decoding threshold to obtain a second comparison result, and selecting a sampling frequency from the several sampling frequencies as the target sampling frequency includes:

[0060] The several sampling frequencies include a default sampling frequency and several custom sampling frequencies, and each custom sampling frequency corresponds to a ratio interval range;

[0061] If the decoding memory is less than or equal to the interception decoding threshold, select the default sampling frequency as the target sampling frequency;

[0062] If the decoding memory is greater than the interception decoding threshold, obtain the ratio of the decoding memory to the interception decoding threshold, and obtain the ratio interval range where the ratio is located;

[0063] Obtain a corresponding custom sampling frequency according to the ratio interval range where it is located, and determine whether the corresponding custom sampling frequency is greater than the default sampling frequency. If so, use the corresponding custom sampling frequency as the target sampling frequency; if not, use the default sampling frequency as the target sampling frequency.

[0064] It can be understood that the present application proposes several custom sampling frequencies, which are different from the default sampling frequency. Instead of simply using the same sampling frequency to sample and decode different pictures, multiple intervals are divided to classify pictures with different amounts of information, and different sampling frequencies are adaptively selected for them. And by cooperating with the default sampling frequency, it can ensure that pictures with different amounts of information can display as much information as possible, improving the user experience and the amount of information for obtaining the original picture information; by calculating the interception decoding threshold and decoding memory to obtain the ratio interval where different pictures fall, it can take into account the operating memory and screen resolution of different devices, so that the display effect of pictures on different devices can be adaptively adjusted, improving the generality of the method.

[0065] According to a second aspect of the present application, there is provided a picture display system, the system comprising:

[0066] A compression display module, configured to compress the original picture according to the information of the original picture and a preset compression strategy to obtain a thumbnail, so as to display the thumbnail on the platform;

[0067] An acquisition module, configured to acquire an original picture request of the displayed thumbnail, and acquire the original picture information corresponding to the thumbnail according to the request;

[0068] A sampling frequency selection module, configured to determine a target sampling frequency according to the corresponding original picture information and a preset sampling strategy;

[0069] A sampling display module, configured to sample the corresponding original picture information according to the target sampling frequency to obtain a sampled picture, so as to display the sampled picture on the platform.

[0070] According to a third aspect of the present application, there is provided an electronic device, comprising:

[0071] A memory, configured to store one or more computer programs;

[0072] A processor, when the one or more computer programs are executed by the processor, implements a picture display method according to the first aspect described above.

[0073] According to a fourth aspect of the present application, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement a picture display method as described in the first aspect above when executed.

[0074] Based on any of the above aspects, an embodiment of the present application provides a picture display method, system, electronic device, and storage medium. According to the information of the original picture and a preset compression strategy, the original picture is compressed to obtain a thumbnail for display on a platform; a request for the original picture of the displayed thumbnail is obtained, and the original picture information corresponding to the thumbnail is obtained according to the request; a target sampling frequency is determined according to the corresponding original picture information and a preset sampling strategy; and the corresponding original picture information is sampled according to the target sampling frequency to obtain a sampled picture for display on the platform. This method can achieve the following benefits:

[0075] · The disk occupancy of the compressed and displayed thumbnail is small, the network request time and traffic for obtaining the thumbnail are low, and the user can quickly preview the thumbnail;

[0076] · The memory occupancy of the sampled and displayed sampled picture is small, the performance requirements for the user device are reduced, and the phenomenon of memory shortage and subsequent app crashes when loading the original picture on low-end devices is reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.

[0078] Figure 1 It is a schematic application scenario diagram of a picture display method provided in this embodiment.

[0079] Figure 2 It is a flowchart of a picture display method provided in this embodiment.

[0080] Figure 3 It is a flowchart of a method for obtaining a thumbnail based on quality compression provided in this embodiment.

[0081] Figure 4 It is a flowchart of a method for obtaining a target compression quality value provided in this embodiment.

[0082] Figure 5 It is a flowchart of a method for obtaining a thumbnail based on size compression provided in this embodiment.

[0083] Figure 6 A flowchart of a method for obtaining a target compression size provided in this embodiment.

[0084] Figure 7 A flowchart of a method for a preset sampling strategy provided in this embodiment.

[0085] Figure 8 A flowchart of a method for obtaining a target sampling frequency provided in this embodiment.

[0086] Figure 9 A schematic diagram of the functional modules of a picture display system provided in this embodiment.

[0087] Figure 10 A schematic diagram of the structure of an electronic device provided in this embodiment. Detailed implementation manners

[0088] The accompanying drawings of this application are only for illustrative purposes and cannot be construed as a limitation to this application. To better illustrate the following embodiments, some components in the drawings will be omitted, enlarged or reduced, and do not represent the dimensions of actual products; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.

[0089] In order to enable those skilled in the art to better understand the solutions of this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.

[0090] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above accompanying drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0091] In the prior art, graphic applications often display a large number of pictures, providing users with a vast amount of picture information. However, if a large number of pictures are placed on the user page of a platform or application in their original size and format, due to the screen display limitations of the device, only a very small number of pictures can be shown in a single non-scrolling page. Even for some pictures with a relatively large original size, the entire picture cannot be shown in a single non-scrolling page. Therefore, it is necessary to adjust the way of picture display. The existing approach is to crop the original pictures into small-sized thumbnails, so as to achieve the goal of showing as many pictures as possible on a single page, thus providing users with a way to preview multiple pictures. When a user needs to further understand a certain picture, the user can then perform a zoom-in operation on that picture. However, in the prior art, the above design scheme often obtains thumbnails by directly linking the original pictures and performing simple cropping. The original pictures need to be downloaded in advance from the network to achieve the preview effect, and the above method has the following drawbacks: It is understandable that thumbnails are shown in a small size on the page, and users have relatively low requirements for clarity. However, directly linking the thumbnails to the original pictures will consume extra traffic during downloading, increasing the loading time and latency of loading the thumbnails, and bringing a poor browsing experience to users. Moreover, in some low-end devices, the total running memory is relatively small. If some pictures that occupy a large amount of memory are loaded, there may be a phenomenon of crashing due to exceeding the running memory during the loading or decoding of the original pictures. Therefore, it is necessary to make necessary improvements to the picture display.

[0092] This embodiment provides a technical solution that can solve the above problems. The following will combine the accompanying drawings to elaborate on the specific implementation manners of the present application in detail.

[0093] Exemplarily, it is a schematic diagram of an application scenario of a picture display method provided by an embodiment of the present application. As Figure 1 shown, the application scenario at least includes a server 100 and a terminal 200 that can communicate with the server 100. The server 100 has a picture processing function; the terminal 200 has a picture processing function, and also has a picture display and monitoring function.

[0094] It is understandable that the server 100 can be an independent electronic device or a cluster composed of multiple electronic devices; the terminal 200 can be a smart phone terminal, a personal computer, a tablet computer, a vehicle-mounted terminal, etc., but is not limited thereto.

[0095] In an implementable manner, the server 100 and the terminal 200 can respectively execute a picture display method provided by an embodiment of the present application. Alternatively, optionally, a part of the picture display method provided by an embodiment of the present application is executed in the server 100, and a part is executed in the terminal 200.

[0096] As Figure 2As shown in the figure, this embodiment provides a method for displaying pictures. The method can be subdivided into the following steps:

[0097] S100. Compress the original picture according to the information of the original picture and a preset compression strategy to obtain a thumbnail, so as to display the thumbnail on the platform;

[0098] Exemplarily, when the original picture is displayed on a specific platform, the platform usually first obtains the original picture to be displayed on the page from the server, and then obtains the corresponding thumbnail according to the original picture for display; among them, the thumbnail refers to a small picture previewing the original picture, which is a picture displayed in a small size; the original picture refers to a picture that has not been compressed or otherwise modified by the corresponding platform, and it is usually a large-size high-definition picture;

[0099] In this application, different from the existing technology processing method, the original picture is not directly simply cropped and then directly generated into a thumbnail. Instead, the original picture is adaptively compressed through the preset compression strategy proposed in this application to obtain a thumbnail with low pixel information content and small resolution, and then the thumbnail is displayed on the page; because users have low requirements for clarity when previewing the thumbnail, the above solution can provide a suitable preview method for users, and because the information content of the thumbnail is not high, relatively little network traffic and loading time are required during the loading process, so the loading delay of the thumbnail can be reduced, enabling users to quickly obtain the preview thumbnail and improving the user's browsing experience.

[0100] Specifically, as Figure 3 shown, the step of compressing the original picture according to the information of the original picture and a preset compression strategy to obtain a thumbnail may include the following steps:

[0101] Among them, the information of the original picture includes the original resolution of the original picture;

[0102] S111. Preset a resolution threshold, compare the original resolution with the resolution threshold to obtain a first comparison result, and determine the target compression quality value of the original picture according to the first comparison result; in this embodiment, the resolution threshold is a preset critical value for judging whether the original picture needs to be compressed and the degree of compression. In the specific implementation process, the resolution threshold can be one or more fixed values, or can be dynamically adjusted according to the specific application scenario. By comparing the original resolution with the resolution threshold in this application to determine the target compression quality value, it can ensure that the high resolution of the original picture can still maintain sufficient clarity after compression, and avoid the picture quality from decreasing due to excessive compression of the thumbnail, affecting the user experience.

[0103] In this embodiment, relevant thresholds and corresponding compression parameters need to be preset in advance. Among them, the compression parameter is a compression quality value, which refers to a comprehensive evaluation of picture characteristics such as the color and visual perception of the picture, and is used to measure the similarity or difference degree between the picture after compression processing and the original picture. The quality value can be represented in various ways, including but not limited to percentages, decibels (dB), or other dimensionless values; it is understandable that in this application, since the thumbnail is obtained by compressing the original picture, the quality value of the thumbnail is lower than that of the original picture. Because the user has low requirements for the picture quality when previewing the thumbnail and only needs to obtain the general information of the corresponding original picture reflected by the thumbnail, reducing the quality of the thumbnail can enable the thumbnail to be quickly loaded but still be displayed in a reasonable size, achieving the purpose of reducing network loading latency and improving the user experience when browsing pictures, especially in the case of poor network environment or limited device performance;

[0104] S112. Compress the original picture according to the target compression quality value to obtain the thumbnail.

[0105] In this embodiment, compressing the original picture to obtain a thumbnail for display to users on the platform can save the memory consumption and broadband consumption of the user's device, thereby improving the reliability of the entire platform or application and enhancing the user experience in the platform or application.

[0106] Specifically, as Figure 4 shown, for the preset resolution threshold, comparing the original resolution with the resolution threshold to obtain a first comparison result, and determining the target compression quality value of the original picture according to the first comparison result can be divided into the following steps:

[0107] S11. Preset a first resolution threshold and a second resolution threshold;

[0108] In this embodiment, the first resolution threshold and the second resolution threshold are also a preset critical value, which can classify pictures with different resolutions, so as to perform different adaptation processes on pictures of different categories; among them, the second resolution threshold is greater than the first resolution threshold.

[0109] S12. Preset a number of gradually increasing compression quality values, and each compression quality value corresponds to a compression quality coefficient. The magnitudes of all compression quality coefficients increase with the growth trend of the corresponding compression quality value;

[0110] In this embodiment, a number of gradually increasing compression quality values are preset, which can provide corresponding compression quality for original images of different resolutions, and adaptively compress original images of different resolutions; and each compression quality value has a corresponding compression quality coefficient, which can provide accurate compression parameters for quality compression work, so that the quality compression of each original image can quickly obtain the corresponding compression quality value, thereby improving the efficiency of compression work. Exemplarily, in this embodiment, the compression quality value can be preset to a value in the interval [0,100], and the corresponding compression quality coefficient is set to a value in the interval [0,1]. For example, setting the compression quality value to 60 corresponds to a compression quality coefficient of 0.6, and other corresponding relationships are similar.

[0111] S13. Select a compression quality value from all the compression quality values as a first target compression quality value, wherein the first target compression quality value is greater than at least one of the compression quality values;

[0112] In this embodiment, the first target compression quality value can be used as the maximum critical value of the target compression quality value, which can ensure a certain degree of compression of the original image, and avoid the situation where the quality of the generated thumbnail is not much different from that of the original image, resulting in a large amount of network traffic and device memory required to load and process the thumbnail, thereby making the compression work meaningless. Exemplarily, in this embodiment, 80 is selected as the first target compression quality value in the compression quality value, and the first target compression quality value can be adjusted according to the user's device performance and the resolution distribution of the original image.

[0113] S14. If the original resolution is less than or equal to the first resolution threshold, setting the first target compression quality value as the target compression quality value;

[0114] S15. If the original resolution is greater than the first resolution threshold and less than or equal to the second resolution threshold, determine a corresponding compression quality coefficient according to the original resolution and the first resolution threshold, and obtain the target compression quality value according to the determined compression quality coefficient;

[0115] S16. If the original resolution is greater than the second resolution threshold, determine a corresponding compression quality coefficient according to the original resolution and the second resolution threshold, and obtain the target compression quality value according to the determined compression quality coefficient.

[0116] It is understandable that the resolution of an image can reflect the amount of information carried by the image. If a unified processing method is adopted for images with different amounts of information, there may be significant visual differences in the thumbnails obtained by compressing different images, especially when the resolutions of different original images vary greatly. In particular, when the resolutions of different original images vary greatly, the differences formed above will largely reduce the visual experience of users browsing the user page. By using the first resolution threshold and the second resolution threshold to divide the original images into low-resolution images, medium-resolution images, and high-resolution images, and selecting appropriate target compression quality values for these three types of images, it is possible to use a higher compression quality value for low-resolution images with less information because their details and complexity are low, and the quality loss is not easily noticeable after compression. For high-resolution images with rich information, a lower compression quality value is required to retain more details and color information and save the loaded resources and memory. It is understandable that one or more resolution thresholds can be preset and adjusted specifically according to the difference interval of the original image resolution. Exemplarily, in this application, taking the mainstream device resolutions 1080*1920 and 1440*2560 as a reference, the resolution thresholds are set correspondingly. Preferably, the first resolution threshold is preset to 1080*1920, and the second resolution threshold is preset to 1440*2560;

[0117] Exemplarily, if the original resolution is less than the first resolution threshold, that is, less than 1080*1920, it means that the original resolution is relatively small for common user devices, and the user device can display the thumbnail of the original image without device pressure. Therefore, the target compression quality value is set to the first target compression quality value, which is 80;

[0118] If the original resolution of the original image is greater than the first resolution threshold, that is, greater than 1080*1920, but less than or equal to the second resolution threshold, that is, less than or equal to 1440*2560, it means that the original resolution of the original image is at a medium level for the user device and needs to be compressed for display. Therefore, the corresponding compression quality coefficient is determined according to the original resolution and the first resolution threshold. Preferably, the compression quality coefficient is the quotient of the first resolution threshold divided by the original resolution. Similarly, if the original resolution of the original image is greater than the second resolution threshold, that is, greater than 1440*2560, it means that the original resolution of the original image is relatively large for the user device and needs to be compressed for display. Therefore, the corresponding compression quality coefficient is determined according to the original resolution and the second resolution threshold. Preferably, the compression quality coefficient is the quotient of the second resolution threshold divided by the original resolution.

[0119] In a preferred embodiment, the determining the corresponding compression quality coefficient according to the original resolution and the first resolution threshold, and obtaining the target compression quality value according to the determined compression quality coefficient includes the following situations:

[0120] Use the compression quality coefficient corresponding to the first target compression quality value as the first target compression quality coefficient;

[0121] In this embodiment, it is also necessary to set the first target compression quality coefficient to handle the situation when the compression quality coefficient calculated from the original picture is equal to or greater than the first target compression quality coefficient; Exemplarily, according to the above-set first target compression quality value of 80, the first target compression quality coefficient is 0.8;

[0122] Select a compression quality value from all the compression quality values as the second target compression quality value, and use the compression quality coefficient corresponding to the second target compression quality value as the second target compression quality coefficient;

[0123] In this embodiment, it is necessary to define a second target compression quality value to ensure a certain quality of the compressed picture of the original picture, and to avoid the situation that the quality of the generated thumbnail is too small, resulting in the user hardly being able to obtain the basic information of the thumbnail and affecting the user's browsing experience; wherein the second target compression quality value is smaller than the first target compression quality value; Exemplarily, in this embodiment, 50 is selected as the second target compression quality value from the compression quality values, and the second target compression quality value can be adaptively adjusted according to the device performance of the user and the resolution distribution of the original picture; It is understandable that it is also necessary to set the second target compression quality coefficient to handle the situation when the compression quality coefficient calculated from the original picture is equal to or less than the second target compression quality coefficient; Exemplarily, according to the above-set second target compression quality value of 50, the second target compression quality coefficient is 0.5.

[0124] Divide the first resolution threshold by the original resolution to obtain a first quotient value;

[0125] When the first quotient value is equal to or greater than the first target compression quality coefficient, use the first target compression quality value as the target compression quality value. When the first quotient value is less than or equal to the second target compression quality coefficient, use the second target compression quality value as the target compression quality value;

[0126] When the first quotient value is greater than the second target compression quality coefficient and less than the first target compression quality coefficient, match the first quotient value with the compression quality coefficient, and use the compression quality value corresponding to the matched compression quality coefficient as the target compression quality value.

[0127] Similarly, the determining the corresponding compression quality coefficient according to the original resolution and the second resolution threshold, and obtaining the target compression quality value according to the determined compression quality coefficient includes:

[0128] Use the compression quality coefficient corresponding to the first target compression quality value as the first target compression quality coefficient;

[0129] Select a compression quality value from all the compression quality values as the second target compression quality value, and use the compression quality coefficient corresponding to the second target compression quality value as the second target compression quality coefficient;

[0130] Divide the original resolution by the second resolution threshold to obtain a second quotient value;

[0131] When the second quotient value is equal to or greater than the first target compression quality coefficient, use the first target compression quality value as the target compression quality value. When the second quotient value is less than or equal to the second target compression quality coefficient, use the second target compression quality value as the target compression quality value;

[0132] When the second quotient value is greater than the second target compression quality coefficient and less than the first target compression quality coefficient, match the second quotient value with the compression quality coefficient, and use the compression quality value corresponding to the matched compression quality coefficient as the target compression quality value.

[0133] In this embodiment, several intermediate compression quality values are preset, and each compression quality value corresponds to a compression quality coefficient, making the compression process more flexible and controllable. And on the premise of ensuring the picture quality, the compression quality value is dynamically adjusted according to the relationship between the original resolution and different thresholds, effectively balancing the relationship between compression efficiency and picture quality; It can be understood that the first or second target compression quality value can define the quality range of the thumbnail, can balance the thumbnail loading time and memory occupation, and ensure the minimum quality of the thumbnail, avoiding excessive compression and resulting in too little information in the thumbnail, which affects the normal browsing of users;

[0134] Exemplarily, divide the first resolution threshold by the original resolution to obtain a first quotient value, and / or divide the second resolution threshold by the original resolution to obtain a second quotient value. It can be understood that there may be cases where the first quotient value and / or the second quotient value is less than or equal to the second target compression quality coefficient, that is, 0.5. In order to prevent the quality of the thumbnail from being too low and the user can hardly obtain the information of the thumbnail, it is necessary to use the second target compression quality coefficient to limit the minimum compression quality of the thumbnail; or there may be cases where the first quotient value and / or the second quotient value is equal to or greater than the first target compression quality coefficient, that is, 0.8. In order to avoid occupying too much memory and time for thumbnail loading, it is also necessary to use the first target compression quality coefficient to limit the minimum compression quality of the thumbnail; Therefore, if the calculated first quotient value and / or second quotient value is 0.4, the target compression quality value is set to the second target compression quality value of 50; if the calculated first quotient value and / or second quotient value is 0.9, the target compression quality value is set to the first target compression quality value of 80;

[0135] If it is calculated that the first quotient value and / or the second quotient value is greater than the second target compression quality coefficient and less than the first target compression quality coefficient, that is, the first quotient value and / or the second quotient value is between the maximum target compression quality coefficient and the minimum target compression quality coefficient, then match the corresponding compression quality coefficient according to the first quotient value or the second quotient value, so as to use the compression quality value corresponding to the matched compression quality coefficient as the target compression quality value. Exemplarily, if the corresponding compression quality coefficient is 0.7, the matched compression quality value is 70, and the target quality value is set to the matched compression quality value, that is, 70.

[0136] Specifically, as Figure 5 shown, the step of compressing the original picture according to the information of the original picture and the preset compression strategy to obtain a thumbnail may include the following steps:

[0137] The information of the original picture includes the original width pixels and the original height pixels;

[0138] Similarly, it is necessary to obtain the target compression size according to the original width and height pixels; it can be understood that the pixels of a picture refer to the small squares that make up the image, and these small squares all have a definite position and an assigned color value. The color and position of the small squares determine the appearance of the picture; pixels are regarded as the indivisible units or elements in the whole picture; each dot matrix picture contains a certain amount of pixels, and these pixels determine the size of the picture presented on the screen. Therefore, in this application, the width and height pixels in the original picture can reflect the width or height of the original picture and can be used as the identification standard for the target compression size to ensure the accuracy of the size compression process. This application determines the target compression size based on the original width and height pixels, and the obtained thumbnail can be quickly loaded and reasonably displayed in size, which can improve the user experience when browsing pictures, especially in the case of poor network environment or limited device performance.

[0139] S121. Preset a pixel threshold and an aspect ratio threshold;

[0140] In this embodiment, the pixel threshold is also a preset critical value, and the pixel threshold can be adjusted according to the performance attributes of the user device and the pixel distribution of the original picture; similarly, the aspect ratio threshold is also a preset critical value, which can divide the original picture into different size specifications of picture types, so as to refine the size compression work and improve the processing efficiency of size compression;

[0141] S122. If both the original width pixels and the original height pixels are less than or equal to the pixel threshold, use the original width pixels and the original height pixels as the target compression size of the original picture;

[0142] S123: if the original wide side pixel or the original high side pixel is greater than the pixel threshold, obtaining the original aspect ratio of the original image according to the original wide side pixel and the original high side pixel, and determining the target compression size of the original image according to the original aspect ratio and the aspect ratio threshold;

[0143] S124: compress the original image according to the target compression size to obtain the thumbnail.

[0144] In this embodiment, by presetting pixel thresholds and aspect ratio thresholds, the compression size of the image is dynamically adjusted, the original image file size is compressed to reduce the storage and bandwidth consumption of the user device, thereby optimizing the storage and transmission efficiency of thumbnails and original images; at the same time, the aspect ratio of the original image is retained as much as possible during the compression process to avoid deformation of the thumbnail display and maintain the visual quality of the thumbnail displayed in the user interface; by presetting pixel thresholds and aspect ratio thresholds, it is quickly determined whether compression is required, reducing unnecessary calculations, thereby improving the compression processing efficiency.

[0145] Specifically, if Figure 6 The step of determining the target compression size of the original image according to the original aspect ratio and the aspect ratio threshold comprises:

[0146] S21, presetting a first size and a second size, wherein the first size includes a first width pixel value and a first height pixel value, and the second size includes a second width pixel value and a second height pixel value;

[0147] In this embodiment, the first size is a target compression size preset for an original image that is smaller than the first aspect ratio threshold, and the second size is a target compression size preset for an original image that is larger than the second aspect ratio threshold. By presetting the first size and the second size, the efficiency of obtaining the target compression size of the original image can be improved; it is understandable that the first size and the second size can be adaptively adjusted according to the size of the thumbnail in the user interface of the user device;

[0148] S22, the aspect ratio threshold comprises a first aspect ratio threshold and a second aspect ratio threshold greater than the first aspect ratio threshold;

[0149] In this embodiment, the first aspect ratio threshold and the second aspect ratio threshold are preset critical values, which can be used to assist in defining the size of the original image, including that the original image is a vertical image with a height substantially larger than a width, or a horizontal image with a width substantially larger than a height, or a square image with a small difference between the width and the height. Subsequently, different target compression sizes are obtained for original images of different sizes, so that the compression process of the original image is more refined, and special processing can be performed for images of different sizes.

[0150] S23. If the original aspect ratio is less than the first aspect ratio threshold, then use the first dimension as the target compression dimension;

[0151] S24. If the original aspect ratio is equal to or greater than the first aspect ratio threshold and less than or equal to the second aspect ratio threshold, then calculate a third dimension as the target compression dimension according to the original width pixels, the original height pixels, and the pixel threshold; Preferably, the third dimension includes a third width pixel value and a third height pixel value;

[0152] S25. If the original aspect ratio is greater than the second aspect ratio threshold, then use the second dimension as the target compression dimension.

[0153] Compare the aspect ratio of the original picture with the first aspect ratio threshold and the second aspect ratio threshold, and classify the pictures into three categories: less than the first aspect ratio threshold, between the first aspect ratio threshold and the second aspect ratio threshold, and greater than the second aspect ratio threshold; Different processing methods are used for each category of pictures to determine the target compression dimension, so as to ensure that the compressed picture achieves the best visual effect and compression efficiency on the basis of maintaining its original aspect ratio;

[0154] Exemplarily, the pixel threshold is preset to 500, and this pixel threshold can be dynamically adjusted according to the attributes of the original picture to be displayed; Referring to the aspect ratios of mainstream devices, the first aspect ratio threshold is preset to 1:3, and the second aspect ratio threshold is preset to 3:1; Preset the first dimension and the second dimension. Preferably, the first dimension stipulates that the first width pixel value is 500 and the first height pixel value is 700, and the second dimension stipulates that the second width pixel value is 700 and the second height pixel value is 500;

[0155] If neither the original width pixels nor the original height pixels exceed the pixel threshold, that is, 500, then do not perform compression processing on the size of the original picture, and directly use the original width and height pixels as the size of the thumbnail;

[0156] If there is a dimension of the original picture's width and height pixels that exceeds the pixel threshold, then perform compression processing on the size of the original picture: If the aspect ratio of the original picture is less than the first aspect ratio threshold, that is, 1:3, then it is considered that the height of the original picture is relatively long, equivalent to a normal vertical picture, and the first dimension is used as the target compression dimension;

[0157] If the aspect ratio of the original image is equal to or greater than the first aspect ratio threshold, i.e., 1:3, but less than or equal to the second aspect ratio threshold, i.e., 3:1, it is considered that the relative difference in width and height of the original image is not significant, which is equivalent to a normal square image. Then, it is necessary to compare the original width pixels and the original height pixels of the original image, select the side corresponding to the larger value among the original width pixels and the original height pixels as the adjustment side, and set the pixel size of the adjustment side to the pixel threshold, i.e., 500. Then, calculate the pixels of the other side according to the aspect ratio of the original image, and use the pixels corresponding to the set adjustment side and the calculated pixels of the other side as the target compression size;

[0158] If the aspect ratio of the original image is greater than the second aspect ratio threshold, i.e., 3:1, it is considered that the width of the original image is relatively long, which is equivalent to a normal landscape image. Then, use the second size as the target compression size.

[0159] S200. Obtain the original image request of the displayed thumbnail, and obtain the original image information corresponding to the thumbnail according to the request;

[0160] In this embodiment, when the user browses several thumbnails on the page and is interested in a certain thumbnail and needs to obtain more information, a larger size, and a clearer original image of the thumbnail, the user clicks on the thumbnail. One display method is that after clicking on the thumbnail and after the picture preview entrance animation is completed, the original image is loaded in the background and displayed centered full screen; among them, the entrance animation refers to the transition animation of the picture preview, that is, with the position and size of the thumbnail, at the same time, perform a zoom-in and position movement animation. After a period of time, the original image is displayed centered full screen; when the user clicks on the thumbnail, the platform will generate a request for the user to view the original image, and this request includes the corresponding thumbnail, which can provide a basis for the background to obtain the original image information corresponding to the request.

[0161] In this embodiment, for each thumbnail displayed in the user interface, the background stores the basic information of the original image corresponding to each thumbnail. When the user clicks on the thumbnail and wants to obtain more picture information, the background will receive the user's request, and thus retrieve the requested original image information corresponding to the thumbnail for subsequent operations shown in the method;

[0162] S300. Determine the target sampling frequency according to the corresponding original image information and the preset sampling strategy;

[0163] It is understandable that sampling refers to the process of reducing the spatial resolution of data by a certain method while maintaining the main features of the picture data. That is, downsampling can reduce the number of pixels in the picture, thereby compressing the picture data volume. In this application, in low-end devices with poor performance, the running memory is relatively small. When browsing the platform page or application page on such devices, some high-resolution pictures may cause the device to experience OOM (Out Of Memory) and crash during the decoding process because the memory requested for decoding is greater than the running memory of the device. To ensure that users of such devices can also normally browse the platform page or application, a sampling strategy is used to sample the main features of some high-resolution and high-information pictures. When users use such devices to browse and operate, during the display process of the original picture, it is actually the sampled picture that is displayed, and the memory requested during the display process adapts to the running memory of the device being used. On the premise of avoiding requesting too much memory for display, users can also view as much information as possible in the original picture and avoid crashing due to memory overflow.

[0164] Specifically, as Figure 7 shown, the preset sampling strategy is specifically as follows:

[0165] S310. Preset an interception decoding dynamic factor and several sampling frequencies;

[0166] It is understandable that the sampling frequency refers to the number of times an image is sampled per unit time in image processing. In this embodiment, the downsampling method is adopted. Downsampling is the process of converting a high-resolution image into a low-resolution image by reducing the number of pixels in the image. This process is closely related to the sampling frequency because the sampling frequency determines the density and distribution of pixels in the image. When downsampling, in fact, the sampling frequency of the image is reduced, that is, the number of pixels per unit area is reduced.

[0167] In this embodiment, the interception decoding dynamic factor is set according to the device used by the user. If the resolution of the requested original picture is too large, the decoding process of the requested original picture needs to be intercepted first, and the requested original picture is sampled according to the corresponding sampling frequency to reduce the decoding memory required to obtain the requested original picture, thereby avoiding memory overflow of the device. Exemplarily, the interception decoding dynamic factor is defaulted to 1.5, and this interception decoding dynamic factor can be dynamically adjusted according to the performance characteristics of the user's device. It is understandable that when the original picture is downloaded from the server to the user's device, for the need to save the running memory of the device, the original picture will be encoded into an image file in a specific format to facilitate storage and save memory. And picture decoding is the process of converting the specific format image file back to its original visual representation. When the user needs to view the original picture, the original picture file needs to be decoded to normally display the original picture on the user interface.

[0168] S320. Obtain the original resolution and the memory occupied by a single pixel according to the corresponding original image information;

[0169] It can be understood that there are different types in the requested original images, and the memory occupied by the pixels of different types of images varies. Exemplarily, the memory occupied by a single pixel of an ALPHA_8 type image is 1 Byte, the memory occupied by a single pixel of an RGB_565 type image and an ARGB_4444 type image is both 2 Bytes, the memory occupied by a single pixel of an ARGB_8888 type image is 4 Bytes, and the memory occupied by a single pixel of an RGBA_F16 type image is 8 Bytes.

[0170] S330. Obtain the device screen resolution;

[0171] In this embodiment, the device screen resolution refers to the display ability of the device screen for images, usually expressed as the number of horizontal pixels multiplied by the number of vertical pixels; the device screen resolution is usually determined by factors such as the type, brand, model of the device and personal settings. Obtaining the device screen resolution as one of the parameters in the sampling process can fully consider the display performance of the device and improve the browsing quality of users.

[0172] S340. Obtain an interception decoding threshold according to the interception decoding dynamic factor, the device screen resolution and the memory occupied by a single pixel;

[0173] Specifically, the interception decoding threshold is the product of the interception decoding dynamic factor, the device screen resolution and the memory occupied by a single pixel, reflecting the lowest value required to intercept the decoding of the original image under this user device. If the decoding memory of any original image reaches this interception decoding threshold, the decoding process is decoded, and the original image is sampled and then decoded to avoid the flashback problem caused by the device being unable to meet the decoding memory.

[0174] Exemplarily, if the requested original image is of the ARGB_8888 type, so the memory occupied by a single pixel is 4 Bytes, so the interception decoding threshold = 1.5 * screen resolution * 4;

[0175] S350. Obtain the decoding memory required for the corresponding original image information according to the original resolution and the memory occupied by a single pixel;

[0176] Specifically, the decoding memory is the product of the memory occupied by a single pixel and the original resolution, reflecting the memory required to decode the original image from the code format into a visual image;

[0177] Exemplarily, if the original requested image is of the ARGB_8888 type, the memory occupied by a single pixel is 4 bytes, so the decoding memory = 4 * the original resolution;

[0178] S360. Compare the decoding memory with the intercepted decoding threshold to obtain a second comparison result, and select a sampling frequency from the several sampling frequencies as the target sampling frequency according to the second comparison result.

[0179] In this embodiment, the sampling frequency is preset. When the original requested image needs to be displayed, according to the required decoding memory and the intercepted decoding threshold, a target sampling frequency suitable for the original requested image is selected, which can improve the efficiency of sampling processing to a certain extent and also improve the compatibility of sampling processing.

[0180] Specifically, as Figure 8 shown, the step of comparing the decoding memory with the intercepted decoding threshold to obtain a second comparison result and selecting a sampling frequency from the several sampling frequencies as the target sampling frequency may include the following steps:

[0181] S361. The several sampling frequencies include a default sampling frequency and several custom sampling frequencies, and each custom sampling frequency corresponds to a ratio interval range;

[0182] Preferably, in this embodiment, the default sampling frequency is obtained using the default sampling strategy of Fresco; it can be understood that the default sampling strategy of Fresco pre-sets a default sampling frequency for image sampling;

[0183] S362. If the decoding memory is less than or equal to the intercepted decoding threshold, select the default sampling frequency as the target sampling frequency;

[0184] S363. If the decoding memory is greater than the intercepted decoding threshold, obtain the ratio of the decoding memory to the intercepted decoding threshold, and obtain the ratio interval range where the ratio is located;

[0185] S364. Obtain the corresponding custom sampling frequency according to the ratio interval range where it is located, and determine whether the corresponding custom sampling frequency is greater than the default sampling frequency. If so, use the corresponding custom sampling frequency as the target sampling frequency, otherwise use the default sampling frequency as the target sampling frequency.

[0186] It is understandable that when the decoding memory is less than or equal to the interception decoding threshold, it indicates that the user device can meet the need for decoding memory. Therefore, sampling the corresponding original picture information using the default sampling frequency can enable the device to operate normally. If the decoding memory is greater than the interception decoding threshold and the obtained custom frequency is less than the default sampling frequency, it means that in this case, the user device can meet the decoding after sampling with the default sampling frequency. Considering performance and efficiency, the default sampling frequency is also used for decoding. However, when the custom frequency is greater than the default sampling frequency, it means that using the default sampling frequency for sampling and then decoding may cause the device to crash. Therefore, a larger custom sampling frequency needs to be used for sampling to avoid the device crashing due to out-of-memory.

[0187] Exemplarily, 5 ratio intervals are set, and corresponding custom sampling frequencies are designed. The specific values are shown in Table 1 below:

[0188] Table 1

[0189] Ratio range Custom sampling frequency (1,4] 2 (4,16] 4 (16,64] 8 (64,256] 16 (256,+∞) 32

[0190] According to the ratio interval into which the ratio falls, the corresponding custom sampling frequency is obtained. Subsequently, based on the custom sampling frequency and the default sampling frequency, the target sampling frequency is obtained to sample and decode the corresponding original picture information. Finally, the sampled picture is displayed on the user page for the user to view. The above method can avoid the page or application crashing due to excessive decoding memory required for the original picture, resulting in the user being unable to normally view enlarged pictures with a large amount of information, thereby enhancing the reliability of the page or application and the user experience.

[0191] S400. Sample the corresponding original picture information according to the target sampling frequency to obtain a sampled picture, and display the sampled picture on the platform.

[0192] In this embodiment, the user device uses the sampled picture to be displayed on the user interface, which can be compatible with the performance and network conditions of different devices and avoid crashing caused by out-of-memory of the device. This method can improve the reliability of the platform or application.

[0193] Preferably, in this embodiment, each of the thumbnail images stores a corresponding thumbnail bitmap Bitmap, and each of the original pictures stores a corresponding original picture bitmap Bitmap;

[0194] Manage the storage of the thumbnail bitmap and the original image bitmap using the LRU (Least Recently Used) cache method, and eliminate the least recently used thumbnail or original image; use Soft Reference to handle the recycling and cleaning of the thumbnail bitmap and the original image bitmap, and recycle and clean the thumbnail or original image in a timely manner when the memory of the user device is insufficient.

[0195] As Figure 9 shown, the embodiment of the present application also provides a picture display system. Optionally, the system includes:

[0196] A compression display module 511, an acquisition module 512, a sampling frequency selection module 513, and a sampling display module 514, where:

[0197] The compression display module 511 is used to compress the original image according to the information of the original image and a preset compression policy to obtain a thumbnail, and display the thumbnail on the platform;

[0198] In this embodiment, the compression display module 511 can be used to execute Figure 2 the steps S100 shown in, and the specific description of the compression display module 511 can refer to the description of the steps S100;

[0199] The acquisition module 512 is used to request the original image of the displayed thumbnail, and obtain the original image information corresponding to the thumbnail according to the request;

[0200] In this embodiment, the acquisition module 512 can be used to execute Figure 2 the steps S200 shown in, and the specific description of the acquisition module 512 can refer to the description of the steps S200;

[0201] The sampling frequency selection module 513 is used to determine the target sampling frequency according to the corresponding original image information and a preset sampling policy;

[0202] In this embodiment, the sampling frequency selection module 513 can be used to execute Figure 2 the steps S300 shown in, and the specific description of the sampling frequency selection module 513 can refer to the description of the steps S300;

[0203] The sampling display module 514 is used to sample the corresponding original image information according to the target sampling frequency to obtain a sampled image, and display the sampled image on the platform;

[0204] In this embodiment, the sampling display module 514 can be used to executeFigure 2 For the step S400 shown, the specific description of the sampling display module 514 can refer to the description of the step S400.

[0205] The embodiment of the present application also provides an electronic device, the structure of which is as Figure 10 shown. The electronic device includes a memory 611, a processor 612, a communication module 613, an input / output interface 614, etc. Optionally, the memory 611, the processor 612, the communication module 613, and the input / output interface 614 can be connected and communicate through a bus 615.

[0206] The memory 611 is used to store one or more computer programs and transmit the code of the computer programs to the processor 612; when the one or more computer programs are executed by the processor 612, a picture display method in the embodiment of the present application is implemented.

[0207] Optionally, the electronic device can be connected to a network through the communication module 613 to communicate with other devices, such as terminals or servers, through the network to achieve data interaction. The electronic device can be various forms of digital computers, exemplarily, such as desktop computers, servers, workbenches, mainframe computers, or other types of computers. The electronic device can also be various forms of mobile terminals, exemplarily, such as smart phones, tablet computers, wearable devices (such as helmets, glasses, watches, etc.), and other similar mobile terminals.

[0208] Optionally, the electronic device can be connected to the required input / output devices, such as keyboards, display devices, etc., through the input / output interface 614. The electronic device itself can have a display device, and can also externally connect other display devices through the input / output interface 614. Optionally, a storage device, such as a hard disk, etc., can also be connected through the input / output interface 614, so that the data in the electronic device can be stored in the storage device, or the data in the storage device can be read, and the data in the storage device can also be stored in the memory 611. It can be understood that the input / output interface 614 can be a wired interface or a wireless interface. According to different actual application scenarios, the devices connected to the input / output interface 614 can be components of the electronic device or external devices connected to the electronic device when needed.

[0209] Optionally, the memory 611 can be a volatile memory and / or a non-volatile memory. The volatile memory can be a random access memory, etc., and the non-volatile memory can be a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, or a flash memory, etc.

[0210] Optionally, the computer program stored in the memory 611 may be divided into one or more modules, which are stored in the memory 611 and executed by the processor 612 to implement the method provided by the present embodiment. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, and the computer program instruction segments are used to describe the execution process of the computer program in the electronic device.

[0211] Optionally, the processor 612 may be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 612 include, but are not limited to, a central processing unit, a graphics processing unit, a digital signal processor, various special artificial intelligence computing chips, various processors running machine learning model algorithms, and may also be any suitable controller, microcontroller, processor, etc. The processor 612 executes each method and process of the present embodiment. Exemplarily, such as a picture display method according to an embodiment of the present application.

[0212] Optionally, the bus 615 may include a path for transmitting information. The bus 615 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. According to different functions, the bus 615 may be divided into an address bus, a data bus, a control bus, etc.

[0213] In an alternative implementation, an embodiment of the present application further provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a computer, the computer is enabled to execute the method of the above method embodiment. Part or all of the computer program may be loaded and / or installed on the memory 611 of the electronic device. When the computer program is executed by the processor 612, one or more steps of a picture display method according to an embodiment of the present application may be executed.

[0214] Optionally, the computer-readable storage medium may be a random access memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, etc.

[0215] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solutions of the present invention, rather than limitations on the specific implementation manners of the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the claims of the present invention shall be included in the protection scope of the claims of the present invention.

Claims

1. A method for displaying pictures, characterized in that, The method includes: Compressing the original image according to the information of the original image and a preset compression strategy to obtain a thumbnail for displaying the thumbnail on the platform; Obtaining an original image request for the displayed thumbnail, and obtaining the original image information corresponding to the thumbnail according to the request; Determining a target sampling frequency according to the corresponding original image information and a preset sampling strategy; Sampling the corresponding original image information according to the target sampling frequency to obtain a sampled image for displaying the sampled image on the platform.

2. The picture display method according to claim 1, wherein The compressing the original image according to the information of the original image and a preset compression strategy to obtain a thumbnail includes: The information of the original image includes the original resolution of the original image; Presetting a resolution threshold, comparing the original resolution with the resolution threshold to obtain a first comparison result, and determining a target compression quality value of the original image according to the first comparison result; Compressing the original image according to the target compression quality value to obtain the thumbnail.

3. The method for displaying pictures according to claim 2, characterized in that The presetting a resolution threshold, comparing the original resolution with the resolution threshold to obtain a first comparison result, and determining a target compression quality value of the original image according to the first comparison result includes: Presetting a first resolution threshold and a second resolution threshold; Presetting a number of gradually increasing compression quality values, each compression quality value corresponding to a compression quality coefficient, and the magnitudes of all compression quality coefficients increasing with the growth trend of the corresponding compression quality value; Selecting a compression quality value from all the compression quality values as a first target compression quality value, where the first target compression quality value is at least greater than one of the compression quality values; If the original resolution is less than or equal to the first resolution threshold, setting the first target compression quality value as the target compression quality value; If the original resolution is greater than the first resolution threshold and less than or equal to the second resolution threshold, determining a corresponding compression quality coefficient according to the original resolution and the first resolution threshold, and obtaining the target compression quality value according to the determined compression quality coefficient; If the original resolution is greater than the second resolution threshold, determining a corresponding compression quality coefficient according to the original resolution and the second resolution threshold, and obtaining the target compression quality value according to the determined compression quality coefficient.

4. A method for displaying pictures according to claim 3, characterized in that, The determining a corresponding compression quality coefficient according to the original resolution and the first resolution threshold, and obtaining the target compression quality value according to the determined compression quality coefficient includes: Taking the compression quality coefficient corresponding to the first target compression quality value as a first target compression quality coefficient; Selecting a compression quality value from all the compression quality values as a second target compression quality value, and taking the compression quality coefficient corresponding to the second target compression quality value as a second target compression quality coefficient; Dividing the first resolution threshold by the original resolution to obtain a first quotient value; When the first quotient value is equal to or greater than the first target compression quality coefficient, the first target compression quality value is used as the target compression quality value. When the first quotient value is less than or equal to the second target compression quality coefficient, the second target compression quality value is used as the target compression quality value; When the first quotient value is greater than the second target compression quality coefficient and less than the first target compression quality coefficient, the first quotient value is matched with the compression quality coefficient, and the compression quality value corresponding to the matched compression quality coefficient is used as the target compression quality value; and / or, The method for determining the corresponding compression quality coefficient according to the original resolution and the second resolution threshold and obtaining the target compression quality value according to the determined compression quality coefficient includes: Using the compression quality coefficient corresponding to the first target compression quality value as the first target compression quality coefficient; Selecting a compression quality value from all the compression quality values as the second target compression quality value, and using the compression quality coefficient corresponding to the second target compression quality value as the second target compression quality coefficient; Dividing the second resolution threshold by the original resolution to obtain a second quotient value; When the second quotient value is equal to or greater than the first target compression quality coefficient, the first target compression quality value is used as the target compression quality value. When the second quotient value is less than or equal to the second target compression quality coefficient, the second target compression quality value is used as the target compression quality value; When the second quotient value is greater than the second target compression quality coefficient and less than the first target compression quality coefficient, the second quotient value is matched with the compression quality coefficient, and the compression quality value corresponding to the matched compression quality coefficient is used as the target compression quality value.

5. A method for displaying pictures according to any one of claims 1 to 4, characterized in that The method for compressing the original picture according to the information of the original picture and the preset compression strategy to obtain a thumbnail includes: The information of the original picture includes the original wide-side pixels and the original high-side pixels; A preset pixel threshold and a width-to-height ratio threshold; If both the original wide-side pixels and the original high-side pixels are less than or equal to the pixel threshold, the original wide-side pixels and the original high-side pixels are used as the target compression size of the original picture; If either the original wide-side pixels or the original high-side pixels are greater than the pixel threshold, the original width-to-height ratio of the original picture is obtained according to the original wide-side pixels and the original high-side pixels, and the target compression size of the original picture is determined according to the original width-to-height ratio and the width-to-height ratio threshold; The original picture is compressed according to the target compression size to obtain the thumbnail.

6. A method for displaying pictures according to claim 5, characterized in that, The method for determining the target compression size of the original picture according to the original width-to-height ratio and the width-to-height ratio threshold includes: Presetting a first size and a second size, where the first size includes a first wide pixel value and a first high pixel value, and the second size includes a second wide pixel value and a second high pixel value; The width-to-height ratio threshold includes a first width-to-height ratio threshold and a second width-to-height ratio threshold greater than the first width-to-height ratio threshold; If the original aspect ratio is less than the first aspect ratio threshold, then use the first dimension as the target compression dimension; If the original aspect ratio is equal to or greater than the first aspect ratio threshold and less than or equal to the second aspect ratio threshold, then calculate a third dimension as the target compression dimension based on the original wide-side pixels, the original high-side pixels, and the pixel threshold; If the original aspect ratio is greater than the second aspect ratio threshold, then use the second dimension as the target compression dimension.

7. A method for displaying pictures according to any one of claims 1 to 4, characterized in that, The preset sampling strategy is specifically as follows: Preset an interception decoding dynamic factor and several sampling frequencies; Obtain the original resolution and the memory occupied by a single pixel according to the corresponding original picture information; Obtain the device screen resolution; Obtain an interception decoding threshold according to the interception decoding dynamic factor, the device screen resolution, and the memory occupied by a single pixel; Obtain the decoding memory required for the corresponding original picture information according to the original resolution and the memory occupied by a single pixel; Compare the decoding memory with the interception decoding threshold to obtain a second comparison result, and select a sampling frequency from the several sampling frequencies as the target sampling frequency according to the second comparison result.

8. A method for displaying pictures according to claim 7, characterized in that The step of comparing the decoding memory with the interception decoding threshold to obtain a second comparison result, and selecting a sampling frequency from the several sampling frequencies as the target sampling frequency includes: The several sampling frequencies include a default sampling frequency and several custom sampling frequencies, and each custom sampling frequency corresponds to a ratio interval range; If the decoding memory is less than or equal to the interception decoding threshold, then select the default sampling frequency as the target sampling frequency; If the decoding memory is greater than the interception decoding threshold, then obtain the ratio of the decoding memory to the interception decoding threshold, and obtain the ratio interval range where the ratio is located; Obtain the corresponding custom sampling frequency according to the ratio interval range where it is located, and determine whether the corresponding custom sampling frequency is greater than the default sampling frequency. If so, use the corresponding custom sampling frequency as the target sampling frequency, and if not, use the default sampling frequency as the target sampling frequency.

9. A picture display system, characterized in that, The system includes: A compression display module, configured to compress the original picture according to the information of the original picture and a preset compression strategy to obtain a thumbnail, and display the thumbnail on the platform; An acquisition module, configured to acquire an original picture request of the displayed thumbnail, and acquire the original picture information corresponding to the thumbnail according to the request; A sampling frequency selection module, configured to determine a target sampling frequency according to the corresponding original picture information and a preset sampling strategy; A sampling display module, configured to sample the corresponding original picture information according to the target sampling frequency to obtain a sampled picture, and display the sampled picture on the platform.

10. An electronic device, characterized in that, It includes: A memory, configured to store one or more computer programs; A processor, when the one or more computer programs are executed by the processor, implement a picture display method according to any one of claims 1-8.