Language

ThumbnailUtils.CreateImageThumbnail Method

Definition

Overloads

Name Description
CreateImageThumbnail(String, ThumbnailKind)

Create a thumbnail for given image file.

CreateImageThumbnail(File, Size, CancellationSignal)

Create a thumbnail for given image file.

CreateImageThumbnail(String, ThumbnailKind)

Create a thumbnail for given image file.

[Android.Runtime.Register("createImageThumbnail", "(Ljava/lang/String;I)Landroid/graphics/Bitmap;", "", ApiSince=29)]
public static Android.Graphics.Bitmap? CreateImageThumbnail(string filePath, Android.Provider.ThumbnailKind kind);
[<Android.Runtime.Register("createImageThumbnail", "(Ljava/lang/String;I)Landroid/graphics/Bitmap;", "", ApiSince=29)>]
static member CreateImageThumbnail : string * Android.Provider.ThumbnailKind -> Android.Graphics.Bitmap

Parameters

filePath
String

The image file.

kind
ThumbnailKind

The desired thumbnail kind, such as android.provider.MediaStore.Images.Thumbnails#MINI_KIND.

Returns

The image thumbnail bitmap, or null when thumbnail generation encounters an I/O failure.

Attributes

Remarks

Create a thumbnail for given image file.

This member is deprecated. Callers should migrate to using #createImageThumbnail(File, Size, CancellationSignal), as it offers more control over resizing and cancellation.

Java documentation for android.media.ThumbnailUtils.createImageThumbnail(java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CreateImageThumbnail(File, Size, CancellationSignal)

Create a thumbnail for given image file.

[Android.Runtime.Register("createImageThumbnail", "(Ljava/io/File;Landroid/util/Size;Landroid/os/CancellationSignal;)Landroid/graphics/Bitmap;", "", ApiSince=29)]
public static Android.Graphics.Bitmap CreateImageThumbnail(Java.IO.File file, Android.Util.Size size, Android.OS.CancellationSignal? signal);
[<Android.Runtime.Register("createImageThumbnail", "(Ljava/io/File;Landroid/util/Size;Landroid/os/CancellationSignal;)Landroid/graphics/Bitmap;", "", ApiSince=29)>]
static member CreateImageThumbnail : Java.IO.File * Android.Util.Size * Android.OS.CancellationSignal -> Android.Graphics.Bitmap

Parameters

file
File

The image file.

size
Size

The desired thumbnail size.

signal
CancellationSignal

An optional signal checked for cancellation during image-thumbnail generation.

Returns

The thumbnail bitmap decoded or retrieved from the image file.

Attributes

Remarks

Create a thumbnail for given image file.

This method should only be used for files that you have direct access to; if you'd like to work with media hosted outside your app, consider using ContentResolver#loadThumbnail(Uri, Size, CancellationSignal) which enables remote providers to efficiently cache and invalidate thumbnails.

Java documentation for android.media.ThumbnailUtils.createImageThumbnail(java.io.File, android.util.Size, android.os.CancellationSignal).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to