CN108921784B - Picture compression method and system based on mobile terminal - Google Patents

Picture compression method and system based on mobile terminal Download PDF

Info

Publication number
CN108921784B
CN108921784B CN201810605667.2A CN201810605667A CN108921784B CN 108921784 B CN108921784 B CN 108921784B CN 201810605667 A CN201810605667 A CN 201810605667A CN 108921784 B CN108921784 B CN 108921784B
Authority
CN
China
Prior art keywords
picture
mobile terminal
ratio
long
size
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.)
Active
Application number
CN201810605667.2A
Other languages
Chinese (zh)
Other versions
CN108921784A (en
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.)
Beijing Yuxin Jinhe Science And Trade Co ltd
Original Assignee
Hangzhou Jiji Intellectual Property Operation 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 Hangzhou Jiji Intellectual Property Operation Co ltd filed Critical Hangzhou Jiji Intellectual Property Operation Co ltd
Priority to CN201810605667.2A priority Critical patent/CN108921784B/en
Publication of CN108921784A publication Critical patent/CN108921784A/en
Application granted granted Critical
Publication of CN108921784B publication Critical patent/CN108921784B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • G06T3/4023Scaling of whole images or parts thereof, e.g. expanding or contracting based on decimating pixels or lines of pixels; based on inserting pixels or lines of pixels
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种基于移动终端的图片压缩方法及系统,包括步骤:S11.获取移动终端自身的分辨率和图片的分辨率;S12.根据所述图片的分辨率判断所述图片是否为长图片;若是,则跳到步骤S13,若否,则跳到步骤S14;S13.根据长图缩放率计算方法计算所述图片的缩放率,然后跳到步骤S15;S14.根据常规图片缩放率计算方法计算所述图片的缩放率,然后跳到步骤S15;S15.根据计算得到的图片的缩放率计算图片的采样率;S16.判断所述图片是否需要压缩;若是,则跳到步骤S17;S17.根据所述采样率的大小对图片进行压缩。本发明在避免图片显示引发的OOM问题的同时使压缩后的图片在本手机上的显示效果最佳。

The invention discloses a picture compression method and system based on a mobile terminal, comprising the steps of: S11. Obtaining the resolution of the mobile terminal itself and the picture resolution; S12. Judging whether the picture is long or not according to the resolution of the picture Picture; if so, then jump to step S13, if not, then jump to step S14; S13. Calculate the zoom rate of the picture according to the long picture zoom rate calculation method, and then jump to step S15; S14. Calculate according to the conventional picture zoom rate The method calculates the zoom ratio of the picture, and then jumps to step S15; S15. calculates the sampling rate of the picture according to the calculated zoom ratio of the picture; S16. judges whether the picture needs to be compressed; if so, jumps to step S17; S17 . Compress the picture according to the size of the sampling rate. The present invention avoids the OOM problem caused by picture display and at the same time optimizes the display effect of the compressed picture on the mobile phone.

Description

一种基于移动终端的图片压缩方法及系统A mobile terminal-based picture compression method and system

技术领域technical field

本发明涉及图像处理技术领域,尤其涉及一种基于移动终端的图片压缩方法及系统。The present invention relates to the technical field of image processing, in particular to a mobile terminal-based image compression method and system.

背景技术Background technique

随着科技的进步,移动终端的性能也大幅的提高,同时移动终端内的图片也越来越多。其中,图片的来源可包括多个方面,例如用户拍照、网页图片、社交软件产生的图片等。随着图片的增多,会占用移动终端大量的存储空间,移动终端经常会出现OOM(Out ofMemory,内存溢出)问题。With the advancement of technology, the performance of the mobile terminal has also been greatly improved, and at the same time, there are more and more pictures in the mobile terminal. Wherein, the source of the picture may include various aspects, such as a user's photo, a webpage picture, a picture generated by social software, and the like. As the number of pictures increases, a large amount of storage space of the mobile terminal will be occupied, and an OOM (Out of Memory, memory overflow) problem often occurs in the mobile terminal.

图片展示可以说在任何一个应用软件都不可避免,然而在Android手机上加载显示大图往往会引发OOM问题,究其原因是在Android设备上ImageView(图像视图)最终要加载Bitmap(位图文件)对象,Bitmap所占内存过大。Image display can be said to be unavoidable in any application software. However, loading and displaying large images on Android phones often causes OOM problems. The reason is that ImageView (image view) on Android devices will eventually load Bitmap (bitmap files) Object, the memory occupied by Bitmap is too large.

Bitmap内存大小=图片宽度*图片高度*单位像素占用的字节;单位像素所占字节和Bitmap的编码有关具体如下表:Bitmap memory size = picture width * picture height * byte occupied by unit pixel; the byte occupied by unit pixel is related to the encoding of Bitmap, as shown in the following table:

Bitmap编码Bitmap encoding 单位像素所占字节数The number of bytes occupied by a unit pixel ALPHA_8ALPHA_8 11 ARGB_4444ARGB_4444 22 ARGB_8888ARGB_8888 44 RGB_565RGB_565 22

通常android系统采用ARGB_8888编码,那么一张常见的1080*1920的图片内存占用就是:1920*1080*4=7.9M。Usually the android system uses ARGB_8888 encoding, so the memory usage of a common 1080*1920 picture is: 1920*1080*4=7.9M.

通过上面的公式可以看出,压缩图片所占内存,需要从图片的尺寸(宽和高)和Bitmap编码入手。It can be seen from the above formula that the memory occupied by the compressed image needs to start with the image size (width and height) and Bitmap encoding.

Android官方提供了一种采样率压缩法,通过设置采样率inSampleSize(这个采样率只能是2的N次方,如果算出的采样率是5,Android系统会去近似值4),来压缩图片,使其尺寸变小,从而到达减少图片所占内存的效果。Android officially provides a sampling rate compression method. By setting the sampling rate inSampleSize (this sampling rate can only be 2 to the Nth power, if the calculated sampling rate is 5, the Android system will approximate the value 4), to compress the image, so that Its size becomes smaller, so as to achieve the effect of reducing the memory occupied by pictures.

然而采样率压缩法的采样率只能是2的N次方(1,2,4,8...),如果需要将分辨率为3840*2400的图片,压缩至当前手机分辨率1280*720,经过计算采样率inSampleSize为max(3840/1280,2400/720)=3.33,即理想的压缩后尺寸应该为(3840*2400)/3.33=1152*720,然而系统会把理想采样率3.33修正为2^2=4,这样通过采样压缩算法压缩后的图片分辨率只能是960*600,这样压缩后的图片尺寸并不符合预期一个图片尺寸,还有就是对于长图,采样率压缩法,往往会过度压缩图片,即压缩后的图片的尺寸会非常小,影响图片的显示效果。However, the sampling rate of the sampling rate compression method can only be 2 to the Nth power (1, 2, 4, 8...), if you need to compress a picture with a resolution of 3840*2400 to the current mobile phone resolution of 1280*720 After calculating the sampling rate inSampleSize is max(3840/1280, 2400/720)=3.33, that is, the ideal compressed size should be (3840*2400)/3.33=1152*720, but the system will correct the ideal sampling rate 3.33 to 2^2=4, so the resolution of the picture compressed by the sampling compression algorithm can only be 960*600, so the size of the compressed picture does not meet the expected picture size, and for long pictures, the sampling rate compression method, Images are often over-compressed, that is, the size of the compressed image will be very small, which will affect the display effect of the image.

