Class ThumbnailExtractor

Definition

Namespace:
Tizen.Multimedia.Util
Assembly:
Tizen.Multimedia.Util.dll
API Level:
4

Provides the ability to extract the thumbnail from media files.

C#
Copy
public static class ThumbnailExtractor
Inheritance
System.Object
ThumbnailExtractor

Methods

View Source

Extract(String)

Extracts the thumbnail for the given media with the specified path and size. The generated thumbnail will be returned in ThumbnailExtractionResult.

Declaration
C#
Copy
public static ThumbnailExtractionResult Extract(string path)
Parameters
Type Name Description
System.String path

The path of the media file to extract the thumbnail.

Returns
Type Description
ThumbnailExtractionResult

The result of extracting operation.

Remarks

The size of generated thumbnail will be 320x240.
If the size of path has different ratio from 320x240 (approximately 1.33:1),
thumbnail is generated in a way to keep the ratio of path, which is based on short axis of path.
For example, if the size of path is 900x500 (1.8:1), the size of generated thumbnail is 432x240(1.8:1).
To set the size different from 320x240, please use Extract(String, Size).

If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

Exceptions
Type Condition
System.ArgumentNullException

path is null.

System.IO.FileNotFoundException

path does not exist.

System.InvalidOperationException

An internal error occurs.

FileFormatException

The specified file is not supported.

UnauthorizedAccessException

The caller has no required privilege.

API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
View Source

Extract(String, String)

Extracts the thumbnail for the given media with the specified path and size. The generated thumbnail will be saved in resultThumbnailPath.

Declaration
C#
Copy
public static void Extract(string path, string resultThumbnailPath)
Parameters
Type Name Description
System.String path

The path of the media file to extract the thumbnail.

System.String resultThumbnailPath

The path to save the generated thumbnail.

Remarks

The size of resultThumbnailPath image will be 320x240.
If the size of path has different ratio with 320x240 (approximately 1.33:1),
thumbnail is generated in a way to keep the ratio of path, which is based on short axis of path.
For example, if the size of path is 900x500 (1.8:1), the size of resultThumbnailPath is 432x240(1.8:1).
To set the size different from 320x240, please use Extract(String, Size, String).

If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

Exceptions
Type Condition
System.ArgumentException

path or resultThumbnailPath is invalid.

System.ArgumentNullException

path or resultThumbnailPath is null.

System.IO.FileNotFoundException

path does not exist.

System.InvalidOperationException

An internal error occurs.

FileFormatException

The specified file is not supported.

UnauthorizedAccessException

The caller has no required privilege.

API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
View Source

Extract(String, Size)

Extracts the thumbnail for the given media with the specified path and size. The generated thumbnail will be returned in ThumbnailExtractionResult.

Declaration
C#
Copy
public static ThumbnailExtractionResult Extract(string path, Size size)
Parameters
Type Name Description
System.String path

The path of the media file to extract the thumbnail.

Size size

The size of the thumbnail.

Returns
Type Description
ThumbnailExtractionResult

The result of extracting operation.

Remarks

The size of generated thumbnail will be size.
But, if the size of path has different ratio with size,
thumbnail will be generated in a way to keep the ratio of path, which based on short axis of path.
For example, if the size of path is 900x500 (1.8:1)) and size is 320x240,
the size of generated thumbnail is 432x240(1.8:1).

If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

Exceptions
Type Condition
System.ArgumentNullException

path is null.

System.IO.FileNotFoundException

path does not exist.

System.InvalidOperationException

An internal error occurs.

System.ArgumentOutOfRangeException

The width or the height of size is less than or equal to zero.

FileFormatException

The specified file is not supported.

UnauthorizedAccessException

The caller has no required privilege.

API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
View Source

Extract(String, Size, String)

Extracts the thumbnail for the given media with the specified path and size. The generated thumbnail will be saved in resultThumbnailPath.

Declaration
C#
Copy
public static void Extract(string path, Size size, string resultThumbnailPath)
Parameters
Type Name Description
System.String path

The path of the media file to extract the thumbnail.

Size size

The size of the thumbnail.

System.String resultThumbnailPath

The path to save the generated thumbnail.

Remarks

The size of resultThumbnailPath image will be size.
But, if the size of path has different ratio with size,
thumbnail will be generated in a way to keep the ratio of path, which based on short axis of path.
For example, if the size of path is 900x500 (1.8:1) and size is 320x240,
the size of resultThumbnailPath is 432x240(1.8:1).

If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

Exceptions
Type Condition
System.ArgumentException

