CN114817780A - Picture loading method and device and storage medium - Google Patents

Picture loading method and device and storage medium Download PDF

Info

Publication number
CN114817780A
CN114817780A CN202110121723.7A CN202110121723A CN114817780A CN 114817780 A CN114817780 A CN 114817780A CN 202110121723 A CN202110121723 A CN 202110121723A CN 114817780 A CN114817780 A CN 114817780A
Authority
CN
China
Prior art keywords
picture
target
pixel
aspect ratio
pixels
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110121723.7A
Other languages
Chinese (zh)
Inventor
陈鹏
陈一
周绪南
郑国辉
张裕钦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110121723.7A priority Critical patent/CN114817780A/en
Publication of CN114817780A publication Critical patent/CN114817780A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Digital Computer Display Output (AREA)

Abstract

The application relates to the technical field of picture display processing, and provides a picture loading method, a picture loading device and a storage medium. In the method, a terminal determines a source picture to be loaded in an application page; obtaining the display size of a picture display area in a page; obtaining screen pixels of a terminal running the application; determining a target reference aspect ratio and a target reference pixel suitable for loading a source picture from a plurality of configured reference aspect ratios and a plurality of reference pixels based on screen pixels and display sizes; obtaining a target picture with a target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to a source picture stored by a server, wherein the plurality of candidate pictures are a plurality of different pictures obtained by performing light-weight processing on the source picture by the server according to the plurality of reference aspect ratios and the plurality of reference pixels; and loading the target picture on the page. The scheme of the application can improve the speed of loading the pictures by the terminal and reduce the consumption of bandwidth resources.

Description