公开号为CN 201360283的专利公开了一种将手机中图片压缩存储装置,包括:手机CPU,解压缩模块、压缩的图片资源数据和显示模块,所述的通过在手机中增设图片解压缩模块,当使用压缩的图片资源时,先对压缩的图片资源数据进行解压缩处理,然后由显示模块来显示。从而减少了图片资源对存储空间的占用,大大降低了手机的存储成本。该方法虽然可以实现对手机中的图片进行压缩,但是在对图片压缩时对常规图片和长图片都是一样的压缩规则,还是避免不了过度压缩长图,从而影响长图的显示效果。The patent with the publication number CN 201360283 discloses a device for compressing and storing pictures in mobile phones, including: a mobile phone CPU, a decompression module, compressed picture resource data and a display module. By adding a picture decompression module in the mobile phone, When using compressed image resources, the compressed image resource data is decompressed first, and then displayed by the display module. Thereby, the occupation of the storage space by the image resource is reduced, and the storage cost of the mobile phone is greatly reduced. Although this method can realize the compression of pictures in the mobile phone, the same compression rules are used for regular pictures and long pictures when compressing pictures, and excessive compression of long pictures cannot be avoided, thereby affecting the display effect of long pictures.

发明内容Contents of the invention

本发明的目的是针对现有技术的缺陷,提供了一种基于移动终端的图片压缩方法及系统,根据当前移动终端分辨率对常规图片和长图片分别采用不同的算法计算缩放率和图片压缩的目标尺寸来压缩图片,在避免图片显示引发的OOM问题的同时使压缩后的图片在本手机上的显示效果最佳。The object of the present invention is to address the defects of the prior art, and provide a mobile terminal-based picture compression method and system, which uses different algorithms to calculate the scaling ratio and picture compression ratio for regular pictures and long pictures according to the current mobile terminal resolution. Target size to compress pictures, avoiding OOM problems caused by picture display, and at the same time make the compressed pictures display best on this phone.

为了实现以上目的,本发明采用以下技术方案:In order to achieve the above object, the present invention adopts the following technical solutions:

一种基于移动终端的图片压缩方法,包括步骤:A method for image compression based on a mobile terminal, comprising the steps of:

S1.获取移动终端自身的分辨率和图片的分辨率;S1. Obtain the resolution of the mobile terminal itself and the resolution of the picture;

S2.根据所述图片的分辨率判断所述图片是否为长图片;若是,则跳到步骤S3,若否,则跳到步骤S4;S2. Judging whether the picture is a long picture according to the resolution of the picture; if so, then jump to step S3, if not, then jump to step S4;

S3.根据长图缩放率计算方法计算所述图片的缩放率,然后跳到步骤S5;S3. Calculate the zoom rate of the picture according to the calculation method of the zoom rate of the long picture, and then skip to step S5;

S4.根据常规图片缩放率计算方法计算所述图片的缩放率,然后跳到步骤S5;S4. Calculate the zoom rate of the picture according to the conventional picture zoom rate calculation method, and then skip to step S5;

S5.根据计算得到的图片的缩放率计算图片的采样率;S5. Calculate the sampling rate of the picture according to the zoom rate of the calculated picture;

S6.判断所述图片是否需要压缩;若是,则跳到步骤S7;S6. Determine whether the picture needs to be compressed; if so, skip to step S7;

S7.根据所述采样率的大小对图片进行压缩。S7. Compress the picture according to the size of the sampling rate.

进一步的,所述步骤S7之后还包括步骤:Further, after the step S7, the step also includes:

S8.判断压缩后的图片的尺寸与目标图片的尺寸是否一致,若否,则跳到步骤S9;S8. Determine whether the size of the compressed picture is consistent with the size of the target picture, if not, then skip to step S9;

S9.对所述压缩后的图片进行Matrix缩放处理使图片最终尺寸为目标尺寸。S9. Perform Matrix scaling processing on the compressed picture so that the final size of the picture is the target size.

进一步的,根据所述图片的分辨率判断所述图片是否为长图片的具体方法为:Further, the specific method for judging whether the picture is a long picture according to the resolution of the picture is as follows:

根据图片的分辨率计算图片高和宽的比值;Calculate the ratio of the height and width of the image according to the resolution of the image;

判断所述比值是否大于2,若是,则所述图片为长图片。Judging whether the ratio is greater than 2, if yes, the picture is a long picture.

进一步的,所述长图缩放率计算方法为:Further, the method for calculating the scaling ratio of the long image is:

A1.计算移动终端自身屏幕总像素点个数;A1. Calculate the total number of pixels on the screen of the mobile terminal itself;

A2.计算长图的总像素点个数;A2. Calculate the total number of pixels in the long image;

A3.根据所述移动终端自身屏幕总像素点个数与所述长图的总像素个数计算所述长图的缩放率。A3. Calculate the zoom ratio of the long image according to the total number of pixels of the mobile terminal's own screen and the total number of pixels of the long image.

进一步的,所述常规图片缩放率计算方法为:Further, the calculation method of the conventional image scaling ratio is:

B1.计算图片宽度和移动终端自身屏幕宽度的比率;B1. Calculate the ratio of the picture width to the screen width of the mobile terminal itself;

B2.计算图片高度和移动终端自身屏幕高度的比率;B2. Calculate the ratio of the height of the picture to the height of the screen of the mobile terminal itself;

B3.取所述宽度的比率和所述高度的比率中较大的作为所述图片的缩放率。B3. Taking the larger of the ratio of the width and the ratio of the height as the zoom ratio of the picture.

进一步的,所述目标图片的尺寸计算方法为:Further, the size calculation method of the target picture is:

所述目标图片的宽为所述图片的宽除以所述计算得到的图片的缩放率的值;所述目标图片的高为所述图片的高除以所述计算得到的图片的缩放率的值。The width of the target picture is the width of the picture divided by the calculated zoom rate of the picture; the height of the target picture is the height of the picture divided by the calculated zoom rate of the picture value.

相应的,还提供一种基于移动终端的图片压缩系统,包括:Correspondingly, a mobile terminal-based picture compression system is also provided, including:

获取模块,用于获取移动终端自身的分辨率和图片的分辨率;An acquisition module, configured to acquire the resolution of the mobile terminal itself and the resolution of the picture;

