check

check — test images for various properties

Stability Level

Stable, unless otherwise indicated

Synopsis


#include <vips/vips.h>

int                 im_rwcheck                          (IMAGE *im);
int                 im_iocheck                          (IMAGE *in,
                                                         IMAGE *out);
int                 im_incheck                          (IMAGE *im);
int                 im_outcheck                         (IMAGE *im);
int                 im_piocheck                         (IMAGE *in,
                                                         IMAGE *out);
int                 im_pincheck                         (IMAGE *im);
int                 im_poutcheck                        (IMAGE *im);
int                 im_check_uncoded                    (const char *domain,
                                                         IMAGE *im);
int                 im_check_known_coded                (const char *domain,
                                                         IMAGE *im);
int                 im_check_mono                       (const char *domain,
                                                         IMAGE *im);
int                 im_check_bands                      (const char *domain,
                                                         IMAGE *im,
                                                         int bands);
int                 im_check_bands_1orn                 (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);
int                 im_check_int                        (const char *domain,
                                                         IMAGE *im);
int                 im_check_noncomplex                 (const char *domain,
                                                         IMAGE *im);
int                 im_check_complex                    (const char *domain,
                                                         IMAGE *im);
int                 im_check_format                     (const char *domain,
                                                         IMAGE *im,
                                                         VipsBandFmt fmt);
int                 im_check_u8or16                     (const char *domain,
                                                         IMAGE *im);
int                 im_check_same_size                  (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);
int                 im_check_same_bands                 (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);
int                 im_check_same_format                (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);
int                 im_check_same_coding                (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);
int                 im_check_vector                     (const char *domain,
                                                         int n,
                                                         IMAGE *im);
gboolean            im_isuint                           (IMAGE *im);
gboolean            im_isint                            (IMAGE *im);
gboolean            im_isfloat                          (IMAGE *im);
gboolean            im_isscalar                         (IMAGE *im);
gboolean            im_iscomplex                        (IMAGE *im);
gboolean            im_isfile                           (IMAGE *im);
gboolean            im_ispartial                        (IMAGE *im);
gboolean            im_isMSBfirst                       (IMAGE *im);

Description

These functions perform simple checks on an IMAGE, or indicate that you intend to use an IMAGE in a certain way.

im_incheck(), im_pincheck() and friends indicate the image IO style you intend to use, transforming the underlying IMAGE structure if necessary.

im_check_mono() and friends and convenience functions that test an IMAGE for having various properties and signal an error if the condition is not met. They are useful for writing image processing operations which can only work on certain types of image.

Details

im_rwcheck ()

int                 im_rwcheck                          (IMAGE *im);

Gets an image ready for an in-place operation, such as im_insertplace(). Operations like this both read and write with IM_IMAGE_ADDR().

See also: im_insertplace(), im_incheck().

im :

image to make read-write

Returns :

0 on succeess, or -1 on error.

im_iocheck ()

int                 im_iocheck                          (IMAGE *in,
                                                         IMAGE *out);

A convenience function to check a pair of images for IO via IM_IMAGE_ADDR() and im_writeline().

See also: im_incheck(), im_outcheck().

in :

input image

out :

output image

Returns :

0 on succeess, or -1 on error.

im_incheck ()

int                 im_incheck                          (IMAGE *im);

Check that an image is readable via the IM_IMAGE_ADDR() macro. If it isn't, try to transform it so that IM_IMAGE_ADDR() can work.

See also: im_outcheck(), im_pincheck(), im_rwcheck(), IM_IMAGE_ADDR().

im :

image to check

Returns :

0 on succeess, or -1 on error.

im_outcheck ()

int                 im_outcheck                         (IMAGE *im);

Check that an image is writeable by im_writeline(). If it isn't, try to transform it so that im_writeline() can work.

Set the image properties (like size, type and so on), then call im_setupout(), then call im_writeline() for each scan line.

See also: im_incheck(), im_poutcheck().

im :

image to check

Returns :

0 on succeess, or -1 on error.

im_piocheck ()

int                 im_piocheck                         (IMAGE *in,
                                                         IMAGE *out);

A convenience function to check a pair of images for IO via im_prepare() and im_generate().

See also: im_pincheck(), im_poutcheck().

in :

input image

out :

output image

Returns :

0 on succeess, or -1 on error.

im_pincheck ()

int                 im_pincheck                         (IMAGE *im);

Check that an image is readable with im_prepare() and friends. If it isn't, try to transform the image so that im_prepare() can work.

See also: im_incheck(), im_poutcheck(), im_prepare().

im :

image to check

Returns :

0 on succeess, or -1 on error.

im_poutcheck ()

int                 im_poutcheck                        (IMAGE *im);

Check that an image is writeable with im_generate(). If it isn't, try to transform the image so that im_generate() can work.