Picture loading method and device and storage medium
Technical Field
The present application relates to the field of image display processing technologies, and in particular, to an image loading method and apparatus, and a storage medium.
Background
With the development of internet technology, a terminal often needs to obtain pictures from a server side and display the pictures returned by the server on the terminal side. For example, the terminal side requests a picture from the server through the browser and loads the picture.
However, if the data size of the picture requested by the terminal to the server is large, more bandwidth resources are consumed on the terminal side, and the speed of loading the picture on the terminal side is too slow.
Disclosure of Invention
In view of this, the present application provides a picture loading method, an apparatus and a storage medium, so as to increase the speed of loading a picture by a terminal and reduce bandwidth resources consumed by the terminal for obtaining the picture.
In order to achieve the purpose, the application provides the following technical scheme:
in one aspect, the present application provides a method for loading an image, including:
determining a source picture to be loaded in an application page;
obtaining a display size of a picture display area used for displaying the source picture in the page, wherein the display size is at least used for representing the aspect ratio of the picture display area;
obtaining screen pixels of a terminal running the application;
determining a target reference aspect ratio and a target reference pixel suitable for loading the source picture from a plurality of configured reference aspect ratios and reference pixels based on the screen pixel and the display size;
obtaining a target picture with the target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to the source picture stored by a server, wherein the plurality of candidate pictures are a plurality of different pictures obtained by performing light-weight processing on the source picture by the server according to the plurality of reference aspect ratios and the plurality of reference pixels, and the data volume of the picture obtained by the light-weight processing is smaller than that of the source picture;
and loading the target picture in the picture display area of the page.
In a possible implementation manner, the determining a source graph to be loaded in a page of an application includes:
determining a picture address of a source picture to be loaded in an application page;
the obtaining a target picture with the target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to the source picture stored by a server includes:
adding the information of the target reference aspect ratio and the target reference pixel in the picture address to obtain a reconstructed picture address, wherein the reconstructed picture address is used for pointing to a target picture with the target reference aspect ratio and the target reference pixel in a plurality of candidate pictures corresponding to the source picture;
sending the reconstructed picture address to the server, so that the server positions the target picture based on the reconstructed picture address;
and obtaining the target picture returned by the server based on the reconstructed picture address.
In yet another possible implementation manner, the display size further includes: the aspect ratio of the picture display area and the screen ratio information of the picture display area;
the determining, from a plurality of reference aspect ratios and a plurality of reference pixels configured based on the screen pixel and the display size, a target reference aspect ratio and a target reference pixel suitable for loading the source picture includes:
determining a reference aspect ratio, the distance from which to the aspect ratio of the picture display area satisfies a first setting condition, as a target reference aspect ratio, based on the configured plurality of reference aspect ratios;
determining the lowest pixel of a picture which is suitable for being displayed in the picture display area based on the screen proportion information and the screen pixel;
and determining a reference pixel, the difference value of which from the lowest pixel satisfies a second setting condition, as a target reference pixel based on the arranged plurality of types of reference pixels.
In one possible implementation manner, before determining, as the target reference pixel, a reference pixel whose difference value from the lowest pixel satisfies a second setting condition based on the configured plurality of types of reference pixels, the method further includes:
obtaining the network connection state of the terminal;
the determining, based on the configured plural kinds of reference pixels, a reference pixel that satisfies a second setting condition with the lowest pixel as a target reference pixel includes:
if the network connection state of the terminal represents that the terminal is accessed into a first-class communication network, determining reference pixels which are not smaller than the lowest pixel and have a difference value with the lowest pixel meeting a first difference value condition as target reference pixels based on multiple configured reference pixels;
and if the network connection state of the terminal represents that the terminal is accessed into the second-class communication network, determining the reference pixel which is smaller than the lowest pixel and has a difference value with the lowest pixel meeting a second difference value condition as a target reference pixel based on the configured multiple reference pixels.
In another aspect, the present application further provides a method for loading an image, including:
obtaining a picture request sent by an application of a terminal, wherein the picture request carries a target reference aspect ratio and a target reference pixel suitable for a source picture loaded by the application request, and the target reference aspect ratio and the target reference pixel belong to a plurality of reference aspect ratios and a plurality of reference pixels set by a server;
determining a target picture with the target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to the source picture, wherein the plurality of candidate pictures are a plurality of different pictures obtained by carrying out light-weight processing on the source picture according to the plurality of reference aspect ratios and the plurality of reference pixels, and the data volume of the picture obtained by the light-weight processing is smaller than that of the source picture;
and returning the target picture to the application of the terminal, so that the application loads the target picture in the page of the application.
In a possible implementation manner, before the obtaining a picture request sent by an application of a terminal, the method further includes:
obtaining display sizes of pictures and picture pixels of the pictures, which are respectively reported by applications of a plurality of terminals, wherein the display sizes are display sizes of picture display areas used for displaying the pictures in pages of the applications of the terminals, and the display sizes at least comprise aspect ratios of the picture display areas;
determining a first number of aspect ratios and a second number of picture pixels with highest frequency of appearance from the obtained picture pixels and the aspect ratios of the display sizes;
according to the selected first number of aspect ratios and the first second number of picture pixels, determining a plurality of reference aspect ratios and a plurality of reference pixels according to which the picture is processed from the configured plurality of candidate reference aspect ratios and the plurality of candidate reference pixels;
after the source picture to be added into the database is obtained, carrying out light-weight processing on the source picture according to the multiple reference aspect ratios and the multiple reference pixels to obtain multiple candidate pictures corresponding to the source picture, wherein the reference aspect ratios among the multiple candidate pictures are not identical to the reference pixels.
In one possible implementation manner, the method further includes:
for each candidate picture, determining a reference aspect ratio of the candidate picture and a frequency combination coefficient of a reference pixel, wherein the frequency combination coefficient is a product of an appearance frequency of the reference aspect ratio of the candidate picture and an appearance frequency of the reference pixel;
for each candidate picture, determining a target priority level corresponding to the candidate picture according to a frequency combination coefficient corresponding to the candidate picture; the priority level of the candidate picture with high frequency combination coefficient is not lower than that of the candidate picture with low frequency combination coefficient;
storing the candidate pictures into a storage layer corresponding to the target priority level, wherein the higher the priority level is, the higher the speed of obtaining pictures from the storage layer is;
determining a target picture with the target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to the source picture, including:
determining a storage layer corresponding to the target reference aspect ratio and the target reference pixel as a target storage layer;
and acquiring a target picture which corresponds to the source picture and is provided with the target reference aspect ratio and the target reference pixels from the target storage layer.
In another aspect, the present application further provides an image loading apparatus, including:
the loading determining unit is used for determining a source picture to be loaded in the page of the application;
a size obtaining unit, configured to obtain a display size of a picture display area in the page, where the picture display area is used for displaying the source picture, where the display size is at least used for representing an aspect ratio of the picture display area;
a pixel obtaining unit for obtaining a screen pixel of a terminal running the application;
a reference determination unit configured to determine a target reference aspect ratio and a target reference pixel suitable for loading the source picture from among a plurality of reference aspect ratios and a plurality of reference pixels configured based on the screen pixel and the display size;
a picture request unit, configured to obtain a target picture with the target aspect ratio and target reference pixels from multiple candidate pictures corresponding to the source picture stored in a server, where the multiple candidate pictures are multiple different pictures obtained by performing, by the server, a weight reduction process on the source picture according to the multiple aspect ratios and multiple reference pixels, and a data amount of a picture obtained by the weight reduction process is smaller than a data amount of the source picture;
and the picture loading unit is used for loading the target picture in the picture display area of the page.
In another aspect, the present application further provides an image loading apparatus, further including:
a request obtaining unit, configured to obtain a picture request sent by an application of a terminal, where the picture request carries a target reference aspect ratio and a target reference pixel suitable for a source picture requested to be loaded by the application, and the target reference aspect ratio and the target reference pixel belong to multiple reference aspect ratios and multiple reference pixels set by a server;
a picture determining unit, configured to determine a target picture having the target reference aspect ratio and target reference pixels from multiple candidate pictures corresponding to the source picture, where the multiple candidate pictures are multiple different pictures obtained by performing a light-weighting process on the source picture according to the multiple reference aspect ratios and multiple reference pixels, and a data amount of a picture obtained by the light-weighting process is smaller than a data amount of the source picture;
and the picture returning unit is used for returning the target picture to the application of the terminal so that the application loads the target picture in the page of the application.
In yet another aspect, the present application further provides a computer device comprising a memory and a processor;
wherein the memory is used for storing programs;
the processor is configured to execute the program, and when the program is executed, the program is specifically configured to implement the picture loading method as described in any one of the above.
In still another aspect, the present application further provides a storage medium for storing a program, where the program is configured to implement the picture loading method as described in any one of the above.
As can be seen from the above, in the present application, when an application of a terminal needs to load a picture into a page, an original picture is not directly obtained from a server, and a target reference aspect ratio and a target reference pixel, which are suitable for the loaded picture, of the picture in the picture display area are determined from multiple reference aspect ratios and multiple reference pixels configured according to a display size of the picture display area for displaying the picture in the page and a screen pixel of the terminal, so that the picture display area can load a clearly visible picture. Meanwhile, the target picture is obtained by performing lightweight processing on the source picture, so that the data volume of the target picture is smaller than that of the original picture, and the data volume consumed by obtaining the picture to be loaded can be reduced while the terminal is applied to a page to successfully load the picture by obtaining the target picture from the server, thereby reducing the bandwidth consumption and improving the picture loading speed.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on the provided drawings without creative efforts.
FIG. 1 is a schematic diagram of a system component architecture to which the solution of the present application is applicable;
fig. 2 is a schematic flowchart illustrating a picture loading method according to an embodiment of the present application;
FIG. 3 is a flow chart illustrating one implementation of server-side determination of a reference pixel and reference aspect ratio in the present application;
FIG. 4 is a diagram showing a comparison of a source picture and a cropped picture of the source picture;
FIG. 5 shows a diagram illustrating a source picture and a comparison of the source picture after it has been compressed;
fig. 6 is a schematic flowchart illustrating a picture loading method according to yet another embodiment of the present application;
FIG. 7 is a schematic diagram of two picture display areas of the same size displayed side by side in a page of an application;
FIG. 8 is a diagram illustrating a page of an application displaying three picture display areas of the same size side by side;
fig. 9 is a flowchart illustrating a picture loading method according to yet another embodiment of the present application;
FIG. 10 is a schematic diagram of a framework of an implementation principle of a picture loading method in the present application;
FIG. 11 is a schematic diagram illustrating a component structure of a picture loading apparatus according to an embodiment of the present application;
FIG. 12 is a schematic diagram illustrating a component structure of a picture loading apparatus according to another embodiment of the present application;
fig. 13 is a schematic diagram illustrating a component structure of a computer device according to the present application.
Detailed Description
The scheme of the application is suitable for any scene related to the situation that the application client obtains the pictures from the server and loads the pictures. For example, the method and the device for loading the pictures can be applied to a scene that the terminal requests the server for the pictures through the browser application and loads the pictures. For another example, the terminal may request a picture from the server through an application installed in the terminal, and after the server returns the picture, the picture is displayed on a page of the application, and the like.
For ease of understanding, a scenario in which the scheme of the present application is applicable will be described below.
Fig. 1 is a schematic diagram illustrating a composition architecture of a system to which the image loading method of the present application is applied.
The method of the embodiment may include: a terminal 101 and at least one server 102.
The terminal may run an application program capable of establishing a connection with the server, for example, the terminal may run a browser or other applications having a browser.
For example, the terminal 101 may request a picture to be loaded from the server through the application.
The server 102 may return the picture to the terminal so that the application of the terminal loads and displays the picture in the page of the application.
In the present application, there may be one or more servers. Multiple servers may constitute the picture processing platform 100.
Optionally, in order to improve the efficiency of picture access and query, multiple servers may be generally provided, and the multiple servers may form a server cluster or a distributed system.
For example, the multiple servers may be cloud service platforms, which are simply referred to as cloud platforms, such as cloud databases or cloud computer platforms.
Correspondingly, the cloud service platform formed by the plurality of servers can be a cloud server for providing basic cloud computing services such as cloud service, cloud computing, cloud storage, cloud communication, big data and artificial intelligence platforms and the like.
The cloud computing service is a computing service based on cloud technology. Cloud technology refers to a hosting technology for unifying serial resources such as hardware, software, network and the like in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
Cloud technology (Cloud technology) is based on a general term of network technology, information technology, integration technology, management platform technology, application technology and the like applied in a Cloud computing business model, can form a resource pool, is used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
For another example, the plurality of servers may also be a blockchain system, and on this basis, the pictures referred to in this application may be stored through blockchain link points in the blockchain.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
Of course, there may be other possibilities for the multiple servers, which are not limited in this regard.
In order to improve the efficiency of obtaining pictures by the terminal, in the application, the plurality of servers may further carry a Content Delivery Network (CDN) so as to provide the required pictures to the terminal more efficiently through the CDN.
It is understood that there may be one or more terminals accessing the server, which is not limited thereto.
It should be understood that fig. 1 is only a schematic diagram of a component architecture of a system to which the solution of the present application is applicable, and in practical applications, the system may have other possible forms, which is not limited in this respect.
The inventor of the present application found through research that: when a terminal requests a picture from a server, the picture provided by the server to the terminal is the same regardless of the terminal and the size of the display area of the terminal on which the picture is displayed.
With the diversification of terminals and the different requirements of the terminals for displaying pictures, the sizes of pictures suitable for being displayed by the terminals are actually greatly different. For example, the screen pixels of different types of terminals may be different, and therefore, the requirements of different types of terminals for the picture pixels of the picture may be different on the premise that the picture can be clearly displayed. For another example, the sizes of the picture display sizes of the pages for displaying pictures in the same terminal are different, and the sizes of the picture sizes of the required pictures are also different.
In combination with the above research findings, if the picture suitable for the terminal can be dynamically determined according to the display state parameter of the terminal display picture, the picture definition is considered, the time consumption for loading the picture is reduced, and the network bandwidth consumed by the terminal for obtaining the picture is reduced.
With the above, the picture loading method of the present application is first introduced from the terminal side.
As shown in fig. 2, which shows a flowchart of an embodiment of a picture loading method according to the present application, the method of the present embodiment is applied to a terminal, and the present embodiment may include:
s201, determining a source picture to be loaded in the page of the application.
The page of the application may be a page already presented by the application, or a page to be presented by the application.
On the basis that the pictures to be loaded in the pages determined in the step are determined to be unique and fixed in the conventional mode, but the pictures may be processed by source pictures, the pictures to be loaded in the pages determined in the step are referred to as the source pictures.
In one implementation, determining that the source picture to be loaded in the page may be obtaining a picture identifier of the source picture to be loaded.
And the picture identifier of the source picture loaded in the page is an icon identifier of a picture related to the page. Specifically, the icon identifier of the picture to be loaded into the page may be determined based on an operation instruction detected on the page; or the picture identifier of the picture to be loaded contained in the page data of the page.
And the picture identifier of the source picture is used for uniquely identifying the source picture. For example, the picture identification of the source picture may be an encoding of a picture, and the like. As an alternative, the picture identifier of the source picture may be a picture address of the source picture, and the picture address may locate the source picture. For example, the picture address of the source picture may be a uniform resource locator address for locating a storage location where the source picture is located.
For example, when an application is started or there is a need for updating a page, the application may obtain page data of a page to be presented from a server, where the page data includes a picture address of a source picture to be loaded into the page.
S202, obtaining the display size of a picture display area used for displaying the source picture in the page.
The picture display area may be an interface area of an interface for displaying the source picture, a control display area of a control, or other types of display areas in the page.
The display size of the picture display area is the size of the picture which can be displayed in the picture display area finally.
In this application, the display size of the picture display area is at least used for representing the aspect ratio of the picture display area. For example, the display size of the picture display area may include an aspect ratio of the picture display area, or a size including a width and a height of the picture display area.
It is understood that, in the case that the page of the application involves displaying a plurality of pictures laterally side by side at the same time, the display size of the picture display area may further include: screen proportion information of the picture display area. The screen proportion information of the picture display area can reflect the information that the picture display area occupies the screen, and further the information such as the lowest pixel of the picture required by the content clearly displayed in the picture display area can be determined by combining the screen pixel of the terminal.
Of course, the display size may contain other information, which is not limited.
S203, obtaining the screen pixel of the terminal.
The terminal is a terminal running the application.
The screen pixels of the terminal can reflect the resolution of the screen, and can also reflect picture pixels required by clear picture display on the screen of the terminal.
The screen pixels may include the number of horizontal pixels and the number of vertical pixels of the screen. It may be only the number of horizontal pixels including the screen in consideration of the user's picture browsing habit and the like.
And S204, determining a target reference aspect ratio and a target reference pixel suitable for loading the source picture from the configured multiple reference aspect ratios and multiple reference pixels based on the screen pixel and the display size.
Wherein the reference aspect ratio is an aspect ratio that the picture can exhibit. For example, the reference aspect ratio may include
The reference pixels may be pixels (e.g., one or both of horizontal pixels and vertical pixels) that the picture may represent.
In the present application, the configured reference aspect ratio and reference pixels are actually the aspect ratio and pixels on which the server side processes the picture, for example, the server may respectively perform different cropping on the picture stored in the storage according to multiple reference aspect ratios, and perform different pixel compression on the picture according to different reference pixels, so that the same picture corresponds to the picture having different reference aspect ratios and reference pixels.
Accordingly, a plurality of reference aspect ratios and a plurality of reference pixels, i.e., the source picture already stored on the server side, can be configured to selectively exhibit the reference aspect ratios and the reference pixels.
Wherein, the plurality of reference aspect ratios and the plurality of reference pixels configured in the application are predetermined by the server. In practical applications, the server may determine a plurality of reference aspect ratios and reference pixels, and then fixedly arrange the reference aspect ratios and the reference pixels in an application package.
In the case where the server periodically updates the reference aspect ratio and the reference pixels, the application may also periodically obtain a plurality of reference aspect ratios and reference pixels from the server; alternatively, the application may be upgraded to update various reference aspect ratios or reference pixels, etc. of its configuration.
The application does not limit the specific implementation of configuring the reference aspect ratio and the reference pixels in this application.
The target reference aspect ratio is a reference aspect ratio in which a distance from an aspect ratio of a picture display area represented by a display size satisfies a first setting condition among a plurality of reference aspect ratios. The first setting condition may be set as required, for example, the first setting condition may be: the distance from the aspect ratio represented by the display size is less than a set threshold, or the distance from the aspect ratio represented by the display size is minimal, and so on.
It will be appreciated that to ensure that there is no clear area in the picture display area of the page, the target reference aspect ratio should generally not be less than the aspect ratio of the picture display area. Accordingly, the target reference aspect ratio satisfying the first setting condition may be: among the plurality of reference aspect ratios, the reference aspect ratio which is closest to the aspect ratio of the image display region represented by the display size and is not smaller than the aspect ratio of the image display region.
Similarly, the target reference pixel may be a reference pixel whose difference from the screen pixel satisfies the second setting condition, among the plurality of kinds of reference pixels. For example, in the case where only one picture is displayed side by side on the page, the reference pixel satisfying the second setting condition may be the reference pixel having the smallest pixel difference value (or smaller than the pixel threshold value) from the screen pixel.
For another example, in a case where a page may display a plurality of pictures side by side, the lowest pixel suitable for displaying a picture in the picture display area may be determined from the plurality of reference pixels in combination with the screen ratio information represented by the display size of the picture display area, and the target reference pixel satisfying the second setting condition may be determined based on the lowest pixel. For example, the second setting condition may be a reference pixel whose difference value from the lowest pixel is closest or whose difference value from the lowest pixel is not less than the pixel threshold.
It is understood that, in order to ensure the clarity of the picture, the target reference pixel is generally not smaller than the lowest pixel suitable for the picture display area.
S205, a target picture with a target reference aspect ratio and target reference pixels is obtained from a plurality of candidate pictures corresponding to the source picture stored by the server.
The multiple candidate pictures are multiple different pictures obtained by the server performing light weight processing on the source picture according to multiple reference aspect ratios and multiple reference pixels. And the data volume of the picture obtained by the light weight processing is smaller than that of the source picture.
For example, a source picture may be cropped and compressed according to a plurality of reference aspect ratios and a plurality of reference pixels to obtain a plurality of different pictures. The reference aspect ratio may be an aspect ratio of a cropped picture of the source picture, and the reference pixel may be a pixel of a compressed picture of the source picture.
Wherein the reference aspect ratio between the plurality of candidate pictures is not exactly the same as the reference pixel. For example, the aspect ratio may be different between different candidate pictures, or the pixels (e.g., the number of horizontal pixels) may be different, or the aspect ratio and the pixels may be different between different candidate pictures.
The target picture is a candidate picture with the aspect ratio of the target reference aspect ratio and the pixels of the target reference pixels in the multiple candidate pictures.
From the foregoing analysis, it can be seen that the pixels of the target picture can meet the requirement of the picture display area for clearly presenting the picture content; moreover, the data volume of the target picture is relatively less than that of the source picture, so that the bandwidth cost consumed for acquiring the target picture from the server can be reduced, and the situations of loading failure or abnormal loading can be reduced.
There may be various ways to obtain the target picture from the server, for example, the picture identifier of the source picture, the target reference pixel and the target reference aspect ratio information may be sent to the server, so that the server may locate the target picture. Of course, there are other possible ways, which are not limiting.
S206, loading the target picture in the picture display area of the page.
It can be understood that, because the aspect ratios of different pictures are different, if the source picture is directly obtained and loaded in the picture display area, it is easy to happen that the source picture cannot be completely displayed in the picture display area because the source picture is not blocked, and the part which cannot be displayed in the source picture is meaningless to the picture display area, but bandwidth consumption is generated when the source picture is obtained.
In the application, since the aspect ratio of the target picture is matched with the aspect ratio of the picture display area, after the target picture is loaded and displayed in the picture display area, the target picture is shielded and the part which is not completely displayed is reduced; moreover, the aspect ratio of the target picture is smaller than that of the source picture, so that the data volume of the target picture is reduced, and the bandwidth consumed by obtaining the picture can be reduced under the condition of not influencing the normal viewing of the picture content.
Similarly, the pixels of the target picture are matched with the pixels of the screen, so that the terminal can obtain the picture with the pixels subjected to light weight processing such as compression on the premise of meeting the definition, the data volume consumed by the terminal for obtaining the picture to be loaded is reduced, and the consumption of bandwidth resources is reduced.
Meanwhile, the data volume required by the picture loaded by the terminal side is small, so that the terminal can efficiently realize picture loading, and the picture loading speed is increased.
In order to facilitate understanding of the solution of the present application, a process of determining the reference pixel and the reference aspect ratio on the server side in the present application will be described below. As shown in fig. 3, which shows a schematic flow chart of an implementation of determining multiple reference pixels and multiple reference aspect ratios in the present application, where the present embodiment is applied to a server, the method of the present embodiment may include:
s301, obtaining the display sizes and picture pixels of pictures respectively reported by the applications of a plurality of terminals.
The display size is the display size of a picture display area used for displaying the picture in the page of the application of the terminal. The display size includes at least an aspect ratio of the picture display area, i.e., a ratio of a width to a height of the picture display area. The display size has the same meaning as the display size of the image display area obtained by the terminal, and reference may be made to the related description of the foregoing embodiment, which is not described herein again.
The picture pixels are picture pixels of a picture displayed on the page by the terminal. For example, the picture pixel includes the number of horizontal pixels and the number of vertical pixels of the picture. In an alternative, the picture pixel may refer to only the number of horizontal pixels of the picture.
After the picture is loaded in the page, the terminal may report the display size of the picture display area where the picture loaded in the page is located and the picture pixel of the picture, for example, in the embodiment of fig. 2, after the step S206, the terminal may report the display size and the picture pixel of the picture display area corresponding to the picture loaded in the terminal to the server.
In practical application, the mode and the time for reporting the display size and the picture pixels to the server by the terminal can be multiple, and the mode and the time can be specifically set according to needs, so that the method is not limited.
S302, from the obtained picture pixels and the aspect ratios of the picture display areas, the first quantity of aspect ratios and the first second quantity of picture pixels with the highest frequency of appearance are determined.
The first number and the second number may be set as required, and are not limited thereto, and the first number and the second number may be the same or different. For example, the first number may be 6, the second number may be 8, and so on.
And S303, according to the selected first number of aspect ratios and the first second number of picture pixels, determining a plurality of reference aspect ratios and a plurality of reference pixels according to which the picture is processed from the configured plurality of candidate reference aspect ratios and the plurality of candidate reference pixels.
It can be understood that, in consideration of the fact that the difference between the screen pixels of different terminals and the display sizes of the picture display areas in the application pages of the terminals is large, in order to make the set reference pixel and the reference aspect ratio have general applicability, a plurality of candidate reference aspect ratios and a plurality of candidate reference pixels may be configured in advance.
The plurality of candidate base aspect ratios may include a minimum candidate base aspect ratio and a maximum candidate base aspect ratio, and the plurality of candidate base aspect ratios may be set according to a set step size between the minimum candidate base aspect ratio and the maximum candidate base aspect ratio.
In this application, the determined reference aspect ratio as the basis for image processing may be: a reference aspect ratio closest to or less than a set threshold value of the plurality of first number of aspect ratios.
In an alternative mode, for any one of the selected aspect ratios, one of the aspect ratios that is closest to the aspect ratio and is not smaller than the aspect ratio may be determined from among the plurality of candidate reference aspect ratios, which is an aspect ratio based on which the picture is processed, so that the plurality of reference aspect ratios are finally obtained.
Similarly, the reference pixel determined as the basis of the picture processing may be a plurality of candidate reference pixels that match the selected picture pixel having the highest frequency of occurrence.
For example, in an alternative manner, for each selected picture pixel, a candidate reference pixel having the smallest difference value with the picture pixel and no smaller than the picture pixel may be determined from the plurality of candidate reference pixels as the reference pixel on which the picture is processed.
For example, the following 22 kinds of discrete values can be preset as the candidate reference aspect ratios in 22, which are:
0.4、0.5、……、2.3、2.4、2.5。
wherein, the minimum candidate reference width-to-height ratio is 0.4, the maximum candidate width-to-height ratio is 2.5, and the step length is 0.1.
On this basis, after determining a plurality of aspect ratios with the highest frequency of occurrence, for each aspect ratio, a value nearest to the aspect ratio and not smaller than the aspect ratio may be found from all candidate reference aspect ratios, for example, if the reported aspect ratio is 0.98, then a reference aspect ratio nearest to the aspect ratio is 1.0, and if 1.0 is greater than 0.98, then the 1.0 may be used as the determined reference aspect ratio. If the aspect ratio with higher frequency is 0.95, the aspect ratio is the same as the distance between the two candidate reference aspect ratios, and on this basis, the candidate reference aspect ratio with larger value is selected as the reference aspect ratio, which is 1.0 here.
For the following description of reference pixels, for the convenience of understanding, the number of horizontal pixels of the picture pixel and the candidate reference pixel are both pictures is taken as an example:
for example, there are 10 kinds of discrete candidate reference pixels in total, 100, 200, … …, 900, and 1000, where the minimum candidate reference pixel is 100, the maximum candidate reference pixel is 1000, and the step size is 100. For example, if the selected picture pixel with a high frequency of occurrence is 150, the candidate reference pixel that is larger than the selected picture pixel with the high frequency of occurrence is 200, and 200 is the determined reference pixel. If the reported picture pixel is 101, the candidate reference pixel that is larger than the reported value and is the smallest is 200.
It can be understood that, in practical applications, if the display size of the picture and the data amount of the picture pixel reported by the terminal are small, the aspect ratio and the reference pixel with high use frequency may not be accurately counted. Similarly, a default initial reference pixel is set as a reference pixel according to which the picture is processed, so as to reduce the problem of large variance fluctuation caused by small amount of previous data.
Still taking the determination of the reference aspect ratio as an example, it is possible to default to use 6 reference aspect ratios of 0.4, 0.8, 1.2, 1.6, 2.0, and 2.4 as the reference aspect ratio according to which the picture is processed. Similarly, a total of 4 initial reference pixels of 100, 300, 600, and 1000 types may be set.
It can be understood that, with the increasing of the reported picture pixels and the display size, the server also periodically or regularly executes the implementation process of the step shown in fig. 3 to continuously refresh the picture pixels with the highest occurrence frequency and the aspect ratio, and finally updates the reference pixels and the reference aspect ratio.
It can be understood that after various reference aspect ratios and reference pixels are determined, in order that a terminal can obtain pictures with different reference aspect ratios and reference pixels from a server according to different requirements of the terminal for displaying the pictures, the server in the application performs light-weight processing on a source picture according to the various reference aspect ratios and the various reference pixels after obtaining the source picture to be added into a database, and obtains various candidate pictures corresponding to the source picture. The reference pixel and the reference aspect ratio corresponding to the candidate pictures are not completely the same. For ease of understanding, the lightening process includes one or more of clipping and compression as an example.
The reference aspect ratio actually represents a ratio of a width to a height exhibited by the picture, and therefore, the picture needs to be cropped according to the reference aspect ratio to crop a picture with the aspect ratio as the reference aspect ratio. Correspondingly, the source picture needs to be cut in various modes based on various reference pixels, and candidate pictures of various different reference pixels are obtained.
As shown in fig. 4, a schematic diagram of a source picture and a cropped picture of the source picture are respectively shown.
The leftmost picture in fig. 4 is the source picture, and the second, third and fourth pictures from left to right are respectively the source picture cropped to have aspect ratios of 1.0, 1.5 and 2.5.
By cropping the picture, the content presented in the picture is reduced. However, under the condition that the display size of the picture display area of the page of the terminal is limited, the part which is not cut in the source image can not be displayed, and the picture content displayed in the picture display area can not be changed and the data volume of the picture can be reduced by cutting the picture, so that the bandwidth cost for transmitting the picture can be saved, and the time required by loading and displaying the picture can be reduced.
It can be understood that, since the reference pixel refers to the number of pixels of the picture, it is necessary to compress the source picture in order to make the picture have the reference pixel, and therefore, each reference pixel of the present application can also be regarded as a compression ratio. Correspondingly, the source picture needs to be compressed in multiple ways based on multiple reference pixels, and candidate pictures of multiple different reference pixels corresponding to the source picture are obtained.
As an alternative, the reference pixel of the present application may be a reference pixel in the lateral direction of the picture, and on this basis, the picture is compressed according to the reference pixel, so that the number of lateral pixels in the compressed picture of the source picture is the reference pixel.
For example, assume that the reference pixel includes: 900. the 5 horizontal pixel sizes of 600, 300, 200, and 100 are required to compress the source picture into at least 900, 600, 300, 200, and 100 horizontal pixels, respectively, wherein the lower the value of the horizontal reference pixel, the higher the compression ratio, and the smaller the volume of the picture.
As shown in fig. 5, it shows a source picture and a comparison diagram after the source picture is compressed.
In fig. 5, the first picture from left to right is a source picture, the second to fourth pictures from left to right are three compressed pictures of the source picture, and the horizontal pixels of the three pictures are 900, 600, and 300, respectively.
Accordingly, the data amount of the source picture is 84KB, and the data amounts of the second to fourth pictures from left to right are 80KB, 68KB and 26KB in this order, and the data amount of the pictures is smaller as the compression ratio is higher.
It is understood that some candidate pictures may be pictures obtained by respectively cropping and compressing the source picture, and some candidate pictures may be pictures obtained by only cropping the source picture or may be pictures obtained by only compressing the pixels.
For example, on the premise that there are m kinds of reference aspect ratios and n kinds of reference pixels, the present application may process a source picture by any one of m kinds of cropping, n kinds of compression, and a combination of m kinds of cropping and n kinds of compression, so that only m kinds of candidate pictures that are cropped, only n kinds of candidate pictures that are compressed, and m × n kinds of candidate pictures that have both cropping and compression may be obtained. Wherein m and n are both natural numbers greater than 1.
Correspondingly, the server stores a plurality of candidate pictures obtained by processing the source picture in a database. Meanwhile, in order that the terminal can inquire the source picture according to the requirement, the server also stores the source picture in the database.
It is understood that the frequency of accessing pictures with different reference pixels and reference aspect ratios may be different, and based on this, in order to enable pictures with higher requirements for reference pixels and reference aspect ratios to be accessed more efficiently, the present application may also set corresponding priority levels for different reference pixels and reference aspect ratios.
Specifically, the frequency of appearance of each access of multiple reference pixels and the frequency of appearance corresponding to multiple reference aspect ratios can be counted according to the picture pixels and the display size reported by the terminal. Then, frequency combination coefficients corresponding to different reference combinations are determined. For example, if m kinds of aspect ratios and n kinds of reference pixels exist, m + n + m × n kinds of reference combinations may exist, the frequency combination coefficient of a reference combination is a product of the appearance frequencies of the reference objects included in the reference combination, and the reference object may be a reference aspect ratio or a reference pixel.
For example, assuming that the reference combination is a combination of the reference aspect ratio 100 and the reference pixel 800, the product of the appearance frequency corresponding to the reference aspect ratio 100 and the appearance frequency of the reference pixel 800 is determined as the frequency combination coefficient of the reference combination.
On the basis of the above, the multiple reference combinations can be divided into multiple different priority levels according to the levels of the occurrence frequency coefficients, wherein the priority level of the reference combination with the high frequency combination coefficient is relatively higher. Accordingly, more access resources can be allocated to the high priority benchmark set.
Accordingly, when any candidate picture is subjected to at least one of cropping and compression, the reference aspect ratio and the frequency combination coefficient of the reference pixel of the candidate picture can be determined. As described above, the frequency combination coefficient is a product of the frequency of occurrence of the reference aspect ratio that the candidate picture has and the frequency of occurrence of the reference pixel that the candidate picture has.
Wherein if the candidate picture is only subjected to one of cropping and compression, i.e. the candidate picture only has a reference aspect ratio or reference pixels, the frequency of occurrence corresponding to the reference dimension not present in the candidate picture is set to 1. For example, if the candidate picture is obtained by processing the source picture based on a certain reference aspect ratio, the pixel of the candidate picture is the pixel of the source picture, and the frequency of occurrence corresponding to the reference pixel of the candidate picture may default to 1, so the frequency combination coefficient of the candidate picture is the frequency of occurrence of the reference aspect ratio of the candidate picture.
On the basis, for each candidate picture of the source pictures, the target priority level corresponding to the candidate picture can be determined according to the frequency combination coefficient corresponding to the candidate picture. The priority level of the candidate picture with high frequency combination coefficient is not lower than that of the candidate picture with low frequency combination coefficient;
for example, a range section of the frequency combination coefficient corresponding to each of the different priority levels may be set, and based on the correspondence, the target priority level to which the frequency combination coefficient corresponding to the candidate picture belongs may be determined.
Correspondingly, the candidate picture is stored in the storage layer corresponding to the target priority level to which the candidate picture belongs. The higher the priority level is, the higher the picture access performance of the storage layer corresponding to the priority level is. Accordingly, pictures are acquired faster from a storage layer having a higher priority level.
For example, different storage tiers have different resources, wherein the higher the priority level is, the more resources are allocated to the storage tier corresponding to the priority level.
For example, the priority levels may be divided into three levels, and the priority levels from high to low are, respectively, priority level 1, priority level 2, and priority level 3. The priority level 1 corresponds to the storage layer with the most resources, and accordingly, the access efficiency of the terminal to access the candidate pictures in the storage layer 1 is the highest. In a possible implementation manner, for the highest priority level, the storage tier corresponding to the priority level may be set to be a storage tier including the deployed content distribution network system. And the storage layers corresponding to other priority levels do not deploy the storage areas of the content distribution network system. On the basis, if the target priority level corresponding to the candidate picture belongs to the highest priority level, the candidate picture can be stored in the content distribution network system, so that the candidate picture with high priority can be acquired by the terminal more efficiently.
On the basis, after the server obtains the target reference aspect ratio and the target reference pixel suitable for the source picture requested to be obtained by the terminal, the storage layer corresponding to the target reference aspect ratio and the target reference pixel may be determined as the target storage layer, and the target picture corresponding to the source picture and having the target reference aspect ratio and the target reference pixel may be obtained from the target storage layer. The target picture belongs to one of multiple candidate pictures corresponding to the source picture.
With the above description, the picture loading method of the present application is described below from the terminal side in a possible case of picture identification.
Fig. 6 is a schematic flowchart illustrating a still another embodiment of the image loading method according to the present application, where the method according to this embodiment may be applied to a terminal, and the terminal has an application installed therein. The method of the embodiment may include:
s601, determining the picture address of the source picture to be loaded in the page of the application.
For example, the picture address may be a uniform resource locator of the source picture.
S602, obtaining the display size of the picture display area for displaying the source picture in the page.
The display size may include an aspect ratio of the picture display area.
The display size may also include screen proportion information of the picture display area, such as a proportion of the picture display area occupying a lateral width of the screen.
S603, obtaining the screen pixel of the terminal.
And S604, based on the plurality of reference aspect ratios, determining the reference aspect ratio with the distance from the aspect ratio of the picture display area satisfying the first setting condition as the target reference aspect ratio.
For example, the target reference aspect ratio satisfying the first setting condition may be a reference aspect ratio that is least different from the aspect ratio in the display size and is not smaller than the aspect ratio in the display size.
And S605, determining the lowest pixel of the picture which is suitable for being displayed in the picture display area based on the screen ratio information and the screen pixel.
It can be understood that the screen proportion information reflects the proportion of the screen occupied by the picture display area, and in the case that the pixels of the screen are known, the picture displayed in the picture display area can have the lowest pixels on the basis of the screen proportion information on the premise that the picture display area clearly displays the picture content.
In one possible case, the picture display area occupies the proportion in the lateral direction of the screen as reflected by the screen proportion information. The lowest pixel is the lowest value of the lateral pixels of the picture that the picture display area is adapted to display.
For example, if two picture display areas with the same size need to be displayed horizontally side by side in a certain page in an application, the screen proportion information of each picture display area may be that the horizontal proportion of the picture display area is half of the screen.
As shown in fig. 7, it shows a schematic diagram of displaying two picture display areas with the same size side by side in a page of an application.
On the basis of fig. 7, assuming that the horizontal pixel value of the screen is 828, the horizontal pixel value of the picture displayed in each picture display area should be 828/2-414 pixels at the lowest, so that the picture display area can be ensured to clearly display the picture, and therefore, the picture suitable for display in the picture display area has 414 pixels at the lowest.
Similarly, if the page needs to display three pictures side by side in the horizontal direction, then according to the mask ratio information of the picture display areas, it can be determined that at least 828/3-276 pixels are needed for the pictures suitable for display in each picture display area on average. As shown in fig. 8, three picture display areas with the same size are displayed side by side in the page shown in fig. 8, therefore, three pictures need to be displayed side by side in the page, and on this basis, in order to ensure that each picture can be clearly displayed, the horizontal pixel of each picture cannot be lower than 276.
S606, based on the arranged plural kinds of reference pixels, determines a reference pixel whose difference value from the lowest pixel satisfies a second setting condition as a target reference pixel.
For example, the target reference pixel satisfying the second setting condition is a reference pixel which is not smaller than the lowest pixel and has the smallest difference value with the lowest pixel.
For example, assuming that the reference pixel is a horizontal pixel of the picture and the reference pixels include 900, 600, 300, 200, and 100, for the case shown in fig. 7, since the lowest pixel suitable for the picture display area is 276, the determined target reference pixel should be 300, and therefore, the horizontal pixel of the picture appearing in the page in fig. 7 may be 300.
It can be understood that, in practical applications, the network state of the terminal may also affect the picture message of the terminal-side loaded picture, and therefore, in a possible implementation manner, the network connection state of the terminal may also be obtained, and the network connection state may represent one or more information such as a network communication rate of the terminal or an access network type.
Correspondingly, the network connection state representation terminal of the terminal is accessed into the first-class communication network, and based on the configured multiple reference pixels, the reference pixel which is not less than the lowest pixel and the difference value between the reference pixel and the lowest pixel meets the first difference value condition is determined as the target reference pixel. For example, the first difference condition may be that the difference is minimum, or that the difference is smaller than a set threshold, etc.
And if the network connection state of the terminal represents that the terminal is accessed into the second-type communication network, determining the reference pixel which is smaller than the lowest pixel and has a difference value with the lowest pixel meeting a second difference value condition as a target reference pixel based on the configured multiple reference pixels. The second difference condition may also be that the difference is minimum or the difference is smaller than a set threshold, and the like, which is not limited herein.
The data transmission rate of the first type communication network is higher than that of the second type communication network, for example, the first type communication network may include a fifth generation mobile communication network, a fourth generation mobile communication network, and the like, and the second type communication network may be a third generation mobile communication network, and the like.
Of course, in practical applications, there may be other possibilities to determine the target reference pixel in combination with the network connection state of the terminal, which is not limited to this.
It should be noted that, although the above description is given by taking an implementation manner of determining the target reference aspect ratio and the target reference pixel suitable for loading the source picture as an example, the other implementation manners of determining the target reference aspect ratio and the target reference pixel mentioned in the foregoing embodiments are also applicable to the present embodiment.
S607, adding the target reference aspect ratio and the information of the target reference pixel to the picture address to obtain a reconstructed picture address.
And the reconstructed picture address is used for pointing to a target picture with the target reference aspect ratio and the target reference pixel in a plurality of candidate pictures corresponding to the source picture.
For example, the target reference aspect ratio and the target reference pixel are added at the end of the picture address of the source picture.
For example, the following steps are carried out:
assume that the picture address of the source picture is: http:// a × b/c × open, with a target base aspect ratio of 10 and a target base pixel of 300, the reconstructed picture address may be: http:// a × b/c × open _ 10/300.
Of course, there may be other possibilities for adding the target reference aspect ratio and the target reference pixel to the picture address, as long as the server can locate the target picture according to the reconstructed picture address, and this is not limited.
S608, sending the reconstructed picture address to the server, so that the server locates the target picture based on the reconstructed picture address.
For example, the server may determine a storage address of the target picture according to the reconstructed picture address, and obtain data of the target picture.
And S609, obtaining the target picture returned by the server based on the reconstructed picture address.
S610, loading the target picture in the page of the application.
In the embodiment of the application, the terminal side can comprehensively determine the pixels and the aspect ratio suitable for the pictures loaded in the picture display area by combining the screen aspect ratio and the aspect ratio of the picture display area in the page and the screen pixels of the terminal, so that the data volume of the loaded pictures is reduced while the picture display area can clearly display the pictures more reliably.
Meanwhile, the image address of the source image is reconstructed according to the target reference pixel suitable for the image display area and the target reference width-to-height ratio, so that the server can directly position the corresponding target image based on the reconstructed image address, time consumed by the server for inquiring the target image can be reduced, and the image acquisition efficiency is improved.
It is understood that, in the above solution of the present application, considering that the picture formats supported and displayed in the pages of the same application may also be different on different terminals, in this application, the server may also generate a plurality of candidate pictures with different reference aspect ratios and reference pixels and with different picture formats for the source picture.
Correspondingly, the application of the terminal can also determine at least one picture format supported by the terminal, and acquire a target picture with the target reference aspect ratio, the target pixel and the picture format supported by the terminal from a plurality of candidate pictures corresponding to the source picture stored by the server.
For ease of understanding, the picture loading method of the present application is described below from the server side.
As shown in fig. 9, which shows a schematic flow diagram of another embodiment of the image loading method according to the present application, where the method of the present embodiment is applied to a server, the method of the present embodiment may include:
s901, obtaining a picture request sent by an application of the terminal.
The picture request carries a target reference aspect ratio and target reference pixels suitable for a source picture requested to be loaded by an application.
For example, the picture request may carry a picture identification of the source picture, and load a target reference aspect ratio and target reference pixels for which the source picture is suitable.
The target reference aspect ratio and the target reference pixel belong to a plurality of reference aspect ratios and a plurality of reference pixels set by the server, which may specifically refer to the related description of the foregoing embodiment and are not described herein again.
S902, a target picture with a target reference aspect ratio and target reference pixels is determined from a plurality of candidate pictures corresponding to the source picture.
The candidate pictures are different pictures obtained by at least one of cutting and compressing the source picture according to the reference aspect ratios and the reference pixels. The generation of the candidate pictures can be combined with the related description of the foregoing embodiments, and details thereof are not repeated.
For example, in one possible implementation, the picture request may be a picture address of the source picture to which the target reference aspect ratio and the picture address of the target reference pixel, i.e., the aforementioned reconstructed picture address, are added. On this basis, the server may determine the target picture based on the reconstructed picture address.
And S903, returning the target picture to the application of the terminal, so that the application loads the target picture in the page of the application.
It is to be understood that, in the embodiment of fig. 9, if the picture request sent by the terminal carries a picture format supported by the terminal, the server may also determine the target picture by combining the target reference aspect ratio, the target reference pixel, and the picture format, and the specific process is as described above, which is not limited thereto.
In order to facilitate understanding of the solution of the present application, the following description is made in conjunction with an implementation principle architecture of the solution of the present application and an exemplary application scenario.
As shown in fig. 10, which shows a schematic diagram of an implementation principle framework of the solution of the present application. For convenience of understanding, an application scenario is taken as an example, a terminal is taken as a client where an application for providing news content is located, and a server is taken as a server of the application, and the application is provided with a browser for presenting the news content.
In this scenario, after the terminal displays a picture in a page of the browser through the browser, the terminal may send picture pixels of the picture displayed by the terminal and a display size of the picture to the server, where the display size includes an aspect ratio of the picture or an aspect ratio of a picture display area corresponding to the picture in the page.
The server processes the data of the picture pixels and the display sizes reported by the terminal, for example, the processing may include some processing such as deduplication, so as to complete the operation of the "data processing" module in the server in fig. 10.
Accordingly, the data statistics module in the server functions as: and carrying out data statistics on the display size and the picture pixels reported by the terminal to determine a first number of aspect ratios and a second number of picture pixels with higher frequency of occurrence. Based on the counted first number of aspect ratios and second number of picture pixels, and combining the configured candidate reference aspect ratios and candidate reference pixels, a plurality of reference aspect ratios and a plurality of reference pixels which are used as the basis of the picture light weight processing can be determined.
On the basis, after the server obtains the picture to be put in storage, the picture can be processed through the module of cutting/compressing, which specifically includes: and according to the determined multiple reference aspect ratios and multiple reference pixels, one or more types of processing of cutting and compressing the picture is carried out to obtain multiple pictures with smaller data volumes corresponding to the picture, and the processed picture is stored through a picture storage module.
The image storage module may determine the frequency combination coefficient of each image after the clipping/compression processing according to the aforementioned manner, and determine the priority level corresponding to the candidate image according to the frequency combination coefficient corresponding to each image, so as to store the images hierarchically according to the priority levels, so as to provide a storage layer with richer resources for storing the images with high priority levels.
On the basis, if the application of the terminal needs to load a news picture in a news page displayed by a browser, after the picture address of the news picture is determined, a target reference pixel and a target reference aspect ratio suitable for the loaded news picture can be determined according to the aspect ratio of a picture display area displaying the news picture in the news page, the screen ratio of the picture display area and the screen pixel of the terminal.
Correspondingly, the terminal can reconstruct the picture address based on the target reference pixel and the target reference width-to-height ratio to obtain a reconstructed picture address, and send the reconstructed picture address to the server.
After the server obtains the reconstructed picture address, the server can determine the storage layer where the news picture with the corresponding aspect ratio and pixels is located according to the reconstructed picture address, obtain the news picture with the corresponding aspect ratio and pixels and return the news picture to the terminal, so that the terminal loads the news picture with the aspect ratio and pixels suitable for the picture display area, and resource consumption caused by obtaining the original news picture is reduced.
The application also provides a picture loading device corresponding to the operation of the picture loading method on the terminal side.
As shown in fig. 11, which shows a schematic structural diagram of an embodiment of a picture loading apparatus according to the present application, the apparatus may be applied to a terminal, and the apparatus may include:
a loading determining unit 1101, configured to determine a picture identifier of a source picture to be loaded in an application page;
a size obtaining unit 1102, configured to obtain a display size of a picture display area in the page, where the picture display area is used for displaying the source picture, and the display size is at least used for representing an aspect ratio of the picture display area;
a pixel obtaining unit 1103 for obtaining a screen pixel of a terminal running the application;
a reference determination unit 1104 for determining a target reference aspect ratio and a target reference pixel to which the source picture is to be loaded, from among the plurality of reference aspect ratios and the plurality of reference pixels configured, based on the screen pixel and the display size;
a picture requesting unit 1105, configured to obtain a target picture having the target reference aspect ratio and target reference pixels from multiple candidate pictures corresponding to the source picture stored in a server, where the multiple candidate pictures are multiple different pictures obtained by performing, by the server, a weight reduction process on the source picture according to the multiple reference aspect ratios and multiple reference pixels, and a data amount of a picture obtained through the weight reduction process is smaller than a data amount of the source picture;
a picture loading unit 1106, configured to load the target picture in the picture display area of the page.
In one possible case, the load determination unit may include:
the address determining unit is used for determining the picture address of a source picture to be loaded in an application page;
the picture request unit includes:
an address reconstruction unit, configured to add the target reference aspect ratio and the information of the target reference pixel to the picture address to obtain a reconstructed picture address, where the reconstructed picture address is used to point to a target picture having the target reference aspect ratio and the target reference pixel in multiple candidate pictures corresponding to the source picture;
an address sending unit, configured to send the reconstructed picture address to the server, so that the server locates the target picture based on the reconstructed picture address;
and the picture obtaining unit is used for obtaining the target picture returned by the server based on the reconstructed picture address.
In still another possible case, the display size obtained by the size obtaining unit includes: the aspect ratio of the picture display area and the screen ratio information of the picture display area;
the reference determination unit includes:
an aspect ratio determination unit configured to determine, as a target reference aspect ratio, a reference aspect ratio for which a distance from an aspect ratio of the picture display area satisfies a first setting condition, based on the configured plurality of reference aspect ratios;
a lowest pixel determining unit, configured to determine, based on the screen proportion information and the screen pixels, a lowest pixel of a picture that is suitable for display in the picture display area;
and a reference pixel determination unit configured to determine, as a target reference pixel, a reference pixel whose difference from the lowest pixel satisfies a second setting condition, based on the arranged plural kinds of reference pixels.
In an optional implementation manner, the apparatus may further include:
a network state obtaining unit for obtaining a network connection state of the terminal before the reference pixel determining unit determines the target reference pixel;
the reference pixel determination unit includes:
a first pixel determining unit, configured to determine, as a target reference pixel, a reference pixel that is not less than the lowest pixel and whose difference with the lowest pixel satisfies a first difference condition based on multiple reference pixels configured, if a network connection state of the terminal indicates that the terminal accesses a first type of communication network;
and the second pixel determining unit is used for determining the reference pixel which is smaller than the lowest pixel and has a difference value meeting a second difference condition with the lowest pixel as a target reference pixel based on the configured multiple reference pixels if the network connection state of the terminal represents that the terminal accesses the second type communication network.
The application also provides another picture loading device corresponding to the operation of the picture loading method on the server side.
Referring to fig. 12, which is a schematic diagram illustrating a component structure of another embodiment of a picture loading apparatus according to the present application, the apparatus may be applied to a server, and the apparatus may include:
a request obtaining unit 1201, configured to obtain a picture request sent by an application of a terminal, where the picture request carries a target reference aspect ratio and a target reference pixel suitable for a source picture requested to be loaded by the application, and the target reference aspect ratio and the target reference pixel belong to multiple reference aspect ratios and multiple reference pixels set by a server;
a picture determining unit 1202, configured to determine a target picture having the target reference aspect ratio and target reference pixels from among multiple candidate pictures corresponding to the source picture, where the multiple candidate pictures are multiple different pictures obtained by performing a weight reduction process on the source picture according to the multiple reference aspect ratios and multiple reference pixels, and a data amount of a picture obtained by the weight reduction process is smaller than a data amount of the source picture;
a picture returning unit 1203, configured to return the target picture to an application of the terminal, so that the application loads the target picture in a page of the application.
In one possible implementation, the apparatus may further include:
the data obtaining unit is used for obtaining the display sizes of the pictures and the picture pixels of the pictures, which are respectively reported by the applications of the multiple terminals, before the request obtaining unit obtains the picture requests sent by the applications of the terminals, wherein the display sizes are the display sizes of picture display areas used for displaying the pictures in the pages of the applications of the terminals, and the display sizes at least comprise the aspect ratio of the picture display areas;
the data screening unit is used for determining the first number of aspect ratios and the second number of picture pixels with the highest frequency of occurrence from the obtained picture pixels and the aspect ratios of the picture display areas;
a reference determining unit, configured to determine, according to the selected first number of aspect ratios and the first second number of picture pixels, a plurality of reference aspect ratios and a plurality of reference pixels according to which the picture is processed, from the configured plurality of candidate reference aspect ratios and the plurality of candidate reference pixels;
and the picture processing unit is used for carrying out light weight processing on the source picture according to the multiple reference aspect ratios and the multiple reference pixels after the source picture to be added into the database is obtained, so as to obtain multiple candidate pictures corresponding to the source picture, wherein the reference aspect ratios and the reference pixels between the multiple candidate pictures are not completely the same.
In yet another possible implementation manner, the apparatus further includes:
a coefficient determining unit configured to determine, for each of the candidate pictures, a reference aspect ratio that the candidate picture has and a frequency combination coefficient of a reference pixel, the frequency combination coefficient being a product of an appearance frequency of the reference aspect ratio that the candidate picture has and an appearance frequency of the reference pixel;
the hierarchy determining unit is used for determining a target priority hierarchy corresponding to each candidate picture according to the frequency combination coefficient corresponding to the candidate picture; the priority level of the candidate picture with high frequency combination coefficient is not lower than that of the candidate picture with low frequency combination coefficient;
the storage layer determining unit is used for storing the candidate pictures into a storage layer corresponding to the target priority level, wherein the higher the priority level is, the higher the speed of acquiring the pictures from the storage layer is;
a picture determination unit comprising:
the layer positioning unit is used for determining the storage layer corresponding to the target reference aspect ratio and the target reference pixel as a target storage layer;
and the picture obtaining unit is used for obtaining a target picture which corresponds to the source picture and is provided with the target reference aspect ratio and the target reference pixels from the target storage layer.
In yet another aspect, the present application further provides a computer device, which may be the aforementioned terminal or server, as shown in fig. 13, which shows a schematic diagram of a component architecture of the computer device provided in the present application. In fig. 13, the computer device 1300 may include: a processor 1301 and a memory 1302.
Optionally, the computer device may further include: a communication interface 1303, an input unit 1304, and a display 1305, and a communication bus 1306.
The processor 1301, the memory 1302, the communication interface 1303, the input unit 1304, and the display 1305 all communicate with each other via a communication bus 1306.
In this embodiment, the processor 1301 may be a central processing unit, an application specific integrated circuit, or the like.
The processor may call a program stored in the memory 1302, and in particular, the processor may perform the operations of the computer device or the terminal side in the above embodiments.
The memory 1302 is used for storing one or more programs, and the program may include program codes including computer operation instructions, and in this embodiment, the memory at least stores a picture loading method for implementing any one of the above embodiments corresponding to the terminal or the computer device side.
In one possible implementation, the memory 1302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, the above-mentioned programs, and the like; the storage data area may store data created during use of the computer device.
The communication interface 1303 may be an interface of a communication module.
The present application may further include an input unit 1304, which may include a touch sensing unit, a keyboard, and the like.
The display 1305 includes a display panel such as a touch display panel or the like.
Of course, the computer device structure shown in fig. 13 does not constitute a limitation of the computer device in the embodiment of the present application, and in practical applications, the computer device may include more or less components than those shown in fig. 13, or some components may be combined.
On the other hand, the present application further provides a storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are loaded and executed by a processor, the method for loading a picture as in any one of the above embodiments is implemented.
The present application also proposes a computer program product or a computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and executes the computer instruction, so that the computer device executes the method provided in the various optional implementation manners in the aspect of the image loading method or the aspect of the image loading apparatus.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. Meanwhile, the features described in the embodiments of the present specification may be replaced or combined with each other, so that those skilled in the art can implement or use the present application. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that it is obvious to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and these modifications and improvements should also be considered as the protection scope of the present invention.