path or resultThumbnailPath is invalid.

System.ArgumentNullException

path or resultThumbnailPath is null.

System.IO.FileNotFoundException

path does not exist.

System.InvalidOperationException

An internal error occurs.

System.ArgumentOutOfRangeException

The width or the height of size is less than or equal to zero.

FileFormatException

The specified file is not supported.

UnauthorizedAccessException

The caller has no required privilege.

API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
View Source

ExtractAsync(String)

Extracts the thumbnail for the given media with the specified path.

Declaration
C#
Copy
[Obsolete("Deprecated since API10; Will be removed in API12. Please use Extract instead.")] public static Task<ThumbnailExtractionResult> ExtractAsync(string path)
Parameters
Type Name Description
System.String path

The path of the media file to extract the thumbnail.

Returns
Type Description
System.Threading.Tasks.Task<ThumbnailExtractionResult>

A task that represents the asynchronous extracting operation.

Remarks

The size of the thumbnail will be the default size (320x240).

Exceptions
Type Condition
System.ArgumentNullException

path is null.

System.IO.FileNotFoundException

path does not exist.

System.InvalidOperationException

An internal error occurs.

UnauthorizedAccessException

The caller does not have required privilege for accessing the path.

FileFormatException

The specified file is not supported.

API Level: 4
View Source

ExtractAsync(String, CancellationToken)

Extracts the thumbnail for the given media with the specified path.

Declaration
C#
Copy
[Obsolete("Deprecated since API10; Will be removed in API12. Please use Extract instead.")] public static Task<ThumbnailExtractionResult> ExtractAsync(string path, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String path

The path of the media file to extract the thumbnail.

System.Threading.CancellationToken cancellationToken

The token to stop the operation.

Returns
Type Description
System.Threading.Tasks.Task<ThumbnailExtractionResult>

A task that represents the asynchronous extracting operation.

Remarks

The size of the thumbnail will be the default size(320x240).

Exceptions
Type Condition
System.ArgumentNullException

path is null.

System.IO.FileNotFoundException

path does not exist.

System.InvalidOperationException

An internal error occurs.

UnauthorizedAccessException

The caller does not have required privilege for accessing the path.

FileFormatException

The specified file is not supported.

API Level: 4
View Source

ExtractAsync(String, Size)

Extracts the thumbnail for the given media with the specified path and size.

Declaration
C#
Copy
[Obsolete("Deprecated since API10; Will be removed in API12. Please use Extract instead.")] public static Task<ThumbnailExtractionResult> ExtractAsync(string path, Size size)
Parameters
Type Name Description
System.String path

The path of the media file to extract the thumbnail.

Size size

The size of the thumbnail.

Returns
Type Description
System.Threading.Tasks.Task<ThumbnailExtractionResult>

A task that represents the asynchronous extracting operation.

Remarks

If the width is not a multiple of 8, it can be changed by the inner process.
The width will be a multiple of 8 greater than the set value.

Exceptions
Type Condition
System.ArgumentNullException

path is null.

System.IO.FileNotFoundException

path does not exist.

System.InvalidOperationException

An internal error occurs.

UnauthorizedAccessException

The caller does not have required privilege for accessing the path.

System.ArgumentOutOfRangeException

The width or the height of size is less than or equal to zero.

FileFormatException

The specified file is not supported.

API Level: 4
View Source

ExtractAsync(String, Size, CancellationToken)

Extracts the thumbnail for the given media with the specified path and size.

Declaration
C#
Copy
[Obsolete("Deprecated since API10; Will be removed in API12. Please use Extract instead.")] public static Task<ThumbnailExtractionResult> ExtractAsync(string path, Size size, CancellationToken cancellationToken)
Parameters
Type Name Description
System.String path

The path of the media file to extract the thumbnail.

Size size

The size of the thumbnail.

System.Threading.CancellationToken cancellationToken

The token to stop the operation.

Returns
Type Description
System.Threading.Tasks.Task<ThumbnailExtractionResult>

A task that represents the asynchronous extracting operation.

Remarks

If the width is not a multiple of 8, it can be changed by the inner process.
The width will be a multiple of 8 greater than the set value.

Exceptions
Type Condition
System.ArgumentNullException

path is null.

System.IO.FileNotFoundException

path does not exist.

System.InvalidOperationException

An internal error occurs.

UnauthorizedAccessException

The caller does not have required privilege for accessing the path.

System.ArgumentOutOfRangeException

The width or the height of size is less than or equal to zero.

FileFormatException

The specified file is not supported.

API Level: 4