第一判断模块,用于根据所述图片的分辨率判断所述图片是否为长图片;A first judging module, configured to judge whether the picture is a long picture according to the resolution of the picture;

第一计算模块,用于在所述图片为长图片时根据长图缩放率计算方法计算所述图片的缩放率;The first calculation module is used to calculate the zoom rate of the picture according to the long picture zoom rate calculation method when the picture is a long picture;

第二计算模块,用于在所述图片为非长图片时根据常规图片缩放率计算方法计算所述图片的缩放率;The second calculation module is used to calculate the zoom rate of the picture according to the conventional picture zoom rate calculation method when the picture is a non-long picture;

第三计算模块,用于根据计算得到的图片的缩放率计算图片的采样率;The third calculation module is used to calculate the sampling rate of the picture according to the zoom rate of the calculated picture;

第二判断模块,用于判断所述图片是否需要压缩;The second judging module is used to judge whether the picture needs to be compressed;

压缩模块,用于在所述图片需要压缩时根据所述采样率的大小对图片进行压缩。The compression module is configured to compress the picture according to the size of the sampling rate when the picture needs to be compressed.

进一步的,还包括:Further, it also includes:

第三判断模块,用于判断压缩后的图片的尺寸与目标图片的尺寸是否一致;The third judging module is used to judge whether the size of the compressed picture is consistent with the size of the target picture;

缩放模块,用于在所述压缩后的图片的尺寸与目标图片的尺寸不一致时对所述压缩后的图片进行Matrix缩放处理使图片最终尺寸为目标尺寸。A scaling module, configured to perform Matrix scaling on the compressed picture when the size of the compressed picture is inconsistent with the size of the target picture so that the final size of the picture is the target size.

进一步的,根据所述图片的分辨率判断所述图片是否为长图片的具体方法为:Further, the specific method for judging whether the picture is a long picture according to the resolution of the picture is as follows:

根据图片的分辨率计算图片高和宽的比值;Calculate the ratio of the height and width of the image according to the resolution of the image;

判断所述比值是否大于2,若是,则所述图片为长图片。Judging whether the ratio is greater than 2, if yes, the picture is a long picture.

进一步的,所述长图缩放率计算方法为:Further, the method for calculating the scaling ratio of the long image is:

A1.计算移动终端自身屏幕总像素点个数;A1. Calculate the total number of pixels on the screen of the mobile terminal itself;

A2.计算长图的总像素点个数;A2. Calculate the total number of pixels in the long image;

A3.根据所述移动终端自身屏幕总像素点个数与所述长图的总像素个数计算所述长图的缩放率。A3. Calculate the zoom ratio of the long image according to the total number of pixels of the mobile terminal's own screen and the total number of pixels of the long image.

进一步的,所述常规图片缩放率计算方法为:Further, the calculation method of the conventional image scaling ratio is:

B1.计算图片宽度和移动终端自身屏幕宽度的比率;B1. Calculate the ratio of the picture width to the screen width of the mobile terminal itself;

B2.计算图片高度和移动终端自身屏幕高度的比率;B2. Calculate the ratio of the height of the picture to the height of the screen of the mobile terminal itself;

B3.取所述宽度的比率和所述高度的比率中较大的作为所述图片的缩放率。B3. Taking the larger of the ratio of the width and the ratio of the height as the zoom ratio of the picture.

进一步的,所述目标图片的尺寸计算方法为:Further, the size calculation method of the target picture is:

所述目标图片的宽为所述图片的宽除以所述计算得到的图片的缩放率的值;所述目标图片的高为所述图片的高除以所述计算得到的图片的缩放率的值。The width of the target picture is the width of the picture divided by the calculated zoom rate of the picture; the height of the target picture is the height of the picture divided by the calculated zoom rate of the picture value.

与现有技术相比,本发明根据当前移动终端的分辨率,确定图片的目标尺寸,通过对常规图片和长图片采用不同的算法计算其缩放率和目标图片尺寸,通过计算得到的缩放率进而得到采样率,然后根据采样率压缩图片,可以避免图片在移动终端中显示出现OOM问题,可以有效避免长图片被过度压缩,并且在经过压缩后还判断压缩后的图片尺寸与目标尺寸是否一致,如果压缩后的图片尺寸和目标尺寸不一致,再通过Matrix缩放图片,使图片尺寸符合目标尺寸,使最终的图片在移动终端中显示的效果最好。Compared with the prior art, the present invention determines the target size of the picture according to the resolution of the current mobile terminal, calculates the zoom rate and target picture size by using different algorithms for conventional pictures and long pictures, and then obtains the zoom rate through the calculation. Obtain the sampling rate, and then compress the picture according to the sampling rate, which can avoid OOM problems when the picture is displayed on the mobile terminal, and can effectively prevent long pictures from being over-compressed, and judge whether the compressed picture size is consistent with the target size after compression. If the size of the compressed image is inconsistent with the target size, scale the image through Matrix to make the image size meet the target size, so that the final image can be displayed on the mobile terminal with the best effect.

附图说明Description of drawings

图1是实施例一提供的一种基于移动终端的图片压缩方法流程图;FIG. 1 is a flow chart of a mobile terminal-based image compression method provided in Embodiment 1;

图2是实施例一提供的一种基于移动终端的图片压缩系统结构图;FIG. 2 is a structural diagram of a mobile terminal-based picture compression system provided by Embodiment 1;

图3是实施例二提供的一种基于移动终端的图片压缩方法流程图;FIG. 3 is a flow chart of a mobile terminal-based picture compression method provided in Embodiment 2;

图4是实施例二提供的一种基于移动终端的图片压缩系统结构图。FIG. 4 is a structural diagram of a mobile terminal-based picture compression system provided by Embodiment 2.

具体实施方式Detailed ways

以下通过特定的具体实例说明本发明的实施方式,本领域技术人员可由本说明书所揭露的内容轻易地了解本发明的其他优点与功效。本发明还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不同观点与应用,在没有背离本发明的精神下进行各种修饰或改变。需说明的是,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合。Embodiments of the present invention are described below through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific implementation modes, and various modifications or changes can be made to the details in this specification based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, in the case of no conflict, the following embodiments and features in the embodiments can be combined with each other.

需要说明的是,以下实施例中所提供的图示仅以示意方式说明本发明的基本构想,遂图式中仅显示与本发明中有关的组件而非按照实际实施时的组件数目、形状及尺寸绘制,其实际实施时各组件的型态、数量及比例可为一种随意的改变,且其组件布局型态也可能更为复杂。It should be noted that the diagrams provided in the following embodiments are only schematically illustrating the basic ideas of the present invention, and only the components related to the present invention are shown in the diagrams rather than the number, shape and shape of the components in actual implementation. Dimensional drawing, the type, quantity and proportion of each component can be changed arbitrarily during actual implementation, and the component layout type may also be more complicated.