Claims (10)

1. A picture loading method is characterized by comprising the following steps:
determining a source picture to be loaded in an application page;
obtaining a display size of a picture display area used for displaying the source picture in the page, wherein the display size is at least used for representing the aspect ratio of the picture display area;
obtaining screen pixels of a terminal running the application;
determining a target reference aspect ratio and a target reference pixel suitable for loading the source picture from a plurality of configured reference aspect ratios and reference pixels based on the screen pixel and the display size;
obtaining a target picture with the target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to the source picture stored by a server, wherein the plurality of candidate pictures are a plurality of different pictures obtained by performing light-weight processing on the source picture by the server according to the plurality of reference aspect ratios and the plurality of reference pixels, and the data volume of the picture obtained by the light-weight processing is smaller than that of the source picture;
and loading the target picture in the picture display area of the page.
2. The method of claim 1, wherein the determining the source picture to be loaded in the page of the application comprises:
determining a picture address of a source picture to be loaded in an application page;
the obtaining a target picture with the target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to the source picture stored by a server includes:
adding the information of the target reference aspect ratio and the target reference pixel in the picture address to obtain a reconstructed picture address, wherein the reconstructed picture address is used for pointing to a target picture with the target reference aspect ratio and the target reference pixel in a plurality of candidate pictures corresponding to the source picture;
sending the reconstructed picture address to the server, so that the server positions the target picture based on the reconstructed picture address;
and obtaining the target picture returned by the server based on the reconstructed picture address.
3. The method of claim 1, wherein the display size comprises: the aspect ratio of the picture display area and the screen ratio information of the picture display area;
the determining, from a plurality of reference aspect ratios and a plurality of reference pixels configured based on the screen pixel and the display size, a target reference aspect ratio and a target reference pixel suitable for loading the source picture includes:
determining a reference aspect ratio, the distance from which to the aspect ratio of the picture display area satisfies a first setting condition, as a target reference aspect ratio, based on the configured plurality of reference aspect ratios;
determining the lowest pixel of a picture which is suitable for being displayed in the picture display area based on the screen proportion information and the screen pixel;
and determining a reference pixel, the difference value of which from the lowest pixel satisfies a second setting condition, as a target reference pixel based on the arranged plurality of types of reference pixels.
4. The method according to claim 3, before determining, as a target reference pixel, a reference pixel whose difference from the lowest pixel satisfies a second setting condition based on the arranged plural kinds of reference pixels, further comprising:
obtaining the network connection state of the terminal;
the determining, based on the arranged plural kinds of reference pixels, a reference pixel whose difference value from the lowest pixel satisfies a second setting condition as a target reference pixel includes:
if the network connection state of the terminal represents that the terminal is accessed into a first-class communication network, determining reference pixels which are not smaller than the lowest pixel and have a difference value with the lowest pixel meeting a first difference value condition as target reference pixels based on multiple configured reference pixels;
if the network connection state of the terminal represents that the terminal is accessed into the second type communication network, based on the configured multiple reference pixels, the reference pixel which is smaller than the lowest pixel and the difference value of which with the lowest pixel meets a second difference value condition is determined as a target reference pixel.
5. A picture loading method is characterized by comprising the following steps:
obtaining a picture request sent by an application of a terminal, wherein the picture request carries a target reference aspect ratio and a target reference pixel suitable for a source picture loaded by the application request, and the target reference aspect ratio and the target reference pixel belong to a plurality of reference aspect ratios and a plurality of reference pixels set by a server;
determining a target picture with the target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to the source picture, wherein the plurality of candidate pictures are a plurality of different pictures obtained by carrying out light-weight processing on the source picture according to the plurality of reference aspect ratios and the plurality of reference pixels, and the data volume of the picture obtained by the light-weight processing is smaller than that of the source picture;
and returning the target picture to the application of the terminal, so that the application loads the target picture in the page of the application.
6. The method according to claim 5, wherein before the obtaining the picture request sent by the application of the terminal, the method further comprises:
obtaining display sizes of pictures and picture pixels of the pictures, which are respectively reported by applications of a plurality of terminals, wherein the display sizes are display sizes of picture display areas used for displaying the pictures in pages of the applications of the terminals, and the display sizes at least comprise aspect ratios of the picture display areas;
determining the first number of aspect ratios and the first second number of picture pixels with the highest frequency of appearance from the obtained picture pixels and the aspect ratios of the picture display areas;
according to the selected first number of aspect ratios and the first second number of picture pixels, determining a plurality of reference aspect ratios and a plurality of reference pixels according to which the picture is processed from the configured plurality of candidate reference aspect ratios and the plurality of candidate reference pixels;
after the source picture to be added into the database is obtained, carrying out light-weight processing on the source picture according to the multiple reference aspect ratios and the multiple reference pixels to obtain multiple candidate pictures corresponding to the source picture, wherein the reference aspect ratios among the multiple candidate pictures are not identical to the reference pixels.
7. The method of claim 6, further comprising:
for each candidate picture, determining a reference aspect ratio of the candidate picture and a frequency combination coefficient of a reference pixel, wherein the frequency combination coefficient is a product of an appearance frequency of the reference aspect ratio of the candidate picture and an appearance frequency of the reference pixel;
for each candidate picture, determining a target priority level corresponding to the candidate picture according to a frequency combination coefficient corresponding to the candidate picture; the priority level of the candidate picture with high frequency combination coefficient is not lower than that of the candidate picture with low frequency combination coefficient;
storing the candidate pictures into a storage layer corresponding to the target priority level, wherein the higher the priority level is, the higher the speed of obtaining pictures from the storage layer is;
determining a target picture with the target reference aspect ratio and target reference pixels from a plurality of candidate pictures corresponding to the source picture, including:
determining a storage layer corresponding to the target reference aspect ratio and the target reference pixel as a target storage layer;
and acquiring a target picture which corresponds to the source picture and is provided with the target reference aspect ratio and the target reference pixels from the target storage layer.
8. A picture loading apparatus, comprising:
the loading determining unit is used for determining a source picture to be loaded in the page of the application;
a size obtaining unit, configured to obtain a display size of a picture display area in the page, where the picture display area is used for displaying the source picture, where the display size is at least used for representing an aspect ratio of the picture display area;
a pixel obtaining unit for obtaining a screen pixel of a terminal running the application;
a reference determination unit configured to determine a target reference aspect ratio and a target reference pixel suitable for loading the source picture from among a plurality of reference aspect ratios and a plurality of reference pixels configured based on the screen pixel and the display size;
a picture request unit, configured to obtain a target picture with the target reference aspect ratio and target reference pixels from multiple candidate pictures corresponding to the source picture stored in a server, where the multiple candidate pictures are multiple different pictures obtained by performing, by the server, a weight reduction process on the source picture according to the multiple reference aspect ratios and multiple reference pixels, and a data amount of a picture obtained by the weight reduction process is smaller than a data amount of the source picture;
and the picture loading unit is used for loading the target picture in the picture display area of the page.
9. A picture loading apparatus, comprising:
a request obtaining unit, configured to obtain a picture request sent by an application of a terminal, where the picture request carries a target reference aspect ratio and a target reference pixel suitable for a source picture requested to be loaded by the application, and the target reference aspect ratio and the target reference pixel belong to multiple reference aspect ratios and multiple reference pixels set by a server;
a picture determining unit, configured to determine a target picture having the target reference aspect ratio and target reference pixels from multiple candidate pictures corresponding to the source picture, where the multiple candidate pictures are multiple different pictures obtained by performing a light-weighting process on the source picture according to the multiple reference aspect ratios and multiple reference pixels, and a data amount of a picture obtained by the light-weighting process is smaller than a data amount of the source picture;
and the picture returning unit is used for returning the target picture to the application of the terminal so that the application loads the target picture in the page of the application.
10. A storage medium storing a program which, when executed, implements the picture loading method as claimed in any one of claims 1 to 4, or claims 5 to 7.
CN202110121723.7A 2021-01-28 2021-01-28 Picture loading method and device and storage medium Pending CN114817780A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110121723.7A CN114817780A (en) 2021-01-28 2021-01-28 Picture loading method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110121723.7A CN114817780A (en) 2021-01-28 2021-01-28 Picture loading method and device and storage medium

