Android Image Compression class ThumbnailUtils

Source: Internet
Author: User

A thumbnail ThumbnailUtils class has been added in the system since Android 2.2, which is located in the android. media. the location of ThumbnailUtils can help us obtain thumbnails of video or image files in the system from mediaprovider. This class provides three static methods that can be called directly.
 
 
1. extractThumbnail (source, width, height ):
 
 
Java code
/**
*
* Create a thumbnail of the specified size
* @ Param source file (Bitmap type)
* @ Param width: the width of the compressed string.
* @ Param height refers to the height compressed
*/
ThumbnailUtils. extractThumbnail (source, width, height );
 
2. extractThumbnail (source, width, height, options ):
 
 
Java code
/**
* Create a thumbnail with a specified center size
*
* @ Param source file (Bitmap type)
* @ Param width: width of the thumbnail output
* @ Param height: output the height of the thumbnail.
* @ Param options if options is defined as OPTIONS_RECYCLE_INPUT, the resource file @ param source will be recycled.
* (Unless the thumbnail is equal to @ param source)
*
*/
ThumbnailUtils. extractThumbnail (source, width, height, options );
 
 
3. createVideoThumbnail (filePath, kind ):
 
 
Java code
/**
* Create a thumbnail of a video.
* If the video is damaged or the video format is not supported, null may be returned.
*
* @ Param filePath: Specifies the video file path, for example,/sdcard/android.3gp.
* @ Param kind can be MINI_KIND or MICRO_KIND
*
*/
ThumbnailUtils. createVideoThumbnail (filePath, kind );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.