Tizen Native API  4.0

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:

Attribute Filter Keyword Comments
width MEDIA_WIDTH Width
height MEDIA_HEIGHT Height
longitude MEDIA_LONGITUDE Get from metadata if exist.
latitude MEDIA_LATITUDE Get from metadata if exist.
altitude MEDIA_ALTITUDE Get from metadata if exist.
exposure_time MEDIA_EXPOSURE_TIME Get from EXIF if exist.
fnumber MEDIA_FNUMBER Get from EXIF if exist.
iso MEDIA_ISO Get from EXIF if exist.
model MEDIA_MODEL Get from EXIF if exist.
date_taken MEDIA_DATETAKEN Get from EXIF if exist.
orientation MEDIA_ORIENTATION Get from EXIF if exist.
burst_id MEDIA_BURST_ID ID for the burst images.
is_burst_shot Whether burst shot or not.
is_360_content MEDIA_360 Whether 360 content or not.


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) TIZEN_DEPRECATED_API
 Gets the burst shot ID.
int image_meta_get_exposure_time (image_meta_h image, char **exposure_time)
 Gets the exposure time from EXIF.
int image_meta_get_fnumber (image_meta_h image, double *fnumber)
 Gets the fnumber from EXIF.
int image_meta_get_iso (image_meta_h image, int *iso)
 Gets the iso from EXIF.
int image_meta_get_model (image_meta_h image, char **model)
 Gets the model from EXIF.
int image_meta_is_burst_shot (image_meta_h image, bool *is_burst_shot) TIZEN_DEPRECATED_API
 Checks whether the media is a burst shot image.
int image_meta_set_orientation (image_meta_h image, media_content_orientation_e orientation) TIZEN_DEPRECATED_API
 Sets an orientation of the image.
int image_meta_update_to_db (image_meta_h image) TIZEN_DEPRECATED_API
 Updates the image to the media database.

Typedefs

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

Typedef Documentation

typedef struct image_meta_s* image_meta_h

The structure type for the Image metadata handle.

Since :
2.3.1

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 dst should be released using 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
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 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
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.

Deprecated:
Deprecated since 4.0.
Since :
2.3.1
Remarks:
The burst_id should be released using free().
Parameters:
[in]imageThe handle to the image metadata
[out]burst_idThe ID of the 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_INVALID_PARAMETERInvalid parameter
int image_meta_get_date_taken ( image_meta_h  image,
char **  date_taken 
)

Gets the image creation time.

Since :
2.3.1
Remarks:
The date_taken should be released using free().
Parameters:
[in]imageThe handle to the image metadata
[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_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
int image_meta_get_exposure_time ( image_meta_h  image,
char **  exposure_time 
)

Gets the exposure time from EXIF.

Since :
3.0
Remarks:
The exposure_time should be released using free().
Parameters:
[in]imageThe handle to the image metadata
[out]exposure_timeThe value of exposure_time, getting from EXIF
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_INVALID_PARAMETERInvalid parameter
int image_meta_get_fnumber ( image_meta_h  image,
double *  fnumber 
)

Gets the fnumber from EXIF.

Since :
3.0
Parameters:
[in]imageThe handle to the image metadata
[out]fnumberThe value of fnumber, getting from EXIF
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
int image_meta_get_height ( image_meta_h  image,
int *  height 
)

Gets the image height in pixels.

Since :
2.3.1
Parameters:
[in]imageThe handle to the image metadata
[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
int image_meta_get_iso ( image_meta_h  image,
int *  iso 
)

Gets the iso from EXIF.

Since :
3.0
Parameters:
[in]imageThe handle to the image metadata
[out]isoThe value of iso, getting from EXIF
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
int image_meta_get_media_id ( image_meta_h  image,
char **  media_id 
)

Gets the ID of an image.

Since :
2.3.1
Remarks:
The media_id should be released using free().
Parameters:
[in]imageThe handle to the image metadata
[out]media_idThe media ID
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_INVALID_PARAMETERInvalid parameter
int image_meta_get_model ( image_meta_h  image,
char **  model 
)

Gets the model from EXIF.

Since :
3.0
Remarks:
The model should be released using free().
Parameters:
[in]imageThe handle to the image metadata
[out]modelThe value of model, getting from EXIF
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_INVALID_PARAMETERInvalid parameter

Gets the image orientation.

Since :
2.3.1
Parameters:
[in]imageThe handle to the image metadata
[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
int image_meta_get_width ( image_meta_h  image,
int *  width 
)

Gets the image width in pixels.

Since :
2.3.1
Parameters:
[in]imageThe handle to the image metadata
[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
int image_meta_is_burst_shot ( image_meta_h  image,
bool *  is_burst_shot 
)

Checks whether the media is a burst shot image.

Deprecated:
Deprecated since 4.0.
Since :
2.3.1
Parameters:
[in]imageThe handle to the image metadata
[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

Sets an orientation of the image.

Deprecated:
Deprecated since 4.0. This data cannot be saved to the file.
Since :
2.3.1
Parameters:
[in]imageThe handle to the image metadata
[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

Updates the image to the media database.

Deprecated:
Deprecated since 4.0. Related setter functions are deprecated, therefore this function is not needed anymore.

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.

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 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_INVALID_OPERATIONInvalid operation
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_NETWORKNetwork fail
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()