See also: im_incheck(), im_poutcheck(), im_generate().

im :

image to check

Returns :

0 on succeess, or -1 on error.

im_check_uncoded ()

int                 im_check_uncoded                    (const char *domain,
                                                         IMAGE *im);

Check that the image is not coded. If not, set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

Returns :

0 on OK, or -1 on error.

im_check_known_coded ()

int                 im_check_known_coded                (const char *domain,
                                                         IMAGE *im);

Check that the image is uncoded, LABQ coded or RAD coded. If not, set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

Returns :

0 on OK, or -1 on error.

im_check_mono ()

int                 im_check_mono                       (const char *domain,
                                                         IMAGE *im);

Check that the image has exactly one band. Otherwise set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

Returns :

0 if OK, -1 otherwise.

im_check_bands ()

int                 im_check_bands                      (const char *domain,
                                                         IMAGE *im,
                                                         int bands);

Check that the image has bands bands. Otherwise set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

bands :

must have this many bands

Returns :

0 if OK, -1 otherwise.

im_check_bands_1orn ()

int                 im_check_bands_1orn                 (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);

Check that the images have the same number of bands, or that one of the images has just 1 band. If not, set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im1 :

first image to check

im2 :

second image to check

Returns :

0 on OK, or -1 on error.

im_check_int ()

int                 im_check_int                        (const char *domain,
                                                         IMAGE *im);

Check that the image is in one of the integer formats. Otherwise set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

Returns :

0 if OK, -1 otherwise.

im_check_noncomplex ()

int                 im_check_noncomplex                 (const char *domain,
                                                         IMAGE *im);

Check that the image is not complex. Otherwise set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

Returns :

0 if OK, -1 otherwise.

im_check_complex ()

int                 im_check_complex                    (const char *domain,
                                                         IMAGE *im);

Check that the image is complex. Otherwise set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

Returns :

0 if OK, -1 otherwise.

im_check_format ()

int                 im_check_format                     (const char *domain,
                                                         IMAGE *im,
                                                         VipsBandFmt fmt);

Check that the image has the specified format. Otherwise set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

fmt :

format to test for

Returns :

0 if OK, -1 otherwise.

im_check_u8or16 ()

int                 im_check_u8or16                     (const char *domain,
                                                         IMAGE *im);

Check that the image is 8 or 16-bit unsigned integer. Otherwise set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im :

image to check

Returns :

0 if OK, -1 otherwise.

im_check_same_size ()

int                 im_check_same_size                  (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);

Check that the images have the same size. If not, set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im1 :

first image to check

im2 :

second image to check

Returns :

0 if OK, -1 otherwise.

im_check_same_bands ()

int                 im_check_same_bands                 (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);

Check that the images have the same number of bands. If not, set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im1 :

first image to check

im2 :

second image to check

Returns :

0 if OK, -1 otherwise.

im_check_same_format ()

int                 im_check_same_format                (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);

Check that the images have the same format. If not, set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im1 :

first image to check

im2 :

second image to check

Returns :

0 if OK, -1 otherwise.

im_check_same_coding ()

int                 im_check_same_coding                (const char *domain,
                                                         IMAGE *im1,
                                                         IMAGE *im2);

Check that the images have the same coding. If not, set an error message and return non-zero.

See also: im_error().

domain :

the originating domain for the error message

im1 :

first image to check

im2 :

second image to check

Returns :

0 if OK, -1 otherwise.

im_check_vector ()

int                 im_check_vector                     (const char *domain,
                                                         int n,
                                                         IMAGE *im);

im_isuint ()

gboolean            im_isuint                           (IMAGE *im);

Return TRUE if im's VipsBandFmt is one of the unsigned integer types.

im :

image to test

im_isint ()

gboolean            im_isint                            (IMAGE *im);

Return TRUE if im's VipsBandFmt is one of the integer types.

im :

image to test

im_isfloat ()

gboolean            im_isfloat                          (IMAGE *im);

im_isscalar ()

gboolean            im_isscalar                         (IMAGE *im);

Return TRUE if im's VipsBandFmt is one of the non-complex types.

im :

image to test

im_iscomplex ()

gboolean            im_iscomplex                        (IMAGE *im);

Return TRUE if im's VipsBandFmt is one of the complex types.

im :

image to test

im_isfile ()

gboolean            im_isfile                           (IMAGE *im);

Return TRUE if im represents a file on disc in some way.

im :

image to test

im_ispartial ()

gboolean            im_ispartial                        (IMAGE *im);

Return TRUE if im represents a partial image (a delayed calculation).

im :

image to test

im_isMSBfirst ()

gboolean            im_isMSBfirst                       (IMAGE *im);

Return TRUE if im is in most-significant- byte first form. This is the byte order used on the SPARC architecture and others.

im :

image to test

See Also

image