Tizen Native API  4.0
Image Util

The Image Util APIs provides functions for common of images .

Required Header

#include <image_util.h>

Overview

Image Util API provides support for common functions of images. The API allows :

  • Calculate the size of the image buffer for the specified resolution and colorspace to be used in the image util module.
  • Extracts representative color from an image buffer.

The API consists of Image Util Transform,Image Util Encode/Decode.

Functions

int image_util_calculate_buffer_size (int width, int height, image_util_colorspace_e colorspace, unsigned int *size)
 Calculates the size of the image buffer for the specified resolution and colorspace.
int image_util_extract_color_from_memory (const unsigned char *image_buffer, int width, int height, unsigned char *rgb_r, unsigned char *rgb_g, unsigned char *rgb_b)
 Extracts representative color from an image buffer.

Enumeration Type Documentation

Enumeration for colorspace.

Since :
2.3.1
Enumerator:
IMAGE_UTIL_COLORSPACE_YV12 

YV12 - YCrCb planar format

IMAGE_UTIL_COLORSPACE_YUV422 

YUV422 - planar

IMAGE_UTIL_COLORSPACE_I420 

YUV420 - planar

IMAGE_UTIL_COLORSPACE_NV12 

NV12- planar

IMAGE_UTIL_COLORSPACE_UYVY 

UYVY - packed

IMAGE_UTIL_COLORSPACE_YUYV 

YUYV - packed

IMAGE_UTIL_COLORSPACE_RGB565 

RGB565, high-byte is Blue

IMAGE_UTIL_COLORSPACE_RGB888 

RGB888, high-byte is Blue

IMAGE_UTIL_COLORSPACE_ARGB8888 

ARGB8888, high-byte is Blue

IMAGE_UTIL_COLORSPACE_BGRA8888 

BGRA8888, high-byte is Alpha

IMAGE_UTIL_COLORSPACE_RGBA8888 

RGBA8888, high-byte is Alpha

IMAGE_UTIL_COLORSPACE_BGRX8888 

BGRX8888, high-byte is X

IMAGE_UTIL_COLORSPACE_NV21 

NV12- planar

IMAGE_UTIL_COLORSPACE_NV16 

NV16- planar

IMAGE_UTIL_COLORSPACE_NV61 

NV61- planar

Enumeration for error.

Since :
2.3.1
Enumerator:
IMAGE_UTIL_ERROR_NONE 

Successful

IMAGE_UTIL_ERROR_INVALID_PARAMETER 

Invalid parameter

IMAGE_UTIL_ERROR_OUT_OF_MEMORY 

Out of memory

IMAGE_UTIL_ERROR_NO_SUCH_FILE 

No such file

IMAGE_UTIL_ERROR_INVALID_OPERATION 

Internal error

IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT 

Not supported format

IMAGE_UTIL_ERROR_PERMISSION_DENIED 

Permission denied

IMAGE_UTIL_ERROR_NOT_SUPPORTED 

Not supported


Function Documentation

int image_util_calculate_buffer_size ( int  width,
int  height,
image_util_colorspace_e  colorspace,
unsigned int *  size 
)

Calculates the size of the image buffer for the specified resolution and colorspace.

Since :
2.3.1
Parameters:
[in]widthThe image width
[in]heightThe image height
[in]colorspaceThe image colorspace
[out]sizeThe Calculated buffer size
Returns:
0 on success, otherwise a negative error value
Return values:
IMAGE_UTIL_ERROR_NONESuccessful
IMAGE_UTIL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
image_util_transform_run()
image_util_decode_jpeg()
image_util_decode_jpeg_from_memory()
image_util_encode_jpeg()
image_util_encode_jpeg_to_memory()
int image_util_extract_color_from_memory ( const unsigned char *  image_buffer,
int  width,
int  height,
unsigned char *  rgb_r,
unsigned char *  rgb_g,
unsigned char *  rgb_b 
)

Extracts representative color from an image buffer.

Since :
3.0
Remarks:
image_buffer should be RGB888 colorspace.
Parameters:
[in]image_bufferThe original image buffer
[in]widthThe image width
[in]heightThe image height
[out]rgb_rThe red color in RGB color space
[out]rgb_gThe green color in RGB color space
[out]rgb_bThe blue color in RGB color space
Returns:
0 on success, otherwise a negative error value
Return values:
IMAGE_UTIL_ERROR_NONESuccessful
IMAGE_UTIL_ERROR_INVALID_PARAMETERInvalid parameter
IMAGE_UTIL_ERROR_OUT_OF_MEMORYout of memory
IMAGE_UTIL_ERROR_INVALID_OPERATIONInvalid operation