[go: up one dir, main page]

CN103366341A - Method and device for adaptive-resolution display of image - Google Patents

Method and device for adaptive-resolution display of image Download PDF

Info

Publication number
CN103366341A
CN103366341A CN201310133232XA CN201310133232A CN103366341A CN 103366341 A CN103366341 A CN 103366341A CN 201310133232X A CN201310133232X A CN 201310133232XA CN 201310133232 A CN201310133232 A CN 201310133232A CN 103366341 A CN103366341 A CN 103366341A
Authority
CN
China
Prior art keywords
image
resolution
collection
image collection
current application
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.)
Granted
Application number
CN201310133232XA
Other languages
Chinese (zh)
Other versions
CN103366341B (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201310133232.XA priority Critical patent/CN103366341B/en
Publication of CN103366341A publication Critical patent/CN103366341A/en
Application granted granted Critical
Publication of CN103366341B publication Critical patent/CN103366341B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

本发明公开了一种图像自适应分辨率显示的方法及装置,所述方法包括:选定目标图像,所述目标图像包括当前应用特定资源包中文件大小达到预设阈值的图像;从所述当前应用自带资源包中获取第一图像集合;根据所述第一图像集合生成第二图像集合;选定所述第二图像集合中文件大小最大的图像进行显示。该方法能够方便、快捷的自动从多个分辨率的资源包中挑选出适合于当前屏幕分辨率的图片,实现简单,通用性强。

Figure 201310133232

The present invention discloses a method and device for image adaptive resolution display. The method includes: selecting a target image, and the target image includes an image whose file size reaches a preset threshold in a current application-specific resource package; The current application obtains a first image set from its own resource package; generates a second image set according to the first image set; and selects an image with the largest file size in the second image set for display. The method can automatically and conveniently and quickly select a picture suitable for the current screen resolution from resource packs of multiple resolutions, and has simple implementation and strong versatility.

Figure 201310133232

Description

一种图像自适应分辨率显示的方法及装置Method and device for image adaptive resolution display

技术领域 technical field

本发明涉及移动通讯设备应用技术,尤其涉及一种图像自适应分辨率显示的方法及装置。  The invention relates to the application technology of mobile communication equipment, in particular to a method and device for displaying images with self-adaptive resolution. the

背景技术 Background technique

随着移动互联网技术的发展,移动终端及其他手持设备的应用越来越普遍。目前移动终端的分辨率种类越来越多,每个移动终端本身都有一个分辨率,对于单个应用程序而言,在开发程序时为了兼容不同平台不同屏幕分辨率的需要,其资源包中通常会包含主流的几种分辨率,例如VGA(640*480)/HVGA(320*480)/WVGA(800*480)/720P(1280*720)。当应用程序被启动时,系统根据移动终端的屏幕分辨率从资源包中选择对应分辨率的图像进行显示。当移动终端的屏幕分辨率不是上述主流分辨率时,例如分辨率为540*960/800*600时,应用程序就没有对应的资源包,为了适应非主流分辨率,移动终端只能从自带的资源包中随便找一个资源包或者选择一个与其屏幕分辨率相差较小的资源包,对其中的图片进行拉升或压缩,以非主流分辨率的形式去显示。该种机制由于拉升或压缩问题会造成视觉效果较差,而且当设备分辨率刚好在两个主流分辨率中间,或者因为切图方式导致有些图片只适合压缩、不适合拉升时,就无法挑选出适合当前屏幕分辨率的图片,图片显示效果差。  With the development of mobile Internet technology, the application of mobile terminals and other handheld devices is becoming more and more common. At present, there are more and more types of mobile terminal resolutions, and each mobile terminal has its own resolution. For a single application, in order to be compatible with the needs of different screen resolutions on different platforms during program development, the resource package usually includes It will include several mainstream resolutions, such as VGA (640*480)/HVGA (320*480)/WVGA (800*480)/720P (1280*720). When the application is started, the system selects an image of the corresponding resolution from the resource pack according to the screen resolution of the mobile terminal for display. When the screen resolution of the mobile terminal is not the above-mentioned mainstream resolution, for example, when the resolution is 540*960/800*600, the application program does not have a corresponding resource package. In order to adapt to the non-mainstream resolution, the mobile terminal can only use the Randomly find a resource pack in the resource pack or choose a resource pack with a small difference from its screen resolution, upscale or compress the pictures in it, and display it in the form of a non-mainstream resolution. This mechanism will cause poor visual effects due to upscaling or compression problems, and when the device resolution is just in the middle of the two mainstream resolutions, or some pictures are only suitable for compression and not suitable for upscaling due to the image cutting method, they cannot A picture that fits the current screen resolution is picked out, and the picture is displayed poorly. the

发明内容 Contents of the invention

有鉴于此,本发明所要解决的技术问题在于提出一种图像自适应分辨率显示的方法及装置,该方法能够方便、快捷的自动从多个分辨率的资源包中挑选出适合于当前屏幕分辨率的图片。  In view of this, the technical problem to be solved by the present invention is to propose a method and device for image adaptive resolution display, which can conveniently and quickly automatically select the image suitable for the current screen resolution from resource packs with multiple resolutions. rate pictures. the

为达此目的,本发明采用以下技术方案:  For reaching this purpose, the present invention adopts following technical scheme:

一种图像自适应分辨率显示的方法,该方法包括:  A method for image adaptive resolution display, the method comprising:

选定目标图像,所述目标图像包括当前应用特定资源包中文件大小达到预设阈值的图像;  Selecting a target image, where the target image includes an image whose file size reaches a preset threshold in the current application-specific resource pack;

从所述当前应用自带资源包中获取第一图像集合;  Obtain the first image collection from the resource package that comes with the current application;

根据所述第一图像集合生成第二图像集合;  generating a second set of images based on the first set of images;

选定所述第二图像集合中文件大小最大的图像进行显示;  Selecting the image with the largest file size in the second image collection for display;

其中,所述第一图像集合是指当前应用自带资源包中所有分辨率下与所述目标图像名称相同的图像的集合,所述第二图像集合是指第一图像集合中图像经处理生成的与移动终端目标分辨率相同的同一文件格式的图像的集合。  Wherein, the first image collection refers to the collection of images with the same name as the target image at all resolutions in the resource package of the current application, and the second image collection refers to the processed images in the first image collection. A collection of images in the same file format with the same target resolution as the mobile terminal. the

进一步地,所述当前应用资源包包括ldpi、mdpi、hdpi、xhdpi中的任意一种或其组合。  Further, the current application resource package includes any one of ldpi, mdpi, hdpi, xhdpi or a combination thereof. the

进一步地,所述获取目标图像包括,  Further, the acquisition of the target image includes,

选择特定资源包;  select a specific resource bundle;

从所述特定资源包中确定文件大小达到预设阈值的图像;  determining images whose file size reaches a preset threshold from said specific resource bundle;

其中,所述特定资源包为当前应用自带资源包中任意一个。  Wherein, the specific resource package is any one of the current application's own resource packages. the

进一步地,所述生成第二图像集合包括,  Further, said generating the second image set includes,

读取所述第一图像集合中图像的尺寸信息;  Read the size information of the images in the first image collection;

根据下述公式(1)计算所述图像在移动终端目标分辨率下的尺寸信息;  Calculate the size information of the image at the target resolution of the mobile terminal according to the following formula (1);

ww ,, == (( ww ** YY )) // KK hh ,, == (( hh ** YY )) // KK -- -- -- (( 11 ))

将所述图像按照所述图像在移动终端目标分辨率下的尺寸信息进行拉升或压缩;  Stretching or compressing the image according to the size information of the image at the target resolution of the mobile terminal;

存储处理后的图像;  Store the processed image;

其中,w’表示第一图像集合中图像在移动终端目标分辨率下的宽度,h’表示第一图像集合中图像在移动终端目标分辨率下的高度,w表示第一图像集合中图像在原始分辨率下的宽度,h表示第一图像集合中图像在原始分辨率下的高度,Y表示移动终端的PPI,K表示第一图像集合中该图像对应的屏幕密度的设备独立像素数。  Among them, w' represents the width of the image in the first image set at the target resolution of the mobile terminal, h' represents the height of the image in the first image set at the target resolution of the mobile terminal, and w' represents the image in the first image set at the original The width at the resolution, h represents the height of the image in the first image collection at the original resolution, Y represents the PPI of the mobile terminal, and K represents the number of independent pixels of the device corresponding to the screen density of the image in the first image collection. the

进一步地,所述第二图像集合中图像的文件格式包括JPG格式。  Further, the file format of the images in the second image collection includes JPG format. the

相应地,本发明还公开一种图像自适应分辨率显示的装置,所述装置包括:  Correspondingly, the present invention also discloses an image adaptive resolution display device, the device includes:

选定模块,用于选定目标图像,所述目标图像包括当前应用特定资源包中文件大小达到预设阈值的图像;  The selection module is used to select a target image, and the target image includes an image whose file size reaches a preset threshold in the current application-specific resource pack;

获取模块,用于从所述当前应用自带资源包中获取第一图像集合;  An acquisition module, configured to acquire the first image set from the resource package that comes with the current application;

处理模块,用于根据所述第一图像集合生成第二图像集合;  A processing module, configured to generate a second image set according to the first image set;

选择模块,用于选定所述第二图像集合中文件大小最大的图像;  A selection module, configured to select the image with the largest file size in the second image collection;

显示模块,用于显示所述第二图像集合中文件大小最大的图像;  A display module, configured to display the image with the largest file size in the second image collection;

其中,所述第一图像集合是指当前应用自带资源包中所有分辨率下与所述目标图像名称相同的图像的集合,所述第二图像集合是指第一图像集合中图像经处理生成的与移动终端目标分辨率相同的同一文件格式的图像的集合。  Wherein, the first image collection refers to the collection of images with the same name as the target image at all resolutions in the resource package of the current application, and the second image collection refers to the processed images in the first image collection. A collection of images in the same file format with the same target resolution as the mobile terminal. the

进一步地,所述当前应用资源包包括ldpi、mdpi、hdpi、xhdpi中的任意一种或其组合。  Further, the current application resource package includes any one of ldpi, mdpi, hdpi, xhdpi or a combination thereof. the

进一步地,所述获取模块包括,  Further, the acquisition module includes,

选择单元,用于选择特定资源包;  Selection unit, used to select a specific resource bundle;

确定单元,用于从所述特定资源包中确定文件大小达到预设阈值的图像;  a determination unit, configured to determine images whose file size reaches a preset threshold from the specific resource bundle;

其中,所述特定资源包为当前应用自带资源包中任意一个。  Wherein, the specific resource package is any one of the current application's own resource packages. the

进一步地,所述处理模块包括,  Further, the processing module includes,

读取单元,用于读取所述第一图像集合中图像的尺寸信息;  A reading unit, configured to read the size information of the images in the first image set;

计算单元,用于计算所述图像在移动终端目标分辨率下的尺寸信息;  A calculation unit, configured to calculate the size information of the image at the target resolution of the mobile terminal;

调整单元,用于将所述图像按照将所述图像在移动终端目标分辨率下的尺寸信息进行拉升或压缩;  An adjustment unit, configured to expand or compress the image according to the size information of the image at the target resolution of the mobile terminal;

存储单元,用于存储处理后的图像。  The storage unit is used for storing the processed image. the

进一步地,所述第二图像集合中图像的文件格式包括JPG格式。  Further, the file format of the images in the second image collection includes JPG format. the

本发明提供的图像自适应分辨率显示的方法及装置,能够方便、快捷的自动从多个分辨率的资源包中挑选出适合于当前屏幕分辨率的图片,实现简单,通用性强。  The method and device for image self-adaptive resolution display provided by the present invention can conveniently and quickly automatically select a picture suitable for the current screen resolution from resource packs of multiple resolutions, which is simple to implement and highly versatile. the

附图说明 Description of drawings

图1为本发明实施例一提供的图像自适应分辨率显示的方法流程图;  Fig. 1 is a flow chart of a method for image adaptive resolution display provided by Embodiment 1 of the present invention;

图2为本发明实施例一所示方法中生成第二图像集合的流程图;  Fig. 2 is the flow chart that generates the second image collection in the method shown in embodiment one of the present invention;

图3为本发明实施例二提供的图像自适应分辨率显示的装置结构框图。  FIG. 3 is a structural block diagram of an apparatus for image adaptive resolution display provided by Embodiment 2 of the present invention. the

具体实施方式 Detailed ways

下面结合附图并通过具体实施方式来进一步说明本发明的技术方案。此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。  The technical solutions of the present invention will be further described below in conjunction with the accompanying drawings and through specific implementation methods. The specific embodiments described here are only used to explain the present invention, but not to limit the present invention. the

本发明根据选定的目标图像将应用程序自带资源包所有分辨率下对应的图像解析出来,并将所述图像按照移动终端的目标分辨率进行压缩或拉升处理,然后从以同一文件格式保存的处理后的图像中选择文件大小最大的图像进行显示,以使显示图像适合当前移动终端分辨率。  According to the selected target image, the present invention parses out the images corresponding to all resolutions of the application's self-contained resource package, compresses or upscales the image according to the target resolution of the mobile terminal, and then uses the same file format Among the saved processed images, the image with the largest file size is selected for display, so that the displayed image is suitable for the resolution of the current mobile terminal. the

图1为本发明实施例一提供的图像自适应分辨率显示的方法流程图。本实 施例以Android系统为例进行说明。如图1所示,具体流程包括:  FIG. 1 is a flowchart of a method for displaying images with adaptive resolution according to Embodiment 1 of the present invention. This embodiment takes the Android system as an example for description. As shown in Figure 1, the specific process includes:

步骤101:选定目标图像,所述目标图像包括当前应用特定资源包中文件大小达到预设阈值的图像。  Step 101: Select a target image, where the target image includes an image whose file size reaches a preset threshold in the current application-specific resource package. the

在开发应用程序时为了兼容不同平台不同屏幕,应用程序里面会自带相应的资源包。所述资源包包括ldpi、mdpi、hdpi、xhdpi中的任意一种或其组合。多个资源包是为了支持多分辨率,以适应不同屏幕的需要。其中,每个资源包里边可以包含多个分辨率的示例图像。应用程序可以根据不同屏幕尺寸分别提供不同的自定义屏幕布局-平台,将根据屏幕实际尺寸选择对应布局进行渲染。当应用程序在某个平台运行时,系统会根据移动终端的屏幕分辨率从其自带的资源包中解析对应的图片进行显示。  In order to be compatible with different screens on different platforms when developing an application, the application will come with a corresponding resource package. The resource package includes any one of ldpi, mdpi, hdpi, xhdpi or a combination thereof. Multiple resource packs are to support multiple resolutions to suit the needs of different screens. Wherein, each resource package may contain sample images of multiple resolutions. The application can provide different custom screen layout-platforms according to different screen sizes, and the corresponding layout will be selected for rendering according to the actual size of the screen. When the application runs on a certain platform, the system will parse the corresponding picture from its own resource package according to the screen resolution of the mobile terminal and display it. the

Android中的Density分为四种,分别是120dpi,160dpi,240dpi,320dpi,对应工程中的文件夹分别为drawable-ldpi,drawable-mdpi,drawable-hdpi,drawable-xhdpi。Density即根据像素分辨率,在屏幕指定物理宽高范围内能显示的像素数量。在同样的宽高区域,低密度的屏幕能显示的像素较少,而高密度的屏幕则能显示更多的像素。同一张图片的尺寸在这几个文件夹中的比例为3:4:6:8。不同设备有不同的显示效果,Density和设备硬件有关,不依赖像素。Android系统在运行应用程序时,会根据当前设备的Density获取相应文件夹中的图片来显示。  Density in Android is divided into four types, namely 120dpi, 160dpi, 240dpi, 320dpi, and the folders in the corresponding project are drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi. Density is the number of pixels that can be displayed within the specified physical width and height of the screen according to the pixel resolution. In the same width and height area, a low-density screen can display fewer pixels, while a high-density screen can display more pixels. The size ratio of the same picture in these folders is 3:4:6:8. Different devices have different display effects. Density is related to device hardware and does not depend on pixels. When the Android system runs the application, it will obtain the pictures in the corresponding folder according to the Density of the current device to display. the

本实施例中,当启动应用程序时,系统先检查程序资源目录下的资源包,从中选择任意一个资源包,并从所述资源包中确定一张文件大小达到预设阈值的图像作为目标图像,并记录所述目标图像的名称。其中,所述预设阈值可根据实际情况进行设置。  In this embodiment, when the application program is started, the system first checks the resource packages under the resource directory of the program, selects any resource package, and determines an image whose file size reaches a preset threshold from the resource package as the target image , and record the name of the target image. Wherein, the preset threshold can be set according to actual conditions. the

这里需要说明的是,确定目标图像是为了后续从多个资源包中选择相同名 称的图像作为参考样本。通过对不同资源包中的相同内容的图像进行处理,通过分析处理后的图像来确定适合移动终端分辨率的图像。如果从不同资源包中选择的图像不同,则处理后的结果无参考性。  What needs to be explained here is that the determination of the target image is for subsequent selection of an image with the same name from multiple resource packages as a reference sample. Images of the same content in different resource packages are processed, and images suitable for the resolution of the mobile terminal are determined by analyzing the processed images. If the images selected from different resource packs are different, the processed results are not informative. the

优选地,从选定的资源包中确定文件大小最大的图像作为目标图像。文件越大,说明图像携带的信息量较丰富。  Preferably, the image with the largest file size is determined from the selected resource pack as the target image. The larger the file size, the more information the image carries. the

步骤102:从所述当前应用自带资源包中获取第一图像集合。  Step 102: Obtain a first image set from the resource package of the current application. the

所述第一图像集合是指当前应用自带资源包中所有分辨率下与所述目标图像名称相同的图像的集合。  The first image set refers to a set of images with the same name as the target image at all resolutions in the resource package of the current application. the

步骤103:根据所述第一图像集合生成第二图像集合。  Step 103: Generate a second image set according to the first image set. the

所述第二图像集合是指第一图像集合中图像经处理生成的与移动终端目标分辨率相同的同一文件格式的图像的集合。  The second image set refers to a set of images in the same file format that are generated by processing the images in the first image set and have the same target resolution as the mobile terminal. the

图2为本发明实施例一所示方法中生成第二图像集合的流程图。所述第二图像集合中图像的文件格式包括JPG格式。  FIG. 2 is a flow chart of generating a second image set in the method shown in Embodiment 1 of the present invention. The file format of the images in the second image set includes JPG format. the

具体处理过程包括,  The specific process includes,

步骤1021:读取所述第一图像集合中图像的尺寸信息;  Step 1021: Read the size information of the images in the first image collection;

所述第一图像集合中图像的尺寸信息包括图像在原始分辨率下的宽度和高度,即w和h。  The size information of the images in the first image set includes the width and height of the images at the original resolution, namely w and h. the

步骤1022:根据下述公式(1)计算所述图像在移动终端目标分辨率下的尺寸信息;  Step 1022: Calculate the size information of the image at the target resolution of the mobile terminal according to the following formula (1);

ww ,, == (( ww ** YY )) // KK hh ,, == (( hh ** YY )) // KK -- -- -- (( 11 ))

其中,w’表示第一图像集合中图像在移动终端目标分辨率下的宽度,h’表示第一图像集合中图像在移动终端目标分辨率下的高度,w表示第一图像集合 中图像原始分辨率下的宽度,h表示第一图像集合中图像原始分辨率下的高度,Y表示移动终端的PPI,K表示第一图像集合中该图像对应的屏幕密度的设备独立像素数。  Among them, w' represents the width of the image in the first image set at the target resolution of the mobile terminal, h' represents the height of the image in the first image set at the target resolution of the mobile terminal, and w represents the original resolution of the image in the first image set h represents the height at the original resolution of the image in the first image collection, Y represents the PPI of the mobile terminal, and K represents the number of independent pixels of the device corresponding to the screen density of the image in the first image collection. the

此处需要说明的是,无论是移动终端目标分辨率下的宽度和高度,还是第一图像集合中图像原始分辨率下的宽度和高度都是对像素而言的,与图像的物理尺寸无关。  It should be noted here that both the width and height at the target resolution of the mobile terminal and the width and height at the original resolution of the images in the first image set are in terms of pixels and have nothing to do with the physical size of the images. the

具体的,假如当前应用自带的资源包包括ldpi、mdpi、hdpi、xhdpi四种,移动终端调用哪个资源包中的图片进行显示时,采用与屏幕密度有关的独立设备像素进行显示,独立设备像素不依赖于像素。一般情况下的普通屏幕,ldpi指120,mdpi指160,hdpi指240,xhdpi指320,其中,dpi指像素/英寸。某移动终端屏幕尺寸为4英寸、854×480的分辨率,则该移动终端的PPI等于宽度像素数(854)的平方加高度像素数(480)的平方和开2次方后除以屏幕尺寸(4),结果大约是245。在当前应用自带的资源包中没有完全匹配的资源包,也就无法从自带的资源包中获取图像直接应用,而需要对图像进行适当拉升或压缩。  Specifically, if the resource packs of the current application include four types: ldpi, mdpi, hdpi, and xhdpi, when the mobile terminal calls the picture in which resource pack to display, it will use the independent device pixels related to the screen density to display, and the independent device pixels Not dependent on pixels. In general, for ordinary screens, ldpi refers to 120, mdpi refers to 160, hdpi refers to 240, xhdpi refers to 320, and dpi refers to pixels/inch. If the screen size of a mobile terminal is 4 inches and the resolution is 854×480, then the PPI of the mobile terminal is equal to the square sum of the square of the number of width pixels (854) plus the square sum of the number of height pixels (480) divided by the screen size (4), the result is about 245. There is no fully matching resource package in the resource package that comes with the current application, so the image cannot be obtained from the package and used directly, and the image needs to be properly upscaled or compressed. the

本实施例中,第一图像集合中图像对应的屏幕密度的设备独立像素数有四种,如果当前获取到的第一图像集合中的图像为ldpi资源包中的图像,则根据公式(1)计算所述图像在移动终端目标分辨率下的尺寸信息变为:  In this embodiment, there are four types of device independent pixels corresponding to the screen density of the images in the first image set. If the images in the first image set currently obtained are images in the ldpi resource package, then according to the formula (1) Calculating the size information of the image at the target resolution of the mobile terminal becomes:

ww ,, == (( ww ** 245245 )) // 120120 hh ,, == (( hh ** 245245 )) // 120120

根据第一图像集合中的ldpi资源包中的图像的原始尺寸,即可求得该图像在移动终端目标分辨率下的尺寸信息。  According to the original size of the image in the ldpi resource package in the first image set, the size information of the image at the target resolution of the mobile terminal can be obtained. the

对于第一图像集合中的图像为mdpi资源包中的图像,则根据公式(1)计 算所述图像在移动终端目标分辨率下的尺寸信息变为:  For the images in the first image set are the images in the mdpi resource pack, the size information of the images at the target resolution of the mobile terminal is calculated according to the formula (1):

ww ,, == (( ww ** 245245 )) // 160160 ww ,, == (( hh ** 245245 )) // 160160

根据第一图像集合中的mdpi资源包中的图像的原始尺寸,即可求得该图像在移动终端目标分辨率下的尺寸信息。  According to the original size of the image in the mdpi resource package in the first image set, the size information of the image at the target resolution of the mobile terminal can be obtained. the

对于第一图像集合中的图像为hdpi资源包中的图像,则根据公式(1)计算所述图像在移动终端目标分辨率下的尺寸信息变为:  For the images in the first image set are images in the hdpi resource pack, the size information of the images at the target resolution of the mobile terminal is calculated according to formula (1):

ww ,, == (( ww ** 245245 )) // 240240 hh ,, == (( hh ** 245245 )) // 240240

根据第一图像集合中的hdpi资源包中的图像的原始尺寸,即可求得该图像在移动终端目标分辨率下的尺寸信息。  According to the original size of the image in the hdpi resource package in the first image set, the size information of the image at the target resolution of the mobile terminal can be obtained. the

对于第一图像集合中的图像为xhdpi资源包中的图像,则根据公式(1)计算所述图像在移动终端目标分辨率下的尺寸信息变为:  For the images in the first image collection are images in the xhdpi resource pack, then the size information of the images at the target resolution of the mobile terminal is calculated according to the formula (1):

ww ,, == (( ww ** 245245 )) // 240240 ww ,, == (( hh ** 245245 )) // 240240

根据第一图像集合中的xhdpi资源包中的图像的原始尺寸,即可求得该图像在移动终端目标分辨率下的尺寸信息。  According to the original size of the image in the xhdpi resource package in the first image set, the size information of the image at the target resolution of the mobile terminal can be obtained. the

需要说明的是,这里只是以一个具体实施例来进行了说明。计算第一图像集合中各图像在目标分辨率下的尺寸信息主要是与移动终端的PPI及当前应用的资源包有关系。当然,本实施例并不具体限定资源包的种类,还可以包括Android更高版本自带的资源包。其中,xhdpi是从Android2.2才开始增加的分类,Android2.3开始增加分类xlarge。  It should be noted that, here only a specific embodiment is used for illustration. The calculation of the size information of each image in the first image set at the target resolution is mainly related to the PPI of the mobile terminal and the resource package currently used. Of course, this embodiment does not specifically limit the types of resource packs, and may also include resource packs that come with a higher version of Android. Among them, xhdpi is a category that has only been added since Android2.2, and the category xlarge has been added since Android2.3. the

步骤1023:将所述图像按照所述图像在移动终端目标分辨率下的尺寸信息进行拉升或压缩;  Step 1023: stretch or compress the image according to the size information of the image at the target resolution of the mobile terminal;

本步骤中,使用Bitmap类载入图像,调用Bitmap类的createScaledBitmap方法,将图片数据按目标分辨率进行拉升或压缩。本领域普通技术人员容易知道,对于图像的拉升或者压缩是常用的图像处理技术,因此,对于图像拉升或者压缩处理的方法并没有严格的限定。  In this step, use the Bitmap class to load the image, and call the createScaledBitmap method of the Bitmap class to scale or compress the image data according to the target resolution. Those skilled in the art can easily know that image upscaling or compression is a commonly used image processing technology, therefore, there is no strict limitation on the method of image upscaling or compression processing. the

步骤1024:存储处理后的图像;  Step 1024: store the processed image;

调用Bitmap类的compress方法,将其保存为JPG格式的文件  Call the compress method of the Bitmap class to save it as a JPG format file

步骤104:选定所述第二图像集合中文件大小最大的图像进行显示。  Step 104: Select and display the image with the largest file size in the second image collection. the

名称相同的目标文件内容相同,通过拉升或压缩处理后,生成多个内容相同、文件格式相同,大小不同的文件。多个文件之间可以进行比较具有参考性。对JPG文件而言,越模糊代表的信息量越少,其对应的文件也越小;越清晰代表的信息量越多,对应的文件也越大。因此,所述步骤中选择文件大小最大的图片作为移动终端目标分辨率下显示的图片。  Object files with the same name have the same content, and after being stretched or compressed, multiple files with the same content, the same file format, and different sizes are generated. Multiple files can be compared for reference. For JPG files, the more blurred the information, the smaller the corresponding file; the clearer the more information, the larger the corresponding file. Therefore, in the step, the picture with the largest file size is selected as the picture displayed at the target resolution of the mobile terminal. the

本实施例提供的图像自适应分辨率显示的方法,能够方便、快捷的自动从多个分辨率的资源包中挑选出适合于当前屏幕分辨率的图片,实现简单,通用性强。  The image adaptive resolution display method provided in this embodiment can conveniently and quickly automatically select a picture suitable for the current screen resolution from resource packs of multiple resolutions, which is simple to implement and highly versatile. the

图3为本发明实施例二提供的图像自适应分辨率显示的装置结构框图。如图3所示,所述装置包括,  FIG. 3 is a structural block diagram of an apparatus for image adaptive resolution display provided by Embodiment 2 of the present invention. As shown in Figure 3, the device includes,

选定模块30,用于选定目标图像,所述目标图像包括当前应用特定资源包中文件大小达到预设阈值的图像;  The selection module 30 is used to select a target image, and the target image includes an image whose file size reaches a preset threshold in the current application-specific resource package;

获取模块31,用于从所述当前应用自带资源包中获取第一图像集合;  An acquisition module 31, configured to acquire a first set of images from the resource package that comes with the current application;

处理模块32,用于根据所述第一图像集合生成第二图像集合;  A processing module 32, configured to generate a second image set according to the first image set;

选择模块33,用于选定所述第二图像集合中文件大小最大的图像;  Selection module 33, for selecting the image with the largest file size in the second image collection;

显示模块34,用于显示所述第二图像集合中文件大小最大的图像;  A display module 34, configured to display the image with the largest file size in the second image collection;

其中,所述第一图像集合是指当前应用自带资源包中所有分辨率下与所述目标图像名称相同的图像的集合,所述第二图像集合是指第一图像集合中图像经处理生成的与移动终端目标分辨率相同的同一文件格式的图像的集合。  Wherein, the first image collection refers to the collection of images with the same name as the target image at all resolutions in the resource package of the current application, and the second image collection refers to the processed images in the first image collection. A collection of images in the same file format with the same target resolution as the mobile terminal. the

其中,所述选定模块30包括,  Wherein, the selected module 30 includes,

选择单元301,用于选择特定资源包;  Selection unit 301, used to select a specific resource package;

确定单元302,用于从所述特定资源包中确定文件大小达到预设阈值的图像;其中,所述特定资源包为当前应用自带资源包中任意一个。  The determining unit 302 is configured to determine an image whose file size reaches a preset threshold from the specific resource package; wherein the specific resource package is any one of the resource packages that come with the current application. the

所述处理模块32包括,  The processing module 32 includes,

读取单元321,用于读取所述第一图像集合中图像的尺寸信息;  A reading unit 321, configured to read the size information of the images in the first image set;

计算单元322,用于计算所述图像在移动终端目标分辨率下的尺寸信息;  A calculation unit 322, configured to calculate the size information of the image at the target resolution of the mobile terminal;

调整单元323,用于将所述图像按照将所述图像在移动终端目标分辨率下的尺寸信息进行拉升或压缩;  An adjustment unit 323, configured to expand or compress the image according to the size information of the image at the target resolution of the mobile terminal;

存储单元324,用于存储处理后的图像。  The storage unit 324 is configured to store the processed image. the

本实施例提供的图像自适应分辨率显示的装置,能够方便、快捷的自动从多个分辨率的资源包中挑选出适合于当前屏幕分辨率的图片。  The device for image adaptive resolution display provided in this embodiment can conveniently and quickly automatically select a picture suitable for the current screen resolution from resource packages of multiple resolutions. the

以上实施例提供的技术方案中的全部或部分内容可以通过软件编程实现,其软件程序存储在可读取的存储介质中,存储介质例如:计算机中的硬盘、光盘或软盘。  All or part of the technical solutions provided by the above embodiments can be realized by software programming, and the software program is stored in a readable storage medium, such as a hard disk, an optical disk or a floppy disk in a computer. the

以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。  The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection of the present invention. within range. the

Claims (10)

1. the method that image adaptive resolution shows is characterized in that, the method comprises:
Selected target image, described target image comprise that current application specific resources bag File size reaches the image of predetermined threshold value;
Carry from described current application and to obtain the first image collection the resource bag;
Generate the second image collection according to described the first image collection;
The maximum image of selected described the second image collection File size shows;
Wherein, described the first image collection refers to that current application carries the set of the image identical with described target image title under all resolution in the resource bag, and described the second image collection refers to the set of the image of the identical file form identical with the portable terminal target resolution of the treated generation of image in the first image collection.
2. the method that shows of image adaptive resolution according to claim 1 is characterized in that, described current application resource bag comprises any one or its combination among ldpi, mdpi, hdpi, the xhdpi.
3. the method that shows of image adaptive resolution according to claim 2 is characterized in that, the described target image that obtains comprises,
Select the specific resources bag;
Determine that from described specific resources bag file size reaches the image of predetermined threshold value;
Wherein, described specific resources bag is that current application carries in the resource bag any one.
4. the method that shows of image adaptive resolution according to claim 1 is characterized in that, described generation the second image collection comprises,
Read the dimension information of image in described the first image collection;
Calculate the dimension information of described image under the portable terminal target resolution according to following formula (1);
w , = ( w * Y ) / K h , = ( h * Y ) / K - - - ( 1 )
Described image is drawn high according to the dimension information of described image under the portable terminal target resolution or compress;
Image after the stores processor;
Wherein, the width of image under the portable terminal target resolution in w ' expression the first image collection, the height of image under the portable terminal target resolution in h ' expression the first image collection, w represents the width of image under original resolution in the first image collection, h represents the height of image under original resolution in the first image collection, Y represents the PPI of portable terminal, and K represents the equipment independent image prime number of the screen density that this image is corresponding in the first image collection.
5. the method for image adaptive resolution demonstration according to claim 1 is characterized in that, the file layout of image comprises the JPG form in described the second image collection.
6. the device that image adaptive resolution shows is characterized in that, described device comprises:
Chosen module is used for the selected target image, and described target image comprises that current application specific resources bag File size reaches the image of predetermined threshold value;
Acquisition module is used for carrying the resource bag from described current application and obtains the first image collection;
Processing module is used for generating the second image collection according to described the first image collection;
Select module, be used for the maximum image of selected described the second image collection File size;
Display module is used for showing the maximum image of described the second image collection File size;
Wherein, described the first image collection refers to that current application carries the set of the image identical with described target image title under all resolution in the resource bag, and described the second image collection refers to the set of the image of the identical file form identical with the portable terminal target resolution of the treated generation of image in the first image collection.
7. the device that shows of image adaptive resolution according to claim 6 is characterized in that, described current application resource bag comprises any one or its combination among ldpi, mdpi, hdpi, the xhdpi.
8. the device that shows of image adaptive resolution according to claim 7 is characterized in that, described acquisition module comprises,
Selected cell is used for selecting the specific resources bag;
Determining unit is used for determining that from described specific resources bag file size reaches the image of predetermined threshold value;
Wherein, described specific resources bag is that current application carries in the resource bag any one.
9. the device that shows of image adaptive resolution according to claim 6 is characterized in that, described processing module comprises,
Reading unit is for the dimension information that reads described the first image collection image;
Computing unit is used for calculating the dimension information of described image under the portable terminal target resolution;
Adjustment unit is used for described image according to the dimension information of described image under the portable terminal target resolution being drawn high or compressing;
Storage unit is for the image after the stores processor.
10. the device of described image adaptive resolution demonstration according to claim 6 is characterized in that, the file layout of image comprises the JPG form in described the second image collection.
CN201310133232.XA 2013-04-16 2013-04-16 Method and device for image adaptive resolution display Active CN103366341B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310133232.XA CN103366341B (en) 2013-04-16 2013-04-16 Method and device for image adaptive resolution display

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310133232.XA CN103366341B (en) 2013-04-16 2013-04-16 Method and device for image adaptive resolution display

Publications (2)

Publication Number Publication Date
CN103366341A true CN103366341A (en) 2013-10-23
CN103366341B CN103366341B (en) 2016-11-02

Family

ID=49367617

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310133232.XA Active CN103366341B (en) 2013-04-16 2013-04-16 Method and device for image adaptive resolution display

Country Status (1)

Country Link
CN (1) CN103366341B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103491435A (en) * 2013-09-10 2014-01-01 深圳创维数字技术股份有限公司 Method and device for determining resolution of set-top box
CN105959610A (en) * 2016-06-20 2016-09-21 乐视控股(北京)有限公司 Image display method and terminal device
CN106157247A (en) * 2016-07-06 2016-11-23 北京元心科技有限公司 A kind of image processing method and system
CN106210401A (en) * 2016-08-03 2016-12-07 广东欧珀移动通信有限公司 Image downloading method and server
CN106250081A (en) * 2016-07-29 2016-12-21 努比亚技术有限公司 A kind of display packing based on double screen terminal and device
WO2017050105A1 (en) * 2015-09-23 2017-03-30 北京金山安全软件有限公司 Picture compression method and apparatus, and mobile terminal
CN108133695A (en) * 2018-01-02 2018-06-08 京东方科技集团股份有限公司 A kind of method for displaying image, device, equipment and medium
CN109426509A (en) * 2017-09-04 2019-03-05 华为技术有限公司 Method for processing resource and equipment
CN110020317A (en) * 2017-12-25 2019-07-16 北京京东尚科信息技术有限公司 Web page-container backing file determines method, apparatus, equipment and readable storage medium storing program for executing
CN111176747A (en) * 2019-12-16 2020-05-19 华为终端有限公司 Application starting method and device and electronic equipment
CN111290810A (en) * 2020-01-19 2020-06-16 维沃移动通信有限公司 Image display method and electronic equipment
CN111340683A (en) * 2020-02-08 2020-06-26 朱明华 Image data processing method, image data processing device, image processing system and server
CN113590537A (en) * 2021-07-30 2021-11-02 平安普惠企业管理有限公司 Picture resource loading method, device and equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1746843A (en) * 2004-09-08 2006-03-15 英业达股份有限公司 Window and its icon setting system and method
CN102298495A (en) * 2011-06-27 2011-12-28 上海北大方正科技电脑系统有限公司 Method for enabling android software to adapt to different screen densities

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1746843A (en) * 2004-09-08 2006-03-15 英业达股份有限公司 Window and its icon setting system and method
CN102298495A (en) * 2011-06-27 2011-12-28 上海北大方正科技电脑系统有限公司 Method for enabling android software to adapt to different screen densities

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
NERA: "《http://blog.sina.com.cn/s/blog_4460ce3d010122lk.html》", 14 September 2012 *
R8HZGEMQ: "《http://blog.csdn.net/r8hzgemq/article/details/8243119》", 30 November 2012 *
SUBAOHAO: "《http://blog.csdn.net/subaohao/article/details/8285757》", 12 December 2012 *
流星: "《http://blog.sina.com.cn/s/blog_4ad7c2540101ejvz.html》", 27 January 2013 *

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103491435A (en) * 2013-09-10 2014-01-01 深圳创维数字技术股份有限公司 Method and device for determining resolution of set-top box
US10210630B2 (en) 2015-09-23 2019-02-19 Beijing Kingsoft Internet Security Software Co., Ltd. Picture compression method and apparatus, and mobile terminal
WO2017050105A1 (en) * 2015-09-23 2017-03-30 北京金山安全软件有限公司 Picture compression method and apparatus, and mobile terminal
CN105959610A (en) * 2016-06-20 2016-09-21 乐视控股(北京)有限公司 Image display method and terminal device
CN106157247A (en) * 2016-07-06 2016-11-23 北京元心科技有限公司 A kind of image processing method and system
CN106250081A (en) * 2016-07-29 2016-12-21 努比亚技术有限公司 A kind of display packing based on double screen terminal and device
CN106210401A (en) * 2016-08-03 2016-12-07 广东欧珀移动通信有限公司 Image downloading method and server
CN109426509A (en) * 2017-09-04 2019-03-05 华为技术有限公司 Method for processing resource and equipment
CN110020317A (en) * 2017-12-25 2019-07-16 北京京东尚科信息技术有限公司 Web page-container backing file determines method, apparatus, equipment and readable storage medium storing program for executing
CN110020317B (en) * 2017-12-25 2021-12-14 北京京东尚科信息技术有限公司 Webpage container bottom supporting file determining method, device, equipment and readable storage medium
CN108133695A (en) * 2018-01-02 2018-06-08 京东方科技集团股份有限公司 A kind of method for displaying image, device, equipment and medium
CN108133695B (en) * 2018-01-02 2020-08-14 京东方科技集团股份有限公司 Image display method, device, equipment and medium
CN111176747A (en) * 2019-12-16 2020-05-19 华为终端有限公司 Application starting method and device and electronic equipment
CN111290810A (en) * 2020-01-19 2020-06-16 维沃移动通信有限公司 Image display method and electronic equipment
CN111290810B (en) * 2020-01-19 2021-10-15 维沃移动通信有限公司 Image display method and electronic equipment
CN111340683A (en) * 2020-02-08 2020-06-26 朱明华 Image data processing method, image data processing device, image processing system and server
CN111340683B (en) * 2020-02-08 2020-11-13 朱明华 Image data processing method, image data processing device, image processing system and server
CN113590537A (en) * 2021-07-30 2021-11-02 平安普惠企业管理有限公司 Picture resource loading method, device and equipment and storage medium

Also Published As

Publication number Publication date
CN103366341B (en) 2016-11-02

Similar Documents

Publication Publication Date Title
CN103366341B (en) Method and device for image adaptive resolution display
US7418673B2 (en) Thumbnail image browsing method in an embedded system
US10187546B2 (en) Method and device for correcting document image captured by image pick-up device
JP4782105B2 (en) Image processing apparatus and image processing method
US20060015823A1 (en) Display and preview method for display apparatus
CN110163786B (en) Method, device and equipment for removing watermark
CN107103890B (en) The method and apparatus of application is shown on fixed-direction display
JP2005293577A (en) Method, device, and program for generating high-condensation visual summary of vide area
US9754350B2 (en) Systems and methods of automatic image sizing
TW201227494A (en) Method of picture display and device thereof
CN106446223B (en) Map data processing method and device
JP5789719B2 (en) Method and apparatus for determining the display mode of an electronic document
CN103702032A (en) Image processing method, device and terminal equipment
EP3190801A1 (en) Display device, system and controlling method therefor
CN109389659A (en) Rendering method and device of PPT (Power Point) mathematical formula, storage medium and terminal equipment
US9767583B2 (en) Method and device for packing multiple images
CN103177101B (en) A kind of method of circulation display thumbnail on folder icon and device
EP2085926B1 (en) Method and apparatus for generating thumbnail image
EP2600604A1 (en) Reducing moiré patterns
US9792717B2 (en) Interactive slide deck
US20120327486A1 (en) Method and Device of Document Scanning and Portable Electronic Device
TWI271998B (en) Image processing method and apparatus thereof
CN106796732B (en) Accelerated image gradients based on one-dimensional data
US20120313972A1 (en) Method for processing digital image file and electronic device using the same
CN105959610A (en) Image display method and terminal device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.