2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_MEDIA_IMAGE_UTIL_H__
18 #define __TIZEN_MEDIA_IMAGE_UTIL_H__
27 #define IMAGE_UTIL_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x70
31 * @brief This file contains the image util API.
35 * @addtogroup CAPI_MEDIA_IMAGE_UTIL_MODULE
40 * @brief Enumeration for error.
45 IMAGE_UTIL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
46 IMAGE_UTIL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
47 IMAGE_UTIL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
48 IMAGE_UTIL_ERROR_NO_SUCH_FILE = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file */
49 IMAGE_UTIL_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Internal error */
50 IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT = TIZEN_ERROR_IMAGE_UTIL | 0x01, /**< Not supported format */
51 IMAGE_UTIL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
52 IMAGE_UTIL_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not supported */
56 * @brief Enumeration for colorspace.
61 IMAGE_UTIL_COLORSPACE_YV12, /**< YV12 - YCrCb planar format */
62 IMAGE_UTIL_COLORSPACE_YUV422, /**< YUV422 - planar */
63 IMAGE_UTIL_COLORSPACE_I420, /**< YUV420 - planar */
64 IMAGE_UTIL_COLORSPACE_NV12, /**< NV12- planar */
66 IMAGE_UTIL_COLORSPACE_UYVY, /**< UYVY - packed */
67 IMAGE_UTIL_COLORSPACE_YUYV, /**< YUYV - packed */
69 IMAGE_UTIL_COLORSPACE_RGB565, /**< RGB565, high-byte is Blue */
70 IMAGE_UTIL_COLORSPACE_RGB888, /**< RGB888, high-byte is Blue */
71 IMAGE_UTIL_COLORSPACE_ARGB8888, /**< ARGB8888, high-byte is Blue */
73 IMAGE_UTIL_COLORSPACE_BGRA8888, /**< BGRA8888, high-byte is Alpha */
74 IMAGE_UTIL_COLORSPACE_RGBA8888, /**< RGBA8888, high-byte is Alpha */
75 IMAGE_UTIL_COLORSPACE_BGRX8888, /**< BGRX8888, high-byte is X */
76 IMAGE_UTIL_COLORSPACE_NV21, /**< NV12- planar */
77 IMAGE_UTIL_COLORSPACE_NV16, /**< NV16- planar */
78 IMAGE_UTIL_COLORSPACE_NV61, /**< NV61- planar */
79 } image_util_colorspace_e;
82 * @brief Enumerations of rotation
86 IMAGE_UTIL_ROTATION_NONE = 0, /**< None */
87 IMAGE_UTIL_ROTATION_90 = 1, /**< Rotation 90 degree */
88 IMAGE_UTIL_ROTATION_180, /**< Rotation 180 degree */
89 IMAGE_UTIL_ROTATION_270, /**< Rotation 270 degree */
90 IMAGE_UTIL_ROTATION_FLIP_HORZ, /**< Flip horizontal */
91 IMAGE_UTIL_ROTATION_FLIP_VERT, /**< Flip vertical */
92 } image_util_rotation_e;
96 * @ingroup CAPI_MEDIA_IMAGE_UTIL_MODULE
97 * @brief Image util handle.
100 typedef struct transformation_s *transformation_h;
104 * @ingroup CAPI_MEDIA_IMAGE_UTIL_MODULE
105 * @brief Called when transform is finished just before returning the output.
108 * @param[in] error_code The error code of image util transfrom
109 * @param[in,out] dst The result buffer of image util transform
110 * @param[in] user_data The user data passed from the callback registration function
111 * @pre image_util_transform_run() will invoke this function.
113 typedef void (*image_util_transform_completed_cb)(media_packet_h *dst, int error_code, void *user_data);
118 * @addtogroup CAPI_MEDIA_IMAGE_UTIL_MODULE
123 * @brief Creates a handle to image util transform.
126 * @details This function creates a handle to image util transform.
128 * @remarks You must release the @a image util handle using image_util_transform_destroy().
130 * @param[out] handle A handle to image util transform
132 * @return @c 0 on success,
133 * otherwise a negative error value
135 * @retval #IMAGE_UTIL_ERROR_NONE Successful
136 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
137 * @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory
138 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
140 * @see image_util_transform_destroy()
143 int image_util_transform_create(transformation_h *handle);
146 * @brief Sets the image util's accurate mode.
148 * @details This function set if you use hardware accerlation or not.
150 * @remarks The value returned will be IMAGE_UTIL_ERROR_NOT_SUPPORTED, if H/W acceleration doesn't support on the device.
152 * @param[in] handle The handle to image util
153 * @param [in] mode Set @c true, user can use the hardware acceleration\n
154 * otherwise set @c false if user can only software image processing
156 * @return @c 0 on success,
157 * otherwise a negative error value
159 * @retval #IMAGE_UTIL_ERROR_NONE Successful
160 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
161 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
162 * @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED The application does not have the hardware acceleration
164 * @pre image_util_transform_create().
166 * @see image_util_transform_create()
167 * @see image_util_transform_destroy()
169 int image_util_transform_set_hardware_acceleration(transformation_h handle, bool mode);
172 * @brief Sets the information of the converting
175 * @param[in] handle The handle to image util transform
176 * @param[in] colorspace The colorspace of the image buffer
178 * @return @c 0 on success,
179 * otherwise a negative error value
181 * @retval #IMAGE_UTIL_ERROR_NONE Successful
182 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
183 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
184 * @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
186 * @pre image_util_transform_create().
188 * @see image_util_transform_create()
189 * @see image_util_transform_run()
190 * @see image_util_transform_destroy()
192 int image_util_transform_set_colorspace(transformation_h handle, image_util_colorspace_e colorspace);
195 * @brief Sets the information of the resizing
198 * @param[in] handle The handle to image util transform
199 * @param[in] width The width of image buffer
200 * @param[in] height The height of image buffer
202 * @return @c 0 on success,
203 * otherwise a negative error value
205 * @retval #IMAGE_UTIL_ERROR_NONE Successful
206 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
207 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
209 * @pre image_util_transform_create().
211 * @see image_util_transform_create()
212 * @see image_util_transform_run()
213 * @see image_util_transform_destroy()
215 int image_util_transform_set_resolution(transformation_h handle, unsigned int width, unsigned int height);
218 * @brief Sets the information of the rotating
221 * @param[in] handle The handle to image util transform
222 * @param[in] rotation The rotation value of image buffer
224 * @return @c 0 on success,
225 * otherwise a negative error value
227 * @retval #IMAGE_UTIL_ERROR_NONE Successful
228 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
229 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
231 * @pre image_util_transform_create().
233 * @see image_util_transform_create()
234 * @see image_util_transform_run()
235 * @see image_util_transform_destroy()
237 int image_util_transform_set_rotation(transformation_h handle, image_util_rotation_e rotation);
240 * @brief Sets the information of the cropping
243 * @param[in] handle The handle to image util transform
244 * @param[in] start_x The start x position of cropped image buffer
245 * @param[in] start_y The start y position of cropped image buffer
246 * @param[in] end_x The end x position of cropped image buffer
247 * @param[in] end_y The end y position of cropped image buffer
249 * @return @c 0 on success,
250 * otherwise a negative error value
252 * @retval #IMAGE_UTIL_ERROR_NONE Successful
253 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
254 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
256 * @pre image_util_transform_create().
258 * @see image_util_transform_create()
259 * @see image_util_transform_run()
260 * @see image_util_transform_destroy()
262 int image_util_transform_set_crop_area(transformation_h handle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y);
265 * @brief Gets the colorspace of the image buffer
268 * @param[in] handle The handle to image util transform
269 * @param[in,out] colorspace The colorspace of the image buffer
271 * @return @c 0 on success,
272 * otherwise a negative error value
274 * @retval #IMAGE_UTIL_ERROR_NONE Successful
275 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
276 * @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
278 * @pre image_util_transform_create().\n
279 image_util_transform_set_crop_area().
281 * @see image_util_transform_create()
282 * @see image_util_transform_destroy()
284 int image_util_transform_get_colorspace(transformation_h handle, image_util_colorspace_e *colorspace);
287 * @brief Gets the resolution of the image buffer
290 * @param[in] handle The handle to image util transform
291 * @param[in,out] width The width of source image buffer
292 * @param[in,out] height The height of source image buffer
294 * @return @c 0 on success,
295 * otherwise a negative error value
297 * @retval #IMAGE_UTIL_ERROR_NONE Successful
298 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
299 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
301 * @pre image_util_transform_create().\n
302 image_util_transform_set_resolution().
304 * @see image_util_transform_create()
305 * @see image_util_transform_destroy()
307 int image_util_transform_get_resolution(transformation_h handle, unsigned int *width , unsigned int *height);
310 * @brief Gets the information of the rotating
313 * @param[in] handle The handle to image util transform
314 * @param[in,out] rotation The rotation value of image buffer
316 * @return @c 0 on success,
317 * otherwise a negative error value
319 * @retval #IMAGE_UTIL_ERROR_NONE Successful
320 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
321 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
323 * @pre image_util_transform_create().\n
324 image_util_transform_set_rotation().
326 * @see image_util_transform_create()
327 * @see image_util_transform_destroy()
329 int image_util_transform_get_rotation(transformation_h handle, image_util_rotation_e *rotation);
332 * @brief Gets the information of the cropping
335 * @param[in] handle The handle to image util transform
336 * @param[in,out] start_x The start x position of cropped source image buffer
337 * @param[in,out] start_y The start y position of cropped source image buffer
338 * @param[in,out] end_x The end x position of cropped source image buffer
339 * @param[in,out] end_y The end y position of cropped source image buffer
341 * @return @c 0 on success,
342 * otherwise a negative error value
344 * @retval #IMAGE_UTIL_ERROR_NONE Successful
345 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
346 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
348 * @pre image_util_transform_create().\n
349 image_util_transform_set_crop_area().
351 * @see image_util_transform_create()
352 * @see image_util_transform_destroy()
354 int image_util_transform_get_crop_area(transformation_h handle, unsigned int *start_x, unsigned int *start_y, unsigned int *end_x, unsigned int *end_y);
357 * @brief Transform the image for given image util handle.
360 *@remarks If H/W acceleration is not set, transformation is done via S/W acceleration.
362 * @details The function execute asynchronously, which contains complete callback
364 * @param[in] handle The handle of transform
365 * @param[in] src The handle to image util transform
366 * @param[in] callback The callback function to be invoked
367 * @param[in] user_data The user data to be passed to the callback function
369 * @return @c 0 on success,
370 * otherwise a negative error value
372 * @retval #IMAGE_UTIL_ERROR_NONE Successful
373 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
374 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
376 * @see image_util_transform_create()
377 * @see image_util_transform_set_hardware_acceleration
378 * @see image_util_transform_destroy()
380 int image_util_transform_run(transformation_h handle, media_packet_h src, image_util_transform_completed_cb callback, void *user_data);
383 * @brief Destroys a handle to image util.
386 * @details The function frees all resources related to the image util handle. The image util
387 * handle no longer can be used to perform any operation. A new image util handle
388 * has to be created before the next usage.
390 * @param[in] handle The handle to image util transform
392 * @return @c 0 on success,
393 * otherwise a negative error value
395 * @retval #IMAGE_UTIL_ERROR_NONE Successful
396 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
397 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
399 * @see image_util_transform_create()
402 int image_util_transform_destroy(transformation_h handle);
405 * @brief Called once for each supported JPEG encode/decode colorspace.
408 * @param[in] colorspace The colorspace
409 * @param[in] user_data The user data passed from the foreach function
411 * @return @c true to continue with the next iteration of the loop, \n
412 * otherwise @c false to break out of the loop
414 * @pre image_util_foreach_supported_jpeg_colorspace() invokes this callback.
416 * @see image_util_foreach_supported_jpeg_colorspace()
417 * @see image_util_encode_jpeg()
418 * @see image_util_encode_jpeg_to_memory()
419 * @see image_util_decode_jpeg()
420 * @see image_util_decode_jpeg_from_memory()
422 typedef bool (*image_util_supported_jpeg_colorspace_cb)( image_util_colorspace_e colorspace , void * user_data);
425 * @brief Retrieves all supported JPEG encoding/decoding colorspace by invoking a callback function once for each one.
428 * @param[in] callback The callback function to invoke
429 * @param[in] user_data The user data to be passed to the callback function
430 * @return 0 on success,
431 * otherwise a negative error value
433 * @retval #IMAGE_UTIL_ERROR_NONE Successful
434 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
435 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
436 * @post This function invokes image_util_supported_jpeg_colorspace_cb() repeatedly to retrieve each supported JPEG encoding/decoding colorspace.
438 * @see image_util_supported_jpeg_colorspace_cb()
439 * @see image_util_encode_jpeg()
440 * @see image_util_encode_jpeg_to_memory()
441 * @see image_util_decode_jpeg()
442 * @see image_util_decode_jpeg_from_memory()
444 int image_util_foreach_supported_jpeg_colorspace(image_util_supported_jpeg_colorspace_cb callback, void * user_data);
447 * @brief Calculates the size of the image buffer for the specified resolution and colorspace.
450 * @param[in] width The image width
451 * @param[in] height The image height
452 * @param[in] colorspace The image colorspace
453 * @param[out] size The Calculated buffer size
455 * @return @c 0 on success,
456 * otherwise a negative error value
458 * @retval #IMAGE_UTIL_ERROR_NONE Successful
459 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
460 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
462 * @see image_util_transform_run()
463 * @see image_util_decode_jpeg()
464 * @see image_util_decode_jpeg_from_memory()
465 * @see image_util_encode_jpeg()
466 * @see image_util_encode_jpeg_to_memory()
468 int image_util_calculate_buffer_size(int width , int height, image_util_colorspace_e colorspace , unsigned int *size);
472 * @brief Converts the image's colorspace.
475 * @remarks You must get the @a dest buffer size using image_util_transform_calculate_buffer_size().
477 * @param[in,out] dest The image buffer for result \n
478 * Must be allocated by the user
479 * @param[in] dest_colorspace The colorspace to be converted
480 * @param[in] src The source image buffer
481 * @param[in] width The width of the source image
482 * @param[in] height The height of the source image
483 * @param[in] src_colorspace The colorspace of the source image buffer
485 * @return %c 0 on success
486 * otherwise a negative error value
488 * @retval #IMAGE_UTIL_ERROR_NONE Successful
489 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
490 * @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
491 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
493 * @see image_util_transform_calculate_buffer_size()
494 * @see image_util_transform_create()
495 * @see image_util_transform_destroy()
497 int image_util_convert_colorspace( unsigned char * dest , image_util_colorspace_e dest_colorspace , const unsigned char * src , int width, int height, image_util_colorspace_e src_colorspace);
501 * @brief Resizes the image to the specified destination width and height.
504 * @remarks Because of YUV format padding, the destination image size can be adjusted.
506 * @param[in,out] dest The image buffer for result \n
507 * Must be allocated by the user.
508 * @param[in,out] dest_width The image width to resize, and resized width
509 * @param[in,out] dest_height The image height to resize, and resized height
510 * @param[in] src The image buffer for the original image
511 * @param[in] src_width The original image width
512 * @param[in] src_height The original image height
513 * @param[in] colorspace The image colorspace
516 * @return @c 0 on success,
517 * otherwise a negative error value
519 * @retval #IMAGE_UTIL_ERROR_NONE Successful
520 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
521 * @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
522 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
524 * @see image_util_transform_calculate_buffer_size()
526 int image_util_resize(unsigned char * dest, int *dest_width , int *dest_height, const unsigned char * src, int src_width, int src_height , image_util_colorspace_e colorspace);
530 * @brief Rotates the image to the specified angle given in degrees.
533 * @remarks Because of YUV format padding, the destination image size can be adjusted.
534 * Rotations are supported only in these color spaces\n
535 * #IMAGE_UTIL_COLORSPACE_YV12\n
536 * #IMAGE_UTIL_COLORSPACE_I420\n
537 * #IMAGE_UTIL_COLORSPACE_NV12\n
538 * #IMAGE_UTIL_COLORSPACE_RGB888\n
539 * #IMAGE_UTIL_COLORSPACE_RGB565\n
540 * #IMAGE_UTIL_COLORSPACE_ARGB8888\n
541 * #IMAGE_UTIL_COLORSPACE_BGRA8888\n
542 * #IMAGE_UTIL_COLORSPACE_RGBA8888\n
543 * #IMAGE_UTIL_COLORSPACE_BGRX8888\n.
545 * @param[in,out] dest The image buffer for result \n
546 * Must be allocated by the user.
547 * @param[out] dest_width The rotated image width
548 * @param[out] dest_height The rotated image height
549 * @param[in] dest_rotation The angle to rotate
550 * @param[in] src The image buffer for the original image
551 * @param[in] src_width The original image width
552 * @param[in] src_height The original image height
553 * @param[in] colorspace The image colorspace
555 * @return @c 0 on success,
556 * otherwise a negative error value
558 * @retval #IMAGE_UTIL_ERROR_NONE Successful
559 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
560 * @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
561 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
563 * @see image_util_transform_calculate_buffer_size()
565 int image_util_rotate(unsigned char * dest, int *dest_width, int *dest_height, image_util_rotation_e dest_rotation, const unsigned char * src, int src_width, int src_height, image_util_colorspace_e colorspace);
569 * @brief Crops the image to the specified point and dimension.
572 * @remarks Because of YUV format padding, the destination image size can be adjusted.
573 * Crop is supported only in these colorspaces\n
574 * #IMAGE_UTIL_COLORSPACE_YV12 \n
575 * #IMAGE_UTIL_COLORSPACE_I420 \n
576 * #IMAGE_UTIL_COLORSPACE_RGB888 \n
577 * #IMAGE_UTIL_COLORSPACE_RGB565 \n
578 * #IMAGE_UTIL_COLORSPACE_ARGB8888\n
579 * #IMAGE_UTIL_COLORSPACE_BGRA8888\n
580 * #IMAGE_UTIL_COLORSPACE_RGBA8888\n
581 * #IMAGE_UTIL_COLORSPACE_BGRX8888\n.
583 * @param[in,out] dest The image buffer for result. Must be allocated by you
584 * @param[in] x The starting x-axis of crop
585 * @param[in] y The starting y-axis of crop
586 * @param[in/out] width The image width to crop, and cropped width
587 * @param[in/out] height The image height to crop, and cropped height
588 * @param[in] src The image buffer for original image
589 * @param[in] src_width The original image width
590 * @param[in] src_height The original image height
591 * @param[in] colorspace The image colorspace
593 * @return @c 0 on success,
594 * otherwise a negative error value
596 * @retval #IMAGE_UTIL_ERROR_NONE Successful
597 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
598 * @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
599 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
601 * @see image_util_transform_calculate_buffer_size()
603 int image_util_crop(unsigned char * dest, int x , int y, int* width, int *height, const unsigned char *src, int src_width, int src_height, image_util_colorspace_e colorspace);
609 * @brief Decodes the JPEG image to the buffer.
612 * @remarks You must release @a image_buffer using free().\n
613 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
614 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
616 * @param[in] path The image file path
617 * @param[in] colorspace The decoded image colorspace
618 * @param[out] image_buffer The image buffer for the decoded image
619 * @param[out] width The image width
620 * @param[out] height The image height
621 * @param[out] size The image buffer size
623 * @return @c 0 on success,
624 * otherwise a negative error value
626 * @retval #IMAGE_UTIL_ERROR_NONE Successful
627 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
628 * @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY out of memory
629 * @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
630 * @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
631 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
633 * @see image_util_supported_jpeg_colorspace_cb()
634 * @see image_util_decode_jpeg_from_memory()
635 * @see image_util_foreach_supported_jpeg_colorspace()
637 int image_util_decode_jpeg( const char *path , image_util_colorspace_e colorspace, unsigned char ** image_buffer , int *width , int *height , unsigned int *size);
640 * @brief Decodes the JPEG image(in memory) to the buffer.
643 * @remarks You must release @a image_buffer using free().
645 * @param[in] jpeg_buffer The JPEG image buffer
646 * @param[in] jpeg_size The JPEG image buffer size
647 * @param[in] colorspace The decoded image colorspace
648 * @param[out] image_buffer The image buffer for the decoded image
649 * @param[out] width The image width
650 * @param[out] height The image height
651 * @param[out] size The image buffer size
653 * @return @c 0 on success,
654 * otherwise a negative error value
656 * @retval #IMAGE_UTIL_ERROR_NONE Successful
657 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
658 * @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY out of memory
659 * @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
660 * @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
661 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
663 * @see image_util_supported_jpeg_colorspace_cb()
664 * @see image_util_decode_jpeg()
665 * @see image_util_foreach_supported_jpeg_colorspace()
667 int image_util_decode_jpeg_from_memory( const unsigned char * jpeg_buffer , int jpeg_size , image_util_colorspace_e colorspace, unsigned char ** image_buffer , int *width , int *height , unsigned int *size);
670 * @brief Encodes the image to the JPEG image.
673 * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
674 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
676 * @param[in] buffer The original image buffer
677 * @param[in] width The original image width
678 * @param[in] height The original image height
679 * @param[in] colorspace The original image colorspace
680 * @param[in] quality The quality for JPEG image encoding (1 ~ 100)
681 * @param[in] path The file path to be created
683 * @return 0 on success,
684 * otherwise a negative error value
686 * @retval #IMAGE_UTIL_ERROR_NONE Successful
687 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
688 * @retval #IMAGE_UTIL_ERROR_NO_SUCH_FILE No such file
689 * @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
690 * @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
691 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
693 * @see image_util_supported_jpeg_colorspace_cb()
694 * @see image_util_foreach_supported_jpeg_colorspace()
695 * @see image_util_encode_jpeg_to_memory()
697 int image_util_encode_jpeg( const unsigned char *buffer, int width, int height, image_util_colorspace_e colorspace, int quality, const char *path);
700 * @brief Encodes the image to the JPEG image
703 * @remarks You must release @a jpeg_buffer using free().
705 * @param[in] image_buffer The original image buffer
706 * @param[in] width The image width
707 * @param[in] height The image height
708 * @param[in] colorspace The original image colorspace
709 * @param[in] quality The quality for JPEG image encoding (1 ~ 100)
710 * @param[out] jpeg_buffer The created JPEG image buffer \n
711 * The buffer is created by frameworks
712 * @param[out] jpeg_size The created jpeg image buffer size
714 * @return 0 on success,
715 * otherwise a negative error value
717 * @retval #IMAGE_UTIL_ERROR_NONE Successful
718 * @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
719 * @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY out of memory
720 * @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
721 * @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
722 * @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
724 * @see image_util_supported_jpeg_colorspace_cb()
725 * @see image_util_foreach_supported_jpeg_colorspace()
726 * @see image_util_encode_jpeg()
728 int image_util_encode_jpeg_to_memory(const unsigned char *image_buffer, int width, int height, image_util_colorspace_e colorspace, int quality, unsigned char** jpeg_buffer, unsigned int *jpeg_size);
740 #endif /* __TIZEN_MEDIA_IMAGE_UTIL_H__ */