本发明提供了一种基于移动终端的图片压缩方法及系统,根据当前移动终端分辨率对常规图片和长图片分别采用不同的算法计算缩放率和图片压缩的目标尺寸来压缩图片,在避免图片显示引发的OOM问题的同时使压缩后的图片在本手机上的显示效果最佳。The present invention provides a mobile terminal-based picture compression method and system. According to the current mobile terminal resolution, different algorithms are used to calculate the zoom rate and the target size of picture compression for regular pictures and long pictures to compress pictures, so as to avoid picture display While causing the OOM problem, the compressed picture can be displayed on the mobile phone with the best effect.

实施例一Embodiment one

本实施例提供一种基于移动终端的图片压缩方法,如图1所示,包括步骤:This embodiment provides a mobile terminal-based picture compression method, as shown in Figure 1, including steps:

S11.获取移动终端自身的分辨率和图片的分辨率;S11. Obtain the resolution of the mobile terminal itself and the resolution of the picture;

S12.根据所述图片的分辨率判断所述图片是否为长图片;若是,则跳到步骤S13,若否,则跳到步骤S14;S12. Judging whether the picture is a long picture according to the resolution of the picture; if so, then jump to step S13, if not, then jump to step S14;

S13.根据长图缩放率计算方法计算所述图片的缩放率,然后跳到步骤S15;S13. Calculate the zoom rate of the picture according to the calculation method of the zoom rate of the long picture, and then skip to step S15;

S14.根据常规图片缩放率计算方法计算所述图片的缩放率,然后跳到步骤S15;S14. Calculate the zoom rate of the picture according to the conventional picture zoom rate calculation method, and then skip to step S15;

S15.根据计算得到的图片的缩放率计算图片的采样率;S15. Calculate the sampling rate of the picture according to the calculated zoom rate of the picture;

S16.判断所述图片是否需要压缩;若是,则跳到步骤S17;S16. Determine whether the picture needs to be compressed; if so, skip to step S17;

S17.根据所述采样率的大小对图片进行压缩。S17. Compress the picture according to the size of the sampling rate.

本实施例的基于移动终端的图片压缩方法的执行主体为移动终端。具体的所述的移动终端为Android系统。The mobile terminal-based image compression method in this embodiment is executed by the mobile terminal. Specifically, the mobile terminal is an Android system.

首先移动终端会获取到自身的分辨率(宽为W,高为H)和图片的分辨率(宽为W1,高为H1),以便后续缩放率的计算。First, the mobile terminal will obtain its own resolution (width is W, height is H) and the resolution of the picture (width is W1, height is H1), so as to calculate the subsequent scaling ratio.

获取到图片的分辨率后就可以根据图片的分辨率来判断所述图片是否为长图片,如果图片为长图片就利用长图缩放率计算方法来计算图片的缩放率,如果图片不是长图片(即常规图片)就利用常规图片缩放率计算方法来计算图片的缩放率。After the resolution of the picture is obtained, it can be judged whether the picture is a long picture according to the resolution of the picture. If the picture is a long picture, the zoom rate calculation method of the long picture is used to calculate the zoom rate of the picture. If the picture is not a long picture ( That is, the conventional picture) calculates the zoom ratio of the picture by using the conventional picture zoom ratio calculation method.

进一步的,根据所述图片的分辨率判断所述图片是否为长图片的具体方法为:Further, the specific method for judging whether the picture is a long picture according to the resolution of the picture is as follows:

根据图片的分辨率计算图片高和宽的比值;Calculate the ratio of the height and width of the image according to the resolution of the image;

判断所述比值是否大于2,若是,则所述图片为长图片。Judging whether the ratio is greater than 2, if yes, the picture is a long picture.

具体的,上述已得到图片的分辨率(宽为W1,高为H1),若H1/W1的值大于2,则该图片就为长图片,否则,该图片就为常规图片。Specifically, the resolution of the picture obtained above (width is W1, height is H1), if the value of H1/W1 is greater than 2, the picture is a long picture, otherwise, the picture is a regular picture.

进一步的,所述长图缩放率计算方法为:Further, the method for calculating the scaling ratio of the long image is:

A1.计算移动终端自身屏幕总像素点个数;A1. Calculate the total number of pixels on the screen of the mobile terminal itself;

A2.计算长图的总像素点个数;A2. Calculate the total number of pixels in the long image;

A3.根据所述移动终端自身屏幕总像素点个数与所述长图的总像素个数计算所述长图的缩放率。A3. Calculate the zoom ratio of the long image according to the total number of pixels of the mobile terminal's own screen and the total number of pixels of the long image.

具体的,根据移动终端的分辨率(宽为W,高为H)就可以得到移动终端屏幕的总像素点个数P=W*H;根据图片的分辨率(宽为W1,高为H1)就可以得到图片的总像素点个数P1=W1*H1;然后根据所述的移动终端自身屏幕总像素点个数与所述长图总像素点个数就可以计算该长图的缩放率,具体的缩放率本实施例长图片的缩放率在总像素点的比值上再进行开根号可以使得长图片的缩放率比常规图片的缩放率更小,从而避免长图片被过度压缩。Specifically, according to the resolution of the mobile terminal (the width is W, the height is H) the total number of pixels of the mobile terminal screen P=W*H can be obtained; according to the resolution of the picture (the width is W1, the height is H1) Just can obtain the total number of pixels of the picture P1=W1*H1; Then just can calculate the zoom rate of this long picture according to the total number of pixels of the screen of the mobile terminal itself and the total number of pixels of the long picture, specific zoom ratio In this embodiment, the scaling ratio of the long picture is divided into the square root of the ratio of the total pixels to make the scaling ratio of the long picture smaller than that of the conventional picture, thereby avoiding excessive compression of the long picture.

进一步的,所述常规图片缩放率计算方法为:Further, the calculation method of the conventional image scaling ratio is:

B1.计算图片宽度和移动终端自身屏幕宽度的比率;B1. Calculate the ratio of the picture width to the screen width of the mobile terminal itself;

B2.计算图片高度和移动终端自身屏幕高度的比率;B2. Calculate the ratio of the height of the picture to the height of the screen of the mobile terminal itself;

B3.取所述宽度的比率和所述高度的比率中较大的作为所述图片的缩放率。B3. Taking the larger of the ratio of the width and the ratio of the height as the zoom ratio of the picture.

具体的,根据移动终端的分辨率(宽为W,高为H)和图片的分辨率(宽为W1,高为H1)首先计算图片宽度和移动终端自身屏幕宽度的比率rw=W1/W,然后计算图片高度和移动终端自身屏幕高度的比率rh=H1/H,最后取rw和rh中较大的那个作为图片的缩放率ratio。Specifically, according to the resolution of the mobile terminal (the width is W, the height is H) and the resolution of the picture (the width is W1, the height is H1), first calculate the ratio rw=W1/W of the picture width and the screen width of the mobile terminal itself, Then calculate the ratio rh=H1/H between the height of the picture and the height of the mobile terminal's own screen, and finally take the larger one of rw and rh as the scaling ratio ratio of the picture.

通过上述长图片缩放率计算方法和常规图片缩放率计算方法就可以得到计算出图片的缩放率,计算出图片的缩放率以后就可以得到图片的采样率,在本实施例中采样率inSampieSize的值为缩放率ratio最接近的2的N次方值,例如若缩放率为2.8,那么采样率为2,若缩放率为3.3,那么采样率为4。The zoom rate of the picture can be calculated by the above-mentioned long picture zoom rate calculation method and the conventional picture zoom rate calculation method. After calculating the zoom rate of the picture, the sampling rate of the picture can be obtained. In this embodiment, the value of the sampling rate inSampieSize It is the closest Nth power value of 2 to the zoom ratio ratio. For example, if the zoom ratio is 2.8, then the sampling rate is 2; if the zoom ratio is 3.3, then the sampling rate is 4.

计算出采样率后,要先判断图片是否需要压缩,具体的,如果采样率大于1则根据采样率的大小对图片进行压缩,如果采样率小于等于1则不对图片进行压缩处理。After calculating the sampling rate, it is necessary to judge whether the picture needs to be compressed. Specifically, if the sampling rate is greater than 1, the picture will be compressed according to the size of the sampling rate. If the sampling rate is less than or equal to 1, the picture will not be compressed.

相应的,本实施例还提供一种基于移动终端的图片压缩系统,如图2所示,包括:Correspondingly, this embodiment also provides a mobile terminal-based image compression system, as shown in FIG. 2 , including:

获取模块11,用于获取移动终端自身的分辨率和图片的分辨率;Obtaining module 11, is used for obtaining the resolution of mobile terminal self and the resolution of picture;

第一判断模块12,用于根据所述图片的分辨率判断所述图片是否为长图片;The first judging module 12 is used to judge whether the picture is a long picture according to the resolution of the picture;

第一计算模块13,用于在所述图片为长图片时根据长图缩放率计算方法计算所述图片的缩放率;The first calculation module 13 is used to calculate the zoom rate of the picture according to the long picture zoom rate calculation method when the picture is a long picture;

第二计算模块14,用于在所述图片为非长图片时根据常规图片缩放率计算方法计算所述图片的缩放率;The second calculation module 14 is used to calculate the zoom rate of the picture according to the conventional picture zoom rate calculation method when the picture is a non-long picture;

第三计算模块15,用于根据计算得到的图片的缩放率计算图片的采样率;The third calculation module 15 is used to calculate the sampling rate of the picture according to the calculated zoom rate of the picture;

第二判断模块16,用于判断所述图片是否需要压缩;The second judging module 16 is used to judge whether the picture needs to be compressed;

压缩模块17,用于在所述图片需要压缩时根据所述采样率的大小对图片进行压缩。The compression module 17 is configured to compress the picture according to the size of the sampling rate when the picture needs to be compressed.

具体的,根据所述图片的分辨率判断所述图片是否为长图片的具体方法为:Specifically, the specific method for judging whether the picture is a long picture according to the resolution of the picture is as follows:

根据图片的分辨率计算图片高和宽的比值;Calculate the ratio of the height and width of the image according to the resolution of the image;

判断所述比值是否大于2,若是,则所述图片为长图片。Judging whether the ratio is greater than 2, if yes, the picture is a long picture.

具体的,所述长图缩放率计算方法为:Specifically, the method for calculating the zoom ratio of the long image is:

A1.计算移动终端自身屏幕总像素点个数;A1. Calculate the total number of pixels on the screen of the mobile terminal itself;

A2.计算长图的总像素点个数;A2. Calculate the total number of pixels in the long image;

A3.根据所述移动终端自身屏幕总像素点个数与所述长图的总像素个数计算所述长图的缩放率。A3. Calculate the zoom ratio of the long image according to the total number of pixels of the mobile terminal's own screen and the total number of pixels of the long image.

具体的,所述常规图片缩放率计算方法为:Specifically, the calculation method of the conventional image scaling ratio is:

B1.计算图片宽度和移动终端自身屏幕宽度的比率;B1. Calculate the ratio of the picture width to the screen width of the mobile terminal itself;

B2.计算图片高度和移动终端自身屏幕高度的比率;B2. Calculate the ratio of the height of the picture to the height of the screen of the mobile terminal itself;

B3.取所述宽度的比率和所述高度的比率中较大的作为所述图片的缩放率。B3. Taking the larger of the ratio of the width and the ratio of the height as the zoom ratio of the picture.

本实施例通过对常规图片和长图片采用不同的算法计算其缩放率和目标图片尺寸,通过计算得到的缩放率进而得到采样率,然后根据采样率压缩图片,可以避免图片在移动终端中显示出现OOM问题,可以有效避免长图片被过度压缩。In this embodiment, different algorithms are used to calculate the zoom rate and target picture size of conventional pictures and long pictures, and then the sampling rate is obtained through the calculated scaling rate, and then the pictures are compressed according to the sampling rate, which can avoid the display of pictures in the mobile terminal. The OOM problem can effectively prevent long pictures from being over-compressed.

实施例二Embodiment two

本实施例提供一种基于移动终端的图片压缩方法,如图3所述,包括步骤:This embodiment provides a mobile terminal-based image compression method, as shown in FIG. 3 , including steps:

S21.获取移动终端自身的分辨率和图片的分辨率;S21. Obtain the resolution of the mobile terminal itself and the resolution of the picture;

S22.根据所述图片的分辨率判断所述图片是否为长图片;若是,则跳到步骤S23,若否,则跳到步骤S24;S22. Judging whether the picture is a long picture according to the resolution of the picture; if so, then jump to step S23, if not, then jump to step S24;

S23.根据长图缩放率计算方法计算所述图片的缩放率,然后跳到步骤S25;S23. Calculate the zoom rate of the picture according to the calculation method of the zoom rate of the long picture, and then skip to step S25;

S24.根据常规图片缩放率计算方法计算所述图片的缩放率,然后跳到步骤S25;S24. Calculate the zoom rate of the picture according to the conventional picture zoom rate calculation method, and then skip to step S25;

S25.根据计算得到的图片的缩放率计算图片的采样率;S25. Calculate the sampling rate of the picture according to the calculated zoom rate of the picture;

S26.判断所述图片是否需要压缩;若是,则跳到步骤S27;S26. Determine whether the picture needs to be compressed; if so, skip to step S27;

S27.根据所述采样率的大小对图片进行压缩;S27. Compress the picture according to the size of the sampling rate;

S28.判断压缩后的图片的尺寸与目标图片的尺寸是否一致,若否,则跳到步骤S29;S28. Determine whether the size of the compressed picture is consistent with the size of the target picture, if not, skip to step S29;

S29.对所述压缩后的图片进行Matrix缩放处理使图片最终尺寸为目标尺寸。S29. Perform Matrix scaling processing on the compressed picture so that the final size of the picture is the target size.

与实施例一不同的是,本实施例还包括步骤S28和步骤S29,其余步骤与实施例一相同,在此不再赘述。The difference from the first embodiment is that this embodiment further includes step S28 and step S29, and the rest of the steps are the same as those of the first embodiment, and will not be repeated here.

本实施例中在根据采样率对图片进行压缩以后,再判断压缩后的图片的尺寸与目标图片的尺寸是否一致,如果压缩后的图片的尺寸与目标图片的尺寸不一致的话则对压缩后的图片进行Matrix缩放处理,使得图片尺寸与目标图片尺寸一致,使最终的图片在移动终端中显示的效果最好。In this embodiment, after the picture is compressed according to the sampling rate, it is judged whether the size of the compressed picture is consistent with the size of the target picture. If the size of the compressed picture is inconsistent with the size of the target picture, then the compressed picture Perform Matrix zoom processing to make the size of the picture consistent with the size of the target picture, so that the final picture will have the best display effect on the mobile terminal.

具体的,所述目标图片的尺寸计算方法为:Specifically, the method for calculating the size of the target image is:

所述目标图片的宽为所述图片的宽除以所述计算得到的图片的缩放率的值;所述目标图片的高为所述图片的高除以所述计算得到的图片的缩放率的值。The width of the target picture is the width of the picture divided by the calculated zoom rate of the picture; the height of the target picture is the height of the picture divided by the calculated zoom rate of the picture value.

下面结合实例对本实施例进行详细的说明:Below in conjunction with example this embodiment is described in detail:

(1)原图分辨率为4032*3024,则大小2.35M,因为4032/3024小于2,因此该图片为常规图片,假设当前移动终端分辨率为1920*1080,根据常规图片缩放率计算方法可以得到rh=4032/1920=2.1,rw=3024/1080=2.8,缩放率ratio=max(rh,rw)=2.8,目标图片尺寸W2=4032/2.8=1440,H2=3024/2.8=1080。根据“计算采样率的算法”得到采样率inSampleSize=2。经过采样压缩后的图片尺寸为2016*1512与目标尺寸1440*1080不符,然后在通过Matrix缩放使图片最终尺寸为目标尺寸1440*1080,输出压缩后的图片其尺寸为1440*1080,大小140.8K,这里选择3中分辨率不同的移动终端进行执行本实施例的方案,结果如下表所示:(1) The resolution of the original picture is 4032*3024, and the size is 2.35M. Because 4032/3024 is less than 2, the picture is a regular picture. Assume that the current mobile terminal resolution is 1920*1080. According to the calculation method of the conventional picture scaling ratio, it can be Get rh=4032/1920=2.1, rw=3024/1080=2.8, scaling ratio=max(rh,rw)=2.8, target picture size W2=4032/2.8=1440, H2=3024/2.8=1080. The sampling rate inSampleSize=2 is obtained according to the "algorithm for calculating the sampling rate". The image size after sampling and compression is 2016*1512 and the target size is 1440*1080, and then the final size of the image is the target size of 1440*1080 through Matrix scaling, and the output compressed image has a size of 1440*1080 and a size of 140.8K , here select 3 mobile terminals with different resolutions to execute the solution of this embodiment, and the results are shown in the following table:

移动终端分辨率mobile terminal resolution 1920*10801920*1080 1280*7201280*720 540*360540*360 目标图片分辨率target image resolution 1440*10801440*1080 960*720960*720 480*360480*360 采样压缩后分辨率Resolution after sample compression 2016*15122016*1512 1008*7561008*756 504*378504*378 Matrix缩放后分辨率Matrix scaled resolution 1440*10801440*1080 960*720960*720 480*360480*360 压缩后图片大小Image size after compression 140.8k140.8k 60.2k60.2k 21k21k

(2)原图分辨率为6750*1346,则大小5.18M,因为6750/1346大于2,因此该图片为长图片,假设当前移动终端分辨率为1920*1080根据上文“计算采样率的算法是”得到P=1920*1080=2073600,P1=6750*1346=9088550,缩放率目标图片尺寸W2=6750/2.1=3214,H2=1346/2.1=640。根据“计算采样率的算法”得到采样率inSampleSize=2。经过采样压缩后的图片尺寸为3375*673与目标尺寸3214*640不符,然后在通过Matrix缩放使图片最终尺寸为目标尺寸3214*640,输出压缩后的图片其尺寸为3214*640,大小140.8K。这里选择3中分辨率不同的移动终端进行执行本实施例的方案,结果如下表所示:(2) The resolution of the original picture is 6750*1346, and the size is 5.18M. Because 6750/1346 is greater than 2, the picture is a long picture. Assume that the current mobile terminal resolution is 1920*1080. Yes" get P = 1920*1080 = 2073600, P1 = 6750*1346 = 9088550, scaling Target picture size W2=6750/2.1=3214, H2=1346/2.1=640. The sampling rate inSampleSize=2 is obtained according to the "algorithm for calculating the sampling rate". The image size after sampling and compression is 3375*673 and the target size is 3214*640, and then the final size of the image is 3214*640 through Matrix scaling, and the output compressed image has a size of 3214*640 and a size of 140.8K . Here, 3 mobile terminals with different resolutions are selected to execute the solution of this embodiment, and the results are shown in the following table:

移动终端分辨率mobile terminal resolution 1920*10801920*1080 1280*7201280*720 540*360540*360 目标图片分辨率target image resolution 3214*6403214*640 2150*4822150*482 990*197990*197 采样压缩后分辨率Resolution after sample compression 3375*6733375*673 1687*3361687*336 844*168844*168 Matrix缩放后分辨率Matrix scaled resolution 3214*6403214*640 2150*4822150*482 990*197990*197 压缩后图片大小Image size after compression 414.6k414.6k 283.2k283.2k 56.7k56.7k

相应的,本实施例还提供一种基于移动终端的图片压缩系统,如图4所示,包括:Correspondingly, this embodiment also provides a mobile terminal-based image compression system, as shown in FIG. 4 , including:

获取模块21,用于获取移动终端自身的分辨率和图片的分辨率;Obtaining module 21, used to obtain the resolution of the mobile terminal itself and the resolution of the picture;

第一判断模块22,用于根据所述图片的分辨率判断所述图片是否为长图片;The first judging module 22 is configured to judge whether the picture is a long picture according to the resolution of the picture;

第一计算模块23,用于在所述图片为长图片时根据长图缩放率计算方法计算所述图片的缩放率;The first calculation module 23 is used to calculate the zoom rate of the picture according to the long picture zoom rate calculation method when the picture is a long picture;

第二计算模块24,用于在所述图片为非长图片时根据常规图片缩放率计算方法计算所述图片的缩放率;The second calculation module 24 is used to calculate the zoom rate of the picture according to the conventional picture zoom rate calculation method when the picture is a non-long picture;

第三计算模块25,用于根据计算得到的图片的缩放率计算图片的采样率;The third calculation module 25 is used to calculate the sampling rate of the picture according to the zoom rate of the calculated picture;

第二判断模块26,用于判断所述图片是否需要压缩;The second judging module 26 is used to judge whether the picture needs to be compressed;

压缩模块27,用于在所述图片需要压缩时根据所述采样率的大小对图片进行压缩。The compression module 27 is configured to compress the picture according to the size of the sampling rate when the picture needs to be compressed.

第三判断模块28,用于判断压缩后的图片的尺寸与目标图片的尺寸是否一致;The third judging module 28 is used to judge whether the size of the compressed picture is consistent with the size of the target picture;

缩放模块29,用于在所述压缩后的图片的尺寸与目标图片的尺寸不一致时对所述压缩后的图片进行Matrix缩放处理使图片最终尺寸为目标尺寸。The scaling module 29 is configured to perform Matrix scaling processing on the compressed picture when the size of the compressed picture is inconsistent with the size of the target picture so that the final size of the picture is the target size.

具体的,所述目标图片的尺寸计算方法为:Specifically, the method for calculating the size of the target image is:

所述目标图片的宽为所述图片的宽除以所述计算得到的图片的缩放率的值;所述目标图片的高为所述图片的高除以所述计算得到的图片的缩放率的值。The width of the target picture is the width of the picture divided by the calculated zoom rate of the picture; the height of the target picture is the height of the picture divided by the calculated zoom rate of the picture value.

本实施例通过对常规图片和长图片采用不同的算法计算其缩放率和目标图片尺寸,通过计算得到的缩放率进而得到采样率,然后根据采样率压缩图片,可以避免图片在移动终端中显示出现OOM问题,可以有效避免长图片被过度压缩,并且在经过压缩后还判断压缩后的图片尺寸与目标尺寸是否一致,如果压缩后的图片尺寸和目标尺寸不一致,再通过Matrix缩放图片,使图片尺寸符合目标尺寸,使最终的图片在移动终端中显示的效果最好。In this embodiment, different algorithms are used to calculate the zoom rate and target picture size of conventional pictures and long pictures, and then the sampling rate is obtained through the calculated scaling rate, and then the pictures are compressed according to the sampling rate, which can avoid the display of pictures in the mobile terminal. The OOM problem can effectively avoid excessive compression of long pictures, and after compression, it is also judged whether the size of the compressed picture is consistent with the target size. If the size of the compressed picture is inconsistent with the target size, the picture is scaled by Matrix to make the picture size Meet the target size, so that the final picture can display the best effect on the mobile terminal.

注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention, and the present invention The scope is determined by the scope of the appended claims.

Claims (8)

1. The picture compression method based on the mobile terminal is characterized by comprising the following steps:
s1, acquiring the resolution of a mobile terminal and the resolution of a picture;
s2, judging whether the picture is a long picture or not according to the resolution ratio of the picture; if yes, jumping to the step S3, and if not, jumping to the step S4;
s3, calculating the scaling rate of the picture according to a long-picture scaling rate calculation method, and then jumping to the step S5;
s4, calculating the scaling rate of the picture according to a conventional picture scaling rate calculation method, and then jumping to the step S5;
s5, calculating the sampling rate of the picture according to the calculated scaling rate of the picture;
s6, judging whether the picture needs to be compressed or not; if yes, jumping to the step S7;
s7, compressing the picture according to the sampling rate;
the specific method for judging whether the picture is a long picture according to the resolution ratio of the picture comprises the following steps:
calculating the ratio of the height to the width of the picture according to the resolution ratio of the picture;
judging whether the ratio is greater than 2, if so, the picture is a long picture;
the method for calculating the long graph scaling rate comprises the following steps:
A1. calculating the total number of pixel points of a screen of the mobile terminal;
A2. calculating the total pixel number of the long graph;
A3. and taking the result of opening the root number according to the ratio of the total pixel number of the screen of the mobile terminal to the total pixel number of the long graph as the scaling rate of the long graph.
2. The mobile terminal-based picture compression method according to claim 1, wherein the step S7 further comprises the steps of:
s8, judging whether the size of the compressed picture is consistent with the size of the target picture, if not, jumping to the step S9;
s9, performing Matrix scaling treatment on the compressed picture to enable the final size of the picture to be the target size.
3. The mobile terminal-based picture compression method according to claim 1, wherein the conventional picture scaling rate calculation method is as follows:
B1. calculating the ratio of the picture width to the screen width of the mobile terminal;
B2. calculating the ratio of the picture height to the screen height of the mobile terminal;
B3. taking the larger of the ratio of the width and the ratio of the height as the scaling rate of the picture.
4. The picture compression method based on the mobile terminal as claimed in claim 2, wherein the size calculation method of the target picture is as follows:
the width of the target picture is the value of dividing the width of the picture by the calculated scaling rate of the picture; the height of the target picture is the value of the height of the picture divided by the calculated scaling rate of the picture.
5. A mobile terminal-based picture compression system, comprising:
the acquisition module is used for acquiring the resolution of the mobile terminal and the resolution of the picture;
the first judging module is used for judging whether the picture is a long picture or not according to the resolution ratio of the picture;
the first calculation module is used for calculating the scaling rate of the picture according to a long picture scaling rate calculation method when the picture is a long picture;
the second calculation module is used for calculating the scaling rate of the picture according to a conventional picture scaling rate calculation method when the picture is a non-long picture;
the third calculation module is used for calculating the sampling rate of the picture according to the calculated scaling rate of the picture;
the second judging module is used for judging whether the picture needs to be compressed or not;
the compression module is used for compressing the picture according to the size of the sampling rate when the picture needs to be compressed;
the specific method for judging whether the picture is a long picture according to the resolution ratio of the picture comprises the following steps:
calculating the ratio of the height to the width of the picture according to the resolution ratio of the picture;
judging whether the ratio is greater than 2, if so, the picture is a long picture;
the method for calculating the long graph scaling rate comprises the following steps:
A1. calculating the total number of pixel points of a screen of the mobile terminal;
A2. calculating the total pixel number of the long graph;
A3. and taking the result of opening the root number according to the ratio of the total pixel number of the screen of the mobile terminal to the total pixel number of the long graph as the scaling rate of the long graph.
6. The mobile terminal-based picture compression system of claim 5, further comprising:
the third judging module is used for judging whether the size of the compressed picture is consistent with the size of the target picture or not; and the scaling module is used for performing Matrix scaling processing on the compressed picture to enable the final size of the picture to be the target size when the size of the compressed picture is inconsistent with the size of the target picture.
7. The mobile terminal-based picture compression system of claim 5, wherein the conventional picture scaling calculation method is as follows:
B1. calculating the ratio of the picture width to the screen width of the mobile terminal;
B2. calculating the ratio of the picture height to the screen height of the mobile terminal;
B3. taking the larger of the ratio of the width and the ratio of the height as the scaling rate of the picture.
8. The mobile terminal-based picture compression system according to claim 6, wherein the size calculation method of the target picture is as follows:
the width of the target picture is the value of dividing the width of the picture by the calculated scaling rate of the picture; the height of the target picture is the value of the height of the picture divided by the calculated scaling rate of the picture.
CN201810605667.2A 2018-06-13 2018-06-13 Picture compression method and system based on mobile terminal Active CN108921784B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810605667.2A CN108921784B (en) 2018-06-13 2018-06-13 Picture compression method and system based on mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810605667.2A CN108921784B (en) 2018-06-13 2018-06-13 Picture compression method and system based on mobile terminal

Publications (2)

Publication Number Publication Date
CN108921784A CN108921784A (en) 2018-11-30
CN108921784B true CN108921784B (en) 2023-08-29

Family

ID=64420924

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810605667.2A Active CN108921784B (en) 2018-06-13 2018-06-13 Picture compression method and system based on mobile terminal

Country Status (1)

Country Link
CN (1) CN108921784B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112102161A (en) * 2019-06-17 2020-12-18 西安光启未来技术研究院 Concurrent picture processing method and system
CN110618973A (en) * 2019-09-09 2019-12-27 大唐网络有限公司 Image storage method and device
CN110795008B (en) * 2019-09-29 2021-11-16 视联动力信息技术股份有限公司 Picture transmission method and device and computer readable storage medium
CN111683189B (en) * 2020-05-14 2023-04-07 苏州达家迎信息技术有限公司 Picture compression method, system, terminal and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006065630A (en) * 2004-08-27 2006-03-09 Celsys:Kk Image processing method, enlarged image display method, and program for executing the method
CN201360283Y (en) * 2008-12-12 2009-12-09 龙旗科技(上海)有限公司 Compression and memory device for pictures in cellphone
CN102123259A (en) * 2010-12-28 2011-07-13 四川长虹电器股份有限公司 Method for displaying extra-large-resolution pictures on television
CN102508851A (en) * 2011-09-27 2012-06-20 深圳市五巨科技有限公司 Image upload processing method and image upload processing system
CN104618350A (en) * 2015-01-15 2015-05-13 湘潭大学 Generation method of image checking code
CN105469433A (en) * 2014-09-03 2016-04-06 腾讯科技(深圳)有限公司 Picture compression method and equipment thereof
CN106530232A (en) * 2016-11-10 2017-03-22 河北工业大学 A method of image scaling

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8106956B2 (en) * 2005-06-27 2012-01-31 Nokia Corporation Digital camera devices and methods for implementing digital zoom in digital camera devices and corresponding program products

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006065630A (en) * 2004-08-27 2006-03-09 Celsys:Kk Image processing method, enlarged image display method, and program for executing the method
CN201360283Y (en) * 2008-12-12 2009-12-09 龙旗科技(上海)有限公司 Compression and memory device for pictures in cellphone
CN102123259A (en) * 2010-12-28 2011-07-13 四川长虹电器股份有限公司 Method for displaying extra-large-resolution pictures on television
CN102508851A (en) * 2011-09-27 2012-06-20 深圳市五巨科技有限公司 Image upload processing method and image upload processing system
CN105469433A (en) * 2014-09-03 2016-04-06 腾讯科技(深圳)有限公司 Picture compression method and equipment thereof
CN104618350A (en) * 2015-01-15 2015-05-13 湘潭大学 Generation method of image checking code
CN106530232A (en) * 2016-11-10 2017-03-22 河北工业大学 A method of image scaling

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Detection of upscale-crop and splicing for digital video authentication;Raahat Devender Singh等;scienceDirect;全文 *

Also Published As

Publication number Publication date
CN108921784A (en) 2018-11-30

Similar Documents

Publication Publication Date Title
CN108921784B (en) Picture compression method and system based on mobile terminal
US10834424B2 (en) Method and device for compressing image, and electronic device
US9443281B2 (en) Pixel-based warping and scaling accelerator
CN116320394A (en) Adaptive transfer function for video encoding and decoding
CN110392306B (en) Data processing method and equipment
CN102543045A (en) Method and related device for displaying picture
CN111681291A (en) Image processing method, apparatus, device, and computer-readable storage medium
CN105279006B (en) Screen capture method and terminal based on Android system
CN110930467A (en) Image processing method, electronic device and readable storage medium
WO2017202175A1 (en) Method and device for video compression and electronic device
AU2017317839A1 (en) Panoramic video compression method and device
CN113126937A (en) Display terminal adjusting method and display terminal
CN110070495B (en) Image processing method and device and electronic equipment
CN111683189B (en) Picture compression method, system, terminal and storage medium
CN114691069B (en) Image display adjustment method and device, and electronic device
CN114339412A (en) Video quality enhancement method, mobile terminal, storage medium and device
CN105959610A (en) Image display method and terminal device
CN110232657A (en) A kind of image-scaling method, device, equipment and medium
CN114697555B (en) Image processing method, device, equipment and storage medium
CN110650309A (en) Video conference video image transmission method, terminal and readable storage medium
CN112911186B (en) Image storage method and device, electronic equipment and storage medium
WO2022061723A1 (en) Image processing method, device, terminal, and storage medium
CN113505108A (en) Canvas-based picture compression processing method and device and storage medium
CN113360111B (en) A display method, device, electronic device and medium based on smart screen
US20240290060A1 (en) Image processing method and apparatus

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190411

Address after: 201616 No. 3666 Sixian Road, Songjiang District, Shanghai

Applicant after: PHICOMM (SHANGHAI) Co.,Ltd.

Address before: 610100 125 Longquan Street Park Road, Longquanyi District, Chengdu, Sichuan.

Applicant before: Sichuan fixun Information Technology Co.,Ltd.

TA01 Transfer of patent application right

Effective date of registration: 20201116

Address after: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Applicant before: Phicomm (Shanghai) Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240103

Address after: 313000 room 1019, Xintiandi commercial office, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee after: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Address before: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20241122

Address after: 2-215, 2nd Floor, Building 2, No. 8 Xinshun South Street, Shunyi District, Beijing, 100000

Patentee after: Beijing Yuxin Jinhe Science and Trade Co.,Ltd.

Country or region after: China

Address before: 313000 room 1019, Xintiandi commercial office, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee before: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Country or region before: China