Tizen Native API

The Image Metadata API provides functions that allow to get information about stored image files.

This file contains the image metadata API and related functions to proceed with them. Functions include cloning and destroying the image metadata, getting image metadata such as width, height,
orientation, date taken, title, burst shot id and updating image to DB.

Required Header

#include <media_content.h>

Overview

The Image Metadata API provides functions to get basic information associated with image files:

  • width
  • height
  • date taken (when image was created)
  • image orientation

For getting the image handle (image_meta_h) from the media information (media_info_h), call media_info_get_image() function.
For getting the information related to image files stored in the device call the respective get functions e.g. to get the width of a image, call image_meta_get_width() function and to get orientation (media_content_orientation_e) of a image, call image_meta_get_orientation() function and so on.
When the image handle is no longer needed, it should be destroyed by calling image_meta_destroy() function.

Functions

int image_meta_clone (image_meta_h *dst, image_meta_h src)
 Clones the image metadata.
int image_meta_destroy (image_meta_h image)
 Destroys the image metadata.
int image_meta_get_media_id (image_meta_h image, char **media_id)
 Gets the ID of an image.
int image_meta_get_width (image_meta_h image, int *width)
 Gets the image width in pixels.
int image_meta_get_height (image_meta_h image, int *height)
 Gets the image height in pixels.
int image_meta_get_orientation (image_meta_h image, media_content_orientation_e *orientation)
 Gets the image orientation.
int image_meta_get_date_taken (image_meta_h image, char **date_taken)
 Gets the image creation time.
int image_meta_get_burst_id (image_meta_h image, char **burst_id)
 Gets the burst shot ID.
int image_meta_is_burst_shot (image_meta_h image, bool *is_burst_shot)
 Checks whether the media is a burst shot image.
int image_meta_set_orientation (image_meta_h image, media_content_orientation_e orientation)
 Sets an orientation of the image.
int image_meta_update_to_db (image_meta_h image)
 Updates the image to the media database.

Typedefs

typedef struct image_meta_s * image_meta_h
 The structure type for the Image metadata handle.

Function Documentation

int image_meta_clone ( image_meta_h dst,
image_meta_h  src 
)

Clones the image metadata.

The function copies the image metadata handle from a source to destination.

Since :
2.3.1
Remarks:
The destination handle must be released with image_meta_destroy().
Parameters:
[out]dstThe destination handle to the image metadata
[in]srcThe source handle to the image metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
See also:
image_meta_destroy()

Destroys the image metadata.

The function frees all resources related to the image metadata handle. This handle no longer can be used to perform any operation. A new handle has to be created before next usage.

Since :
2.3.1
Parameters:
[in]imageThe image metadata handle
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Get a copy of image_meta handle by calling image_meta_clone().
See also:
image_meta_clone()
int image_meta_get_burst_id ( image_meta_h  image,
char **  burst_id 
)

Gets the burst shot ID.

Since :
2.3.1
Remarks:
You must release burst_id using free().
Parameters:
[in]imageThe image metadata handle
[out]burst_idThe ID of burst shot\ n If burst_id is NULL, this is not burst shot.
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int image_meta_get_date_taken ( image_meta_h  image,
char **  date_taken 
)

Gets the image creation time.

Since :
2.3.1
Parameters:
[in]imageThe image metadata handle
[out]date_takenThe time, when image was taken (in seconds, since the Epoch)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int image_meta_get_height ( image_meta_h  image,
int *  height 
)

Gets the image height in pixels.

Since :
2.3.1
Parameters:
[in]imageThe image metadata handle
[out]heightThe image height in pixels
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int image_meta_get_media_id ( image_meta_h  image,
char **  media_id 
)

Gets the ID of an image.

Since :
2.3.1
Parameters:
[in]imageThe image metadata handle
[out]media_idThe ID of an image
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied

Gets the image orientation.

Since :
2.3.1
Parameters:
[in]imageThe image metadata handle
[out]orientationThe image orientation
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int image_meta_get_width ( image_meta_h  image,
int *  width 
)

Gets the image width in pixels.

Since :
2.3.1
Parameters:
[in]imageThe image metadata handle
[out]widthThe image width in pixels
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int image_meta_is_burst_shot ( image_meta_h  image,
bool *  is_burst_shot 
)

Checks whether the media is a burst shot image.

Since :
2.3.1
Parameters:
[in]imageThe image metadata handle
[out]is_burst_shottrue if the media is a burst shot image, otherwise false if the media is not a burst shot image
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied

Sets an orientation of the image.

Since :
2.3.1
Parameters:
[in]imageThe image metadata handle
[in]orientationThe image orientation
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Postcondition:
image_meta_update_to_db()

Updates the image to the media database.

The function updates the given image meta in the media database. The function should be called after any change in image attributes, to be updated to the media database. For example, after using image_meta_set_orientation() for setting the orientation of the image, the image_meta_update_to_db() function should be called so as to update the given image attributes in the media database.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/content.write
Remarks:
Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
Parameters:
[in]imageThe handle to the image
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()
image_meta_set_orientation()