Publications (1)

Publication Number Publication Date
CN114817780A true CN114817780A (en) 2022-07-29

Family

ID=82525875

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110121723.7A Pending CN114817780A (en) 2021-01-28 2021-01-28 Picture loading method and device and storage medium

Country Status (1)

Country Link
CN (1) CN114817780A (en)

Similar Documents

Publication Publication Date Title
US9253284B2 (en) Historical browsing session management
US8849802B2 (en) Historical browsing session management
US20100268694A1 (en) System and method for sharing web applications
US20130080577A1 (en) Historical browsing session management
WO2017167050A1 (en) Configuration information generation and transmission method, and resource loading method, apparatus and system
US20130080576A1 (en) Historical browsing session management
CN113094136A (en) Page display control method and device, storage medium and electronic equipment
CN103686206A (en) Video transcoding method and system in cloud environment
US8972477B1 (en) Offline browsing session management
CN109086158B (en) Abnormal cause analysis method and device and server
WO2016033060A1 (en) Data limit aware content rendering
CN108881379B (en) Method and device for data synchronization between server clusters
RU2597518C2 (en) Dynamic image result stitching
CN113347276B (en) Mobile access system based on GIS
US11874859B2 (en) Method of and system for defining a service for serving map images
CN107592553B (en) Image compression agent balance processing method and device
CN108959393B (en) Dynamic picture processing method, device and storage medium
CN114817780A (en) Picture loading method and device and storage medium
CN112100414A (en) Data processing method, device, system and computer readable storage medium
US11086822B1 (en) Application-based compression
CN110020111B (en) Travel recommendation method and device, computer equipment and storage medium
CN113849255B (en) Data processing method, device and storage medium
CN115209232B (en) Video processing method and device, electronic equipment and storage medium
KR101529602B1 (en) Cache server, system for providing of the content and method forreplacement of the content
CN112035760B (en) Task allocation method and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination