WO2018196409A1 - 一种用于移动终端的网络图片下载方法及系统 - Google Patents

一种用于移动终端的网络图片下载方法及系统 Download PDF

Info

Publication number
WO2018196409A1
WO2018196409A1 PCT/CN2017/117378 CN2017117378W WO2018196409A1 WO 2018196409 A1 WO2018196409 A1 WO 2018196409A1 CN 2017117378 W CN2017117378 W CN 2017117378W WO 2018196409 A1 WO2018196409 A1 WO 2018196409A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
download
mobile terminal
image
downloading
Prior art date
Application number
PCT/CN2017/117378
Other languages
English (en)
French (fr)
Inventor
汪刚
陈少杰
张文明
Original Assignee
武汉斗鱼网络科技有限公司
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 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2018196409A1 publication Critical patent/WO2018196409A1/zh

Links

Images

Classifications

    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data

Definitions

  • the present invention relates to the field of application development of a mobile terminal, and in particular, to a network picture downloading method and system for a mobile terminal.
  • the network picture will occupy a large amount of mobile terminal memory after being rendered by the mobile terminal.
  • the 1M network picture can be up to 100M after being rendered. Therefore, when the mobile terminal loads a few large-sized network pictures and renders them, all the loaded network pictures occupy the memory of the mobile terminal, which may exceed the memory threshold of the mobile terminal, which may directly cause the corresponding APP to “catch up”. And being shut down by the mobile terminal, thereby greatly reducing the user experience.
  • the technical problem solved by the present invention is how to make the size and occupied memory of the downloaded network picture meet the requirements of the mobile terminal.
  • the invention can significantly reduce the memory of the mobile terminal occupied by the downloaded picture, avoiding the situation that the APP is stuck in the prior art, ensuring the running quality of the APP, and greatly improving the user experience.
  • the method for downloading a network picture for a mobile terminal includes the following steps:
  • Step A The mobile terminal creates a picture download interface, and the picture download interface includes a picture download picture address, and a placeholder picture displayed when the picture is not downloaded, and proceeds to step B;
  • Step B The mobile terminal downloads the picture through the picture download interface, and displays the picture download information during the download process, and proceeds to step C;
  • Step C Set the specified picture height to H1, specify the picture width to be W1, and obtain the height H2 and width W2 of the downloaded picture; when H1 ⁇ H2, calculate the height scale factor HF1 according to H1 and H2; when W1 ⁇ W2, according to W1 and W2 calculate the width proportional coefficient WF1; when WF1>HF1, calculate the final width proportional coefficient WF2 according to WF1 and S, S is the stretch ratio obtained according to H1 and W1, and HF1 is taken as the final height proportional coefficient HF2; when WF1 ⁇ In HF1, HF2 is calculated according to HF1 and S, WF1 is taken as WF2; the height H3 of the compressed picture is calculated according to H1 and HF2, the width W3 of the compressed picture is calculated according to W1 and WF2; and the downloaded picture is adjusted according to H3 and W3, Compress the picture and go to step D;
  • Step D The mobile terminal determines whether the memory occupied by the compressed picture > the specified picture occupies the memory size, and if so, compresses the compressed picture according to the specified ratio, and then performs step D again, otherwise proceeds to step E;
  • Step E The mobile terminal saves and displays the compressed picture.
  • the network picture downloading system for a mobile terminal comprises: a picture download interface creation module, a picture download module, a picture size compression module, a picture memory determination module and a picture storage display module on the mobile terminal;
  • the picture download interface creation module is configured to: create a picture download interface, the picture download interface includes a picture download picture address, and a place picture displayed when the picture is not downloaded, and send a picture download signal to the picture download module;
  • the image downloading module is configured to: after receiving the image downloading signal, download the image through the image downloading interface, and display the image downloading information during the downloading process, and send the image size compression signal to the image size compression module after the image downloading is completed;
  • the picture size compression module is configured to: after receiving the picture size compression signal, set the specified picture height to H1, specify the picture width to be W1, and obtain the height H2 and width W2 of the downloaded picture; when H1 ⁇ H2, calculate according to H1 and H2 Height ratio coefficient HF1; when W1 ⁇ W2, calculate the width proportional coefficient WF1 according to W1 and W2; when WF1>HF1, calculate the final width proportional coefficient WF2 according to WF1 and S, S is the stretch ratio obtained according to H1 and W1, HF1 is taken as the final height proportional coefficient HF2; when WF1 ⁇ HF1, HF2 is calculated according to HF1 and S, WF1 is taken as WF2; the height H3 of the compressed picture is calculated according to H1 and HF2, and the width W3 of the compressed picture is calculated according to W1 and WF2 According to H3 and W3, the downloaded picture is adjusted to obtain a compressed picture, and the picture memory determination signal is sent to the picture memory determining module;
  • the picture memory determination module is configured to: after receiving the picture memory determination signal, perform memory judgment: determine whether the memory occupied by the compressed picture > the specified picture occupies the memory size, and if so, compress the compressed picture according to the specified ratio and then perform the memory judgment again. Otherwise, the picture storage display signal is sent to the picture storage display module;
  • the picture storage display module is used to: save and display compressed pictures.
  • the present invention compresses the downloaded network picture according to the self-developed picture compression mode, so that the size of the compressed picture and the occupied memory satisfy the requirements of the mobile terminal. . Therefore, the present invention can significantly reduce the memory of the mobile terminal occupied by the downloaded picture, avoiding the situation that the APP is stuck in the prior art, ensuring the running quality of the APP, and greatly improving the user experience.
  • the invention calls the picture download interface independent of the APP to download the picture, and the mobile terminal can call the picture download interface when downloading all the pictures, the operation is convenient, and the user experience is further improved.
  • the present invention downloads a picture through a picture download operation queue, which can ensure the download order of the picture, thereby improving the picture download quality.
  • the present invention displays image download information (image size to be downloaded, downloaded image size, image download completion information, and image download error information) during the image downloading process, so that the user can immediately know the download progress or download error. The reason is further enhanced by the user experience.
  • FIG. 1 is a flowchart of a method for downloading a network picture for a mobile terminal according to an embodiment of the present invention.
  • a method for downloading a network picture for a mobile terminal in an embodiment of the present invention includes the following processes:
  • the mobile terminal creates a picture download interface, and the picture download interface includes a picture download picture address (url), a placeholder picture (ie, placeImage) displayed when the picture is not downloaded, a picture specified width, a picture specified height, and a picture occupied memory size. Go to S2.
  • url picture download picture address
  • ie, placeImage placeholder picture
  • S2 The mobile terminal creates a network request object and a picture download operation queue in the picture download interface, respectively allocates memory for the network request object and the picture download operation queue, and performs an initialization operation; adding a picture download address in the picture download interface, adding After the network request object, the network request object is loaded into the image download operation queue, and the process goes to S3.
  • S3 The mobile terminal downloads the picture through the picture download operation queue: in the timeout period (15 seconds in this embodiment), when the picture download address in the picture download operation queue is not empty (the picture is terminated when the space is empty), and there is no When downloading the download operation corresponding to the image download address (if any, cancel the corresponding download operation), download the image.
  • the image download information is displayed.
  • the image download information includes the size of the image to be downloaded, the downloaded image size, the image download completion information, and the image download error information, so that the user can immediately know the download progress (the percentage of the image download) or the download error. The reason for further improving the user experience), go to S4.
  • the present embodiment can download the picture by calling the picture download interface that is independent of the APP, and the mobile terminal can call the picture download interface when downloading all the pictures, which is convenient and improves the user experience.
  • the embodiment Download images through the image download operation queue, so the download order of the images can be guaranteed, and the image download quality is improved.
  • S401 Determine the picture stretch ratio S according to the picture designation height H1 and the picture designation width W1 in S1, and go to S402.
  • HF2: HF2 HF1 ⁇ S, directly WF1 as the final width proportional coefficient WF2, go to S405;
  • S5 The mobile terminal determines whether the memory occupied by the compressed picture is > the size occupied by the picture in S1, and if so, recompresses the compressed picture according to a specified ratio (for example, 0.5 times or 0.8 times) (the compression method may be provided by the apple itself) After PNG and JPG format image compression method), re-execute S5, otherwise go to S6.
  • a specified ratio for example, 0.5 times or 0.8 times
  • S6 The mobile terminal saves and displays the compressed picture.
  • the network picture downloading system for the mobile terminal in the embodiment of the present invention includes: a picture download interface creation module, a picture download module, a picture size compression module, a picture memory determination module, and a picture storage display module.
  • the picture download interface creation module is used to: create a picture download interface, the picture download interface includes a picture download picture address, and a place picture displayed when the picture is not downloaded, and send a picture download signal to the picture download module.
  • the image downloading module is configured to: after receiving the image downloading signal, download the image through the image downloading interface, and display the image downloading information during the downloading process, the image downloading information includes the size of the image to be downloaded, the downloaded image size, the image downloading completion information and the image. Download the error message; after the image is downloaded, send the image size compression signal to the image size compression module.
  • the process of downloading a picture through the picture download interface includes: creating a network request object and a picture download operation queue in the picture download interface, respectively, allocating memory for the network request object and the picture download operation queue, and performing an initialization operation; After the image download address is added to the network request object, the network request object is loaded into the image download operation queue; when the image download address in the image download operation queue is not empty, and there is no download operation corresponding to the image download address, Download the image through the image download operation queue.
  • the picture size compression module is configured to: after receiving the picture size compression signal, set the specified picture height to H1, specify the picture width to be W1, and obtain the height H2 and width W2 of the downloaded picture.
  • H1 ⁇ H2 and W1 W2
  • the height scale factor HF1 H1/H2
  • WF1 WF1
  • W1 ⁇ W2 and H1 H2
  • WF1 W1/W2
  • HF1 H1/W2
  • the picture memory determination module is configured to: after receiving the picture memory determination signal, perform memory judgment: determine whether the memory occupied by the compressed picture > the specified picture occupies the memory size, and if so, compress the compressed picture according to the specified ratio and then perform the memory judgment again. Otherwise, the picture storage display signal is sent to the picture storage display module.
  • the picture storage display module is used to: save and display compressed pictures.
  • the present invention compresses the downloaded network picture according to the self-developed picture compression mode, so that the size of the compressed picture and the occupied memory satisfy the requirements of the mobile terminal. Therefore, the present invention can significantly reduce the memory of the mobile terminal occupied by the downloaded picture, avoiding the situation that the APP is stuck in the prior art, ensuring the running quality of the APP, and greatly improving the user experience.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Telephone Function (AREA)

Abstract

一种用于移动终端的网络图片下载方法及系统,涉及移动终端的应用开发领域。该方法的步骤为:移动终端创建图片下载接口(S1);移动终端通过图片下载接口下载图片(S3),下载过程中显示图片下载信息;移动终端对下载后的图片的尺寸进行压缩,得到压缩图片(S4);移动终端判断压缩图片占用的内存是否大于指定的图片占用内存大小,若是,继续对压缩图片进行压缩,否则保存和显示压缩图片(S5)。该方法和系统显著降低下载图片占用的移动终端的内存,避免出现APP"卡死"的情况,保证了APP的运行质量,大幅度提高了用户体验。

Description

一种用于移动终端的网络图片下载方法及系统 技术领域
本发明涉及移动终端的应用开发领域,具体涉及一种用于移动终端的网络图片下载方法及系统。
背景技术
随着移动终端的快速发展,移动APP(Application,移动终端应用程序)越来越多,APP使用时需要加载网络图片,网络图片加载后经过移动终端渲染后进行显示。
但是,当加载的网络图片的尺寸较大时,网络图片经过移动终端渲染后,会占用大量的移动终端内存,例如1M的网络图片渲染后可以达到100M。因此,当移动终端加载几张尺寸较大的网络图片并渲染后,所有加载的网络图片占用移动终端的内存,可能会超过移动终端的内存阈值,此时会直接导致对应的APP“卡死”、并被移动终端关闭,进而大幅度降低了用户体验。
发明内容
针对现有技术中存在的缺陷,本发明解决的技术问题为:如何使得下载后的网络图片的尺寸和占用内存,满足移动终端的要求。本发明能够显著降低下载图片占用的移动终端的内存,避免出现现有技术中APP“卡死”的情况,保证了APP的运行质量,大幅度提高了用户体验。
为达到以上目的,本发明提供的用于移动终端的网络图片下载方法,包括以下步骤:
步骤A:移动终端创建图片下载接口,图片下载接口包括图片下载图片地址、以及图片未下载完成时显示的占位图片,转到步骤B;
步骤B:移动终端通过图片下载接口下载图片,下载过程中显示图片下载信息,转到步骤C;
步骤C:设置指定图片高度为H1,指定图片宽度为W1,获取已下载图片的高度H2和宽度W2;当H1≠H2时,根据H1和H2计算高度比例系数HF1;当W1≠W2时,根据W1和W2计算宽度比例系数WF1;当WF1>HF1时,根据WF1和S计算最终宽度比例系数WF2,S为根据H1和W1得到的拉伸比例,将HF1作为最终高度比例系数HF2;当WF1≤HF1时,根据HF1和S计算HF2,将WF1作为WF2;根据H1和HF2计算压缩后图片的高度H3,根据W1和WF2计算压缩后图片的宽度W3;根据H3和W3对下载图片进行调整,得到压缩图片,转到步骤D;
步骤D:移动终端判断压缩图片占用的内存是否>指定的图片占用内存大小,若是,对压缩图片按照指定比例进行压缩后,重新执行步骤D,否则转到步骤E;
步骤E:移动终端保存和显示压缩图片。
本发明提供的用于移动终端的网络图片下载系统,包括位于移动终端上的:图片下载接口创建模块、图片下载模块、图片尺寸压缩模块、图片内存判定模块和图片存储显示模块;
图片下载接口创建模块用于:创建图片下载接口,图片下载接口包括图片下载图片地址、以及图片未下载完成时显示的占位图片,向图片下载模块发送图片下载信号;
图片下载模块用于:收到图片下载信号后,通过图片下载接口下载图片,下载过程中显示图片下载信息,图片下载完成后向图片尺寸 压缩模块发送图片尺寸压缩信号;
图片尺寸压缩模块用于:收到图片尺寸压缩信号后,设置指定图片高度为H1,指定图片宽度为W1,获取已下载图片的高度H2和宽度W2;当H1≠H2时,根据H1和H2计算高度比例系数HF1;当W1≠W2时,根据W1和W2计算宽度比例系数WF1;当WF1>HF1时,根据WF1和S计算最终宽度比例系数WF2,S为根据H1和W1得到的拉伸比例,将HF1作为最终高度比例系数HF2;当WF1≤HF1时,根据HF1和S计算HF2,将WF1作为WF2;根据H1和HF2计算压缩后图片的高度H3,根据W1和WF2计算压缩后图片的宽度W3;根据H3和W3对下载图片进行调整,得到压缩图片,向图片内存判定模块发送图片内存判定信号;
图片内存判定模块用于:收到图片内存判定信号后,进行内存判断:判断压缩图片占用的内存是否>指定的图片占用内存大小,若是,对压缩图片按照指定比例进行压缩后再次进行内存判断,否则向图片存储显示模块发送图片存储显示信号;
图片存储显示模块用于:保存和显示压缩图片。
与现有技术相比,本发明的优点在于:
(1)参见本发明步骤A之步骤C可知,本发明根据自主研发的图片压缩方式,对下载后的网络图片进行压缩,进而使得压缩后的图片的尺寸和占用的内存均满足移动终端的要求。因此,本发明能够显著降低下载图片占用的移动终端的内存,避免出现现有技术中APP“卡死”的情况,保证了APP的运行质量,大幅度提高了用户体验。
与此同时,本发明调用独立于APP的图片下载接口下载图片,移动终端下载所有图片时均能够调用图片下载接口,操作比较方便,进一步提升了用户体验,
(2)本发明通过图片下载操作队列下载图片,能够保证图片的下载顺序,进而提高了图片下载质量。
(3)本发明在图片下载过程中会显示图片下载信息(待下载的图片大小、已下载的图片大小、图片下载完成信息和图片下载错误信息),以便于用户即时知晓下载进度或下载错误的原因,进一步提升了用户体验。
附图说明
图1为本发明实施例中用于移动终端的网络图片下载方法的流程图。
具体实施方式
以下结合附图及实施例对本发明作进一步详细说明。
参见图1所示,本发明实施例中的用于移动终端的网络图片下载方法,包括以下流程:
S1:移动终端创建图片下载接口,图片下载接口包括图片下载图片地址(url)、图片未下载完成时显示的占位图片(即placeImage)、图片指定宽度、图片指定高度和图片占用内存大小,转到S2。
S2:移动终端在图片下载接口中创建网络请求对象和图片下载操作队列,分别为网络请求对象和图片下载操作队列分配内存、并进行初始化操作;将图片下载接口中的图片下载地址,添加(赋值)至网络请求对象后,将网络请求对象加载至图片下载操作队列,转到S3。
S3:移动终端通过图片下载操作队列下载图片:在超时时间内(本实施例中为15秒),当图片下载操作队列中的图片下载地址不为空(为空则终止下载图片)、且没有与图片下载地址对应的下载操作时(若有则取消对应的下载操作),下载图片。下载过程中显示图片下 载信息,图片下载信息包括待下载的图片大小、已下载的图片大小、图片下载完成信息和图片下载错误信息,以便于用户即时知晓下载进度(图片下载的百分比)或下载错误的原因,进而提升用户体验),转到S4。
通过S1至S3可知,本实施例通过调用独立于APP的图片下载接口下载图片,移动终端下载所有图片时均能够调用图片下载接口,操作比较方便,提升了用户体验,与此同时,本实施例通过图片下载操作队列下载图片,因此能够保证图片的下载顺序,进而提高了图片下载质量。
S4:图片下载完成后,移动终端对图片的大小进行压缩处理,具体流程为:
S401:根据S1中图片指定高度H1和图片指定宽度W1,确定图片拉伸比例S,转到S402。
S402:获取下载图片的高度H2和宽度W2,判断是否H1=H2、且W1=W2,若是,直接将下载完成的图片作为压缩图片,转到S5,否则转到S403。
S403:当H1≠H2、且W1=W2时,根据H1和H2计算高度比例系数HF1:HF1=H1/H2,将宽度比例系数WF1设置为1;当W1≠W2、且H1=H2时,根据W1和W2计算WF1:WF1=W1/W2,将HF1设置为1;当H1≠H2、且W1≠W2时,HF1=H1/H2,WF1=W1/W2,转到S404。
S404:判断WF1是否>HF1,若是,根据WF1和S计算最终宽度比例系数WF2:WF2=WF1·S,直接将HF1作为最终高度比例系数HF2,转到S405;否则根据HF1和S计算高度比例系数HF2:HF2=HF1·S,直接将WF1作为最终宽度比例系数WF2,转到S405;
S405:根据H1和HF2,计算压缩后图片的高度H3:H3=H1·HF2;根据W1和WF2,计算压缩后图片的宽度W3:W3=W1·WF2;根据H3和W3重新绘制下载图片,得到压缩图片,即压缩图片的高度为H3,宽度为W3,转到S5。
S5:移动终端判断压缩图片占用的内存是否>S1中的图片占用内存大小,若是,对压缩图片按照指定比例(例如缩小0.5倍或者0.8倍等)进行再次压缩(压缩方法可以为苹果自带的PNG和JPG格式的图片压缩方法)后,重新执行S5,否则转到S6。
S6:移动终端保存和显示压缩图片。
本发明实施例中的用于移动终端的网络图片下载系统,包括位于移动终端上的:图片下载接口创建模块、图片下载模块、图片尺寸压缩模块、图片内存判定模块和图片存储显示模块。
图片下载接口创建模块用于:创建图片下载接口,图片下载接口包括图片下载图片地址、以及图片未下载完成时显示的占位图片,向图片下载模块发送图片下载信号。
图片下载模块用于:收到图片下载信号后,通过图片下载接口下载图片,下载过程中显示图片下载信息,图片下载信息包括待下载的图片大小、已下载的图片大小、图片下载完成信息和图片下载错误信息;图片下载完成后向图片尺寸压缩模块发送图片尺寸压缩信号。
图片下载模块通过图片下载接口下载图片的流程包括:在图片下载接口中创建网络请求对象和图片下载操作队列,分别为网络请求对象和图片下载操作队列分配内存、并进行初始化操作;将图片下载接口中的图片下载地址,添加至网络请求对象后,将网络请求对象加载至图片下载操作队列;当图片下载操作队列中的图片下载地址不为空、且没有与图片下载地址对应的下载操作时,通过图片下载操作队 列下载图片。
图片尺寸压缩模块用于:收到图片尺寸压缩信号后,设置指定图片高度为H1,指定图片宽度为W1,获取已下载图片的高度H2和宽度W2。当H1≠H2、且W1=W2时,根据H1和H2计算高度比例系数HF1(HF1=H1/H2),将WF1设置为1。当W1≠W2、且H1=H2时,根据W1和W2计算宽度比例系数WF1(WF1=W1/W2),将HF1设置为1。当H1=H2、且W1=W2时,将下载完成的图片作为压缩图片,此时直接向图片内存判定模块发送图片内存判定信号。
当WF1>HF1时,根据WF1和S计算最终宽度比例系数WF2(WF2=WF1·S),S为根据H1和W1得到的拉伸比例,将HF1作为最终高度比例系数HF2。当WF1≤HF1时,根据HF1和S计算HF2(HF2=HF1·S),将WF1作为WF2。根据H1和HF2计算压缩后图片的高度H3(H3=H1·HF2),根据W1和WF2计算压缩后图片的宽度W3(W3=W1·WF2);根据H3和W3对下载图片进行调整,得到压缩图片,向图片内存判定模块发送图片内存判定信号。
图片内存判定模块用于:收到图片内存判定信号后,进行内存判断:判断压缩图片占用的内存是否>指定的图片占用内存大小,若是,对压缩图片按照指定比例进行压缩后再次进行内存判断,否则向图片存储显示模块发送图片存储显示信号。
图片存储显示模块用于:保存和显示压缩图片。
通过本发明实施例可知,本发明根据自主研发的图片压缩方式,对下载后的网络图片进行压缩,进而使得压缩后的图片的尺寸和占用的内存均满足移动终端的要求。因此,本发明能够显著降低下载图片占用的移动终端的内存,避免出现现有技术中APP“卡死”的情况,保证了APP的运行质量,大幅度提高了用户体验。
进一步,本发明不局限于上述实施方式,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围之内。本说明书中未作详细描述的内容属于本领域专业技术人员公知的现有技术。

Claims (10)

  1. 一种用于移动终端的网络图片下载方法,其特征在于,该方法包括以下步骤:
    步骤A:移动终端创建图片下载接口,转到步骤B;
    步骤B:移动终端通过图片下载接口下载图片,下载过程中显示图片下载信息,转到步骤C;
    步骤C:设置指定图片高度为H1,指定图片宽度为W1,获取已下载图片的高度H2和宽度W2;当H1≠H2时,根据H1和H2计算高度比例系数HF1;当W1≠W2时,根据W1和W2计算宽度比例系数WF1;当WF1>HF1时,根据WF1和S计算最终宽度比例系数WF2,S为根据H1和W1得到的拉伸比例,将HF1作为最终高度比例系数HF2;当WF1≤HF1时,根据HF1和S计算HF2,将WF1作为WF2;根据H1和HF2计算压缩后图片的高度H3,根据W1和WF2计算压缩后图片的宽度W3;根据H3和W3对下载图片进行调整,得到压缩图片,转到步骤D;
    步骤D:移动终端判断压缩图片占用的内存是否>指定的图片占用内存大小,若是,对压缩图片按照指定比例进行压缩后,重新执行步骤D,否则转到步骤E;
    步骤E:移动终端保存和显示压缩图片。
  2. 如权利要求1所述的用于移动终端的网络图片下载方法,其特征在于,步骤B中所述移动终端通过图片下载接口下载图片的流程包括:
    步骤B01:移动终端在图片下载接口中创建网络请求对象和图片下载操作队列,分别为网络请求对象和图片下载操作队列分配内存、并进行初始化操作;将图片下载接口中的图片下载地址,添加至网络 请求对象后,将网络请求对象加载至图片下载操作队列,转到步骤B02;
    步骤B02:当图片下载操作队列中的图片下载地址不为空、且没有与图片下载地址对应的下载操作时,移动终端通过图片下载操作队列下载图片。
  3. 如权利要求1所述的用于移动终端的网络图片下载方法,其特征在于:步骤C中所述HF1的计算公式为:HF1=H1/H2,所述WF1的计算公式为WF1=W1/W2;所述HF2的计算公式为HF2=HF1·S,所述WF2的计算公式为WF2=WF1·S;所述H3的计算公式为H3=H1·HF2,所述W3的计算公式为W3=W1·WF2。
  4. 如权利要求1至3任一项所述的用于移动终端的网络图片下载方法,其特征在于:步骤B中所述图片下载信息包括待下载的图片大小、已下载的图片大小、图片下载完成信息和图片下载错误信息。
  5. 如权利要求1至3任一项所述的用于移动终端的网络图片下载方法,其特征在于:步骤C还包括以下步骤:当H1=H2、且W1=W2时,将下载完成的图片作为压缩图片,转到步骤D;当H1≠H2、且W1=W2时,将WF1设置为1;当W1≠W2、且H1=H2时,将HF1设置为1。
  6. 一种用于移动终端的网络图片下载系统,其特征在于:该系统包括位于移动终端上的:图片下载接口创建模块、图片下载模块、图片尺寸压缩模块、图片内存判定模块和图片存储显示模块;
    图片下载接口创建模块用于:创建图片下载接口,向图片下载模块发送图片下载信号;
    图片下载模块用于:收到图片下载信号后,通过图片下载接口下载图片,下载过程中显示图片下载信息,图片下载完成后向图片尺寸 压缩模块发送图片尺寸压缩信号;
    图片尺寸压缩模块用于:收到图片尺寸压缩信号后,设置指定图片高度为H1,指定图片宽度为W1,获取已下载图片的高度H2和宽度W2;当H1≠H2时,根据H1和H2计算高度比例系数HF1;当W1≠W2时,根据W1和W2计算宽度比例系数WF1;当WF1>HF1时,根据WF1和S计算最终宽度比例系数WF2,S为根据H1和W1得到的拉伸比例,将HF1作为最终高度比例系数HF2;当WF1≤HF1时,根据HF1和S计算HF2,将WF1作为WF2;根据H1和HF2计算压缩后图片的高度H3,根据W1和WF2计算压缩后图片的宽度W3;根据H3和W3对下载图片进行调整,得到压缩图片,向图片内存判定模块发送图片内存判定信号;
    图片内存判定模块用于:收到图片内存判定信号后,进行内存判断:判断压缩图片占用的内存是否>指定的图片占用内存大小,若是,对压缩图片按照指定比例进行压缩后再次进行内存判断,否则向图片存储显示模块发送图片存储显示信号;
    图片存储显示模块用于:保存和显示压缩图片。
  7. 如权利要求6所述的用于移动终端的网络图片下载系统,其特征在于:所述图片下载模块通过图片下载接口下载图片的流程包括:在图片下载接口中创建网络请求对象和图片下载操作队列,分别为网络请求对象和图片下载操作队列分配内存、并进行初始化操作;将图片下载接口中的图片下载地址,添加至网络请求对象后,将网络请求对象加载至图片下载操作队列;
    当图片下载操作队列中的图片下载地址不为空、且没有与图片下载地址对应的下载操作时,通过图片下载操作队列下载图片。
  8. 如权利要求6所述的用于移动终端的网络图片下载系统,其 特征在于:所述图片尺寸压缩模块中HF1的计算公式为:HF1=H1/H2,WF1的计算公式为WF1=W1/W2;HF2的计算公式为HF2=HF1·S,WF2的计算公式为WF2=WF1·S;H3的计算公式为H3=H1·HF2,W3的计算公式为W3=W1·WF2。
  9. 如权利要求6至8任一项所述的用于移动终端的网络图片下载系统,其特征在于:所述图片下载模块中的图片下载信息包括待下载的图片大小、已下载的图片大小、图片下载完成信息和图片下载错误信息。
  10. 如权利要求6至8任一项所述的用于移动终端的网络图片下载系统,其特征在于:所述图片尺寸压缩模块工作过程中,当H1=H2、且W1=W2时,将下载完成的图片作为压缩图片,此时直接向图片内存判定模块发送图片内存判定信号;当H1≠H2、且W1=W2时,将WF1设置为1;当W1≠W2、且H1=H2时,将HF1设置为1。
PCT/CN2017/117378 2017-04-26 2017-12-20 一种用于移动终端的网络图片下载方法及系统 WO2018196409A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710283542.8 2017-04-26
CN201710283542.8A CN107179947A (zh) 2017-04-26 2017-04-26 一种用于移动终端的网络图片下载方法及系统

Publications (1)

Publication Number Publication Date
WO2018196409A1 true WO2018196409A1 (zh) 2018-11-01

Family

ID=59832670

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/117378 WO2018196409A1 (zh) 2017-04-26 2017-12-20 一种用于移动终端的网络图片下载方法及系统

Country Status (2)

Country Link
CN (1) CN107179947A (zh)
WO (1) WO2018196409A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107179947A (zh) * 2017-04-26 2017-09-19 武汉斗鱼网络科技有限公司 一种用于移动终端的网络图片下载方法及系统
CN109992406B (zh) * 2017-12-29 2022-06-07 北京京东尚科信息技术有限公司 图片请求方法、响应图片请求的方法及客户端
CN111158619B (zh) * 2019-12-25 2021-09-21 珠海格力电器股份有限公司 一种图片处理方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002215129A (ja) * 2001-01-19 2002-07-31 Keyence Corp 画面データ作成装置、画面データ作成方法、画面データ作成プログラムおよびそれを記録した記録媒体
CN103544207A (zh) * 2013-08-19 2014-01-29 Tcl集团股份有限公司 一种图片加载显示的方法与系统
CN103677942A (zh) * 2013-12-30 2014-03-26 Tcl集团股份有限公司 一种移动终端浏览网络图片的方法和装置
CN104156251A (zh) * 2014-08-22 2014-11-19 广州华多网络科技有限公司 一种图片处理方法及其设备
CN107179947A (zh) * 2017-04-26 2017-09-19 武汉斗鱼网络科技有限公司 一种用于移动终端的网络图片下载方法及系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103399802B (zh) * 2013-07-30 2018-02-16 Tcl集团股份有限公司 一种图片预加载方法以及装置
CN103905643A (zh) * 2014-03-26 2014-07-02 北京京东尚科信息技术有限公司 一种单一背景图片手机适配方法及系统
CN105183560B (zh) * 2015-09-01 2019-03-26 北京金山安全软件有限公司 一种调整图片的方法、图片调整装置及系统
CN106383686A (zh) * 2016-10-09 2017-02-08 广州视睿电子科技有限公司 一种html图片显示方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002215129A (ja) * 2001-01-19 2002-07-31 Keyence Corp 画面データ作成装置、画面データ作成方法、画面データ作成プログラムおよびそれを記録した記録媒体
CN103544207A (zh) * 2013-08-19 2014-01-29 Tcl集团股份有限公司 一种图片加载显示的方法与系统
CN103677942A (zh) * 2013-12-30 2014-03-26 Tcl集团股份有限公司 一种移动终端浏览网络图片的方法和装置
CN104156251A (zh) * 2014-08-22 2014-11-19 广州华多网络科技有限公司 一种图片处理方法及其设备
CN107179947A (zh) * 2017-04-26 2017-09-19 武汉斗鱼网络科技有限公司 一种用于移动终端的网络图片下载方法及系统

