Join us on the livestream at Android Dev Summit on 7-8 November 2018, starting at 10AM PDT!

ThumbnailUtils

public class ThumbnailUtils
extends Object

java.lang.Object
   ↳ android.media.ThumbnailUtils


Thumbnail generation routines for media provider.

Summary

Constants

int OPTIONS_RECYCLE_INPUT

Constant used to indicate we should recycle the input in extractThumbnail(Bitmap, int, int, int) unless the output is the input.

Public constructors

ThumbnailUtils()

Public methods

static Bitmap createVideoThumbnail(String filePath, int kind)

Create a video thumbnail for a video.

static Bitmap extractThumbnail(Bitmap source, int width, int height, int options)

Creates a centered bitmap of the desired size.

static Bitmap extractThumbnail(Bitmap source, int width, int height)

Creates a centered bitmap of the desired size.

Inherited methods

Constants

OPTIONS_RECYCLE_INPUT

added in API level 8
public static final int OPTIONS_RECYCLE_INPUT

Constant used to indicate we should recycle the input in extractThumbnail(Bitmap, int, int, int) unless the output is the input.

Constant Value: 2 (0x00000002)

Public constructors

ThumbnailUtils

added in API level 8
public ThumbnailUtils ()

Public methods

createVideoThumbnail

added in API level 8
public static Bitmap createVideoThumbnail (String filePath, 
                int kind)

Create a video thumbnail for a video. May return null if the video is corrupt or the format is not supported.

Parameters
filePath String: the path of video file

kind int: could be MINI_KIND or MICRO_KIND

Returns
Bitmap

extractThumbnail

added in API level 8
public static Bitmap extractThumbnail (Bitmap source, 
                int width, 
                int height, 
                int options)

Creates a centered bitmap of the desired size.

Parameters
source Bitmap: original bitmap source

width int: targeted width

height int: targeted height

options int: options used during thumbnail extraction

Returns
Bitmap

extractThumbnail

added in API level 8
public static Bitmap extractThumbnail (Bitmap source, 
                int width, 
                int height)

Creates a centered bitmap of the desired size.

Parameters
source Bitmap: original bitmap source

width int: targeted width

height int: targeted height

Returns
Bitmap