img_crop()

Crop an image

Synopsis:

#include <img/img.h>

int img_crop( const img_t *src, 
              img_t *dst, 
              const unsigned x, 
              const unsigned y );


Arguments:

src
The address of the source img_t structure to crop.
dst
The address of the destination img_t structure, which requires the width (IMG_W) and height (IMG_H) to be specified at a minimum.
x
The horizontal coordinate in the source image to begin the crop operation.
y
The vertical coordinate in the source image to begin the crop operation.

Library:

libimg

Use the -l img option to qcc to link against this library.

Description:

This function will crop a source image at a given set of source coordinates x, y to the dimensions specified by the destination image.

Returns:

IMG_ERR_OK
Success
IMG_ERR_PARM
  • source image width, height, and/or format not set.
  • destination image width, and/or height not set.
  • destination image larger than source image.
  • crop co-ordinates plus size of destination image exceed source image bounds.
IMG_ERR_NOSUPPORT
Destination image format not supported
IMG_ERR_MEM
Memory allocation failure

Classification:

Image library

Safety:
Interrupt handler No
Signal handler No
Thread No