Also Published As

Publication number Publication date
CN107179947A (zh) 2017-09-19

Similar Documents

Publication Publication Date Title
WO2018196409A1 (zh) 一种用于移动终端的网络图片下载方法及系统
CN109271327B (zh) 内存管理方法及装置
WO2022037251A1 (zh) 视频数据处理方法及装置
KR102154456B1 (ko) 중간-분류 아키텍처에서 프레임 대 프레임 일관성의 활용
CN108733334A (zh) 画质参数调节方法、装置、终端及存储介质
CN109542614B (zh) 资源配置方法、装置、终端及存储介质
CN108965471B (zh) 一种智能电视上浏览器内存改善方法
US20230359424A1 (en) Multi-Screen Collaboration Method and System, and Electronic Device
US10237318B2 (en) Electronic device and method for encoding image data thereof
CN105279006B (zh) 基于Android系统的屏幕截图方法及终端
US9747945B2 (en) Method for creating a content and electronic device thereof
CN107220063B (zh) 动态壁纸生成方法及装置
EP3883255B1 (en) Video decoding control method and apparatus, electronic device, and storage medium
WO2019170126A1 (zh) 图片绘制方法及相关产品
WO2022083465A1 (zh) 电子设备的投屏方法及其介质和电子设备
KR20150133037A (ko) 콘텐츠 재생 방법 및 이를 구현하는 전자 장치
CN111447370A (zh) 摄像头访问方法、访问装置、终端设备及可读存储介质
CN113424548A (zh) 播放高动态范围视频的电子装置及其方法
US10067951B2 (en) Method for creating binary code and electronic device thereof
CN109886861B (zh) 一种高效率图档格式heif图像加载方法及装置
US20110211087A1 (en) Method and apparatus providing for control of a content capturing device with a requesting device to thereby capture a desired content segment
CN113472980B (zh) 一种图像处理方法、装置、设备、介质和芯片
US11055807B2 (en) Method and system for a transactional based display pipeline to interface with graphics processing units
CN110633141A (zh) 一种应用程序的内存管理方法、装置、终端设备及介质
US9972064B1 (en) Non-intrusive and low-power recording

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17906950

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17906950

Country of ref document: EP

Kind code of ref document: A1