util: libvips Reference Manual

## util util |

## Functions

#define | VIPS_RAD()
#define | VIPS_DEG()
#define | VIPS_MAX()
#define | VIPS_MIN()
#define | VIPS_CLIP()
#define | VIPS_FCLIP()
#define | VIPS_NUMBER()
#define | VIPS_ABS()
#define | VIPS_ISNAN()
#define | VIPS_FLOOR()
#define | VIPS_CEIL()
#define | VIPS_RINT()
#define | VIPS_ROUND()
#define | VIPS_FABS()
#define | VIPS_FMAX()
#define | VIPS_FMIN()
#define | VIPS_ONCE()
#define | VIPS_ROUND_INT()
#define | VIPS_ROUND_UINT()
#define | VIPS_ROUND_DOWN()
#define | VIPS_ROUND_UP()
#define | VIPS_SWAP()
#define | VIPS_UNROLL()
#define | g_info()
#define | VIPS_CLIP_UCHAR()
#define | VIPS_CLIP_CHAR()
#define | VIPS_CLIP_USHORT()
#define | VIPS_CLIP_SHORT()
#define | VIPS_CLIP_UINT()
#define | VIPS_CLIP_NONE()
const char * | vips_enum_string ()
const char * | vips_enum_nick ()
int | vips_enum_from_nick ()
int | vips_flags_from_nick ()
gboolean | vips_slist_equal ()
void * | vips_slist_map2 ()
void * | vips_slist_map2_rev ()
void * | vips_slist_map4 ()
void * | vips_slist_fold2 ()
GSList * | vips_slist_filter ()
void | vips_slist_free_all ()
void * | vips_map_equal ()
void * | vips_hash_table_map ()
char * | vips_strncpy ()
char * | vips_strrstr ()
gboolean | vips_ispostfix ()
gboolean | vips_iscasepostfix ()
gboolean | vips_isprefix ()
char * | vips_break_token ()
void | vips__chomp ()
int | vips_vsnprintf ()
int | vips_snprintf ()
int | vips_filename_suffix_match ()
gint64 | vips_file_length ()
int | vips__write ()
int | vips__open ()
int | vips__open_read ()
FILE * | vips__fopen ()
FILE * | vips__file_open_read ()
FILE * | vips__file_open_write ()
char * | vips__file_read ()
char * | vips__file_read_name ()
int | vips__file_write ()
gint64 | vips__get_bytes ()
int | vips__fgetc ()
GValue * | vips__gvalue_ref_string_new ()
void | vips__gslist_gvalue_free ()
GSList * | vips__gslist_gvalue_copy ()
GSList * | vips__gslist_gvalue_merge ()
char * | vips__gslist_gvalue_get ()
gint64 | vips__seek_no_error ()
gint64 | vips__seek ()
int | vips__ftruncate ()
int | vips_existsf ()
int | vips_isdirf ()
int | vips_mkdirf ()
int | vips_rmdirf ()
int | vips_rename ()
const char * | vips__token_get ()
const char * | vips__token_must ()
const char * | vips__token_need ()
const char * | vips__token_segment ()
const char * | vips__token_segment_need ()
const char * | vips__find_rightmost_brackets ()
void | vips__filename_split8 ()
int | vips_ispoweroftwo ()
int | vips_amiMSBfirst ()
char * | vips__temp_name ()
void | vips__change_suffix ()
char * | vips_realpath ()
guint32 | vips__random ()
guint32 | vips__random_add ()
const char * | vips__icc_dir ()
const char * | vips__windows_prefix ()
char * | vips__get_iso8601 ()
int | vips_strtod ()

## Types and Values

#define | VIPS_PI
#define | VIPS_PATH_MAX
enum | VipsToken

## Description

## Functions

### VIPS_RAD()

    #define VIPS_RAD( R ) (((R) / 360.0) * 2.0 * VIPS_PI)

### VIPS_DEG()

    #define VIPS_DEG( A ) (((A) / (2.0 * VIPS_PI)) * 360.0)

### VIPS_MAX()

    #define VIPS_MAX( A, B ) ((A) > (B) ? (A) : (B))

### VIPS_MIN()

    #define VIPS_MIN( A, B ) ((A) < (B) ? (A) : (B))

### VIPS_CLIP()

    #define VIPS_CLIP( A, V, B ) VIPS_MAX( (A), VIPS_MIN( (B), (V) ) )

### VIPS_FCLIP()

    #define VIPS_FCLIP( A, V, B ) VIPS_FMAX( (A), VIPS_FMIN( (B), (V) ) )

### VIPS_NUMBER()

    #define VIPS_NUMBER( R ) ((int) (sizeof(R) / sizeof(R[0])))

### VIPS_ABS()

    #define VIPS_ABS( X ) (((X) >= 0) ? (X) : -(X))

### VIPS_ISNAN()

    #define VIPS_ISNAN( V ) __builtin_isnan( V )

### VIPS_FLOOR()

    #define VIPS_FLOOR( V ) __builtin_floor( V )

### VIPS_CEIL()

    #define VIPS_CEIL( V ) __builtin_ceil( V )

### VIPS_RINT()

    #define VIPS_RINT( V ) __builtin_rint( V )

### VIPS_ROUND()

    #define VIPS_ROUND( V ) __builtin_round( V )

### VIPS_FABS()

    #define VIPS_FABS( V ) __builtin_fabs( V )

### VIPS_FMAX()

    #define VIPS_FMAX( A, B ) __builtin_fmax( A, B )

### VIPS_FMIN()

    #define VIPS_FMIN( A, B ) __builtin_fmin( A, B )

### VIPS_ONCE()

    #define             VIPS_ONCE( ONCE, FUNC, CLIENT )

### VIPS_ROUND_INT()

    #define VIPS_ROUND_INT( R ) ((int) ((R) > 0 ? ((R) + 0.5) : ((R) - 0.5)))

### VIPS_ROUND_UINT()

    #define VIPS_ROUND_UINT( R ) ((int) ((R) + 0.5))

### VIPS_ROUND_DOWN()

    #define VIPS_ROUND_DOWN( N, P ) ((N) - ((N) % (P)))

### VIPS_ROUND_UP()

    #define VIPS_ROUND_UP( N, P ) (VIPS_ROUND_DOWN( (N) + (P) - 1, (P) ))

### VIPS_SWAP()

    #define             VIPS_SWAP( TYPE, A, B )

### VIPS_UNROLL()

    #define             VIPS_UNROLL( N, OPER )

### g_info()

    #define             g_info(...)

### VIPS_CLIP_UCHAR()

    #define             VIPS_CLIP_UCHAR( V, SEQ )

### VIPS_CLIP_CHAR()

    #define             VIPS_CLIP_CHAR( V, SEQ )

### VIPS_CLIP_USHORT()

    #define             VIPS_CLIP_USHORT( V, SEQ )

### VIPS_CLIP_SHORT()

    #define             VIPS_CLIP_SHORT( V, SEQ )

### VIPS_CLIP_UINT()

    #define             VIPS_CLIP_UINT( V, SEQ )

### VIPS_CLIP_NONE()

    #define VIPS_CLIP_NONE( V, SEQ ) {}

### vips_enum_string ()

    const char *
    vips_enum_string (GType enm,
                      int value);

### vips_enum_nick ()

    const char *
    vips_enum_nick (GType enm,
                    int value);

### vips_enum_from_nick ()

    int
    vips_enum_from_nick (const char *domain,
                         GType type,
                         const char *str);

### vips_flags_from_nick ()

    int
    vips_flags_from_nick (const char *domain,
                          GType type,
                          const char *nick);

### vips_slist_equal ()

    gboolean
    vips_slist_equal (GSList *l1,
                      GSList *l2);

### vips_slist_map2 ()

    void *
    vips_slist_map2 (GSList *list,
                     VipsSListMap2Fn fn,
                     void *a,
                     void *b);

### vips_slist_map2_rev ()

    void *
    vips_slist_map2_rev (GSList *list,
                         VipsSListMap2Fn fn,
                         void *a,
                         void *b);

### vips_slist_map4 ()

    void *
    vips_slist_map4 (GSList *list,
                     VipsSListMap4Fn fn,
                     void *a,
                     void *b,
                     void *c,
                     void *d);

### vips_slist_fold2 ()

    void *
    vips_slist_fold2 (GSList *list,
                      void *start,
                      VipsSListFold2Fn fn,
                      void *a,
                      void *b);

### vips_slist_filter ()

    GSList *
    vips_slist_filter (GSList *list,
                       VipsSListMap2Fn fn,
                       void *a,
                       void *b);

### vips_slist_free_all ()

    void
    vips_slist_free_all (GSList *list);

### vips_map_equal ()

    void *
    vips_map_equal (void *a,
                    void *b);

### vips_hash_table_map ()

    void *
    vips_hash_table_map (GHashTable *hash,
                         VipsSListMap2Fn fn,
                         void *a,
                         void *b);

### vips_strncpy ()

    char *
    vips_strncpy (char *dest,
                  const char *src,
                  int n);

### vips_strrstr ()

    char *
    vips_strrstr (const char *haystack,
                  const char *needle);

### vips_ispostfix ()

    gboolean
    vips_ispostfix (const char *a,
                    const char *b);

### vips_iscasepostfix ()

    gboolean
    vips_iscasepostfix (const char *a,
                        const char *b);

### vips_isprefix ()

    gboolean
    vips_isprefix (const char *a,
                   const char *b);

### vips_break_token ()

    char *
    vips_break_token (char *str,
                      const char *brk);

### vips__chomp ()

    void
    vips__chomp (char *str);

### vips_vsnprintf ()

    int
    vips_vsnprintf (char *str,
                    size_t size,
                    const char *format,
                    va_list ap);

### vips_snprintf ()

    int
    vips_snprintf (char *str,
                   size_t size,
                   const char *format,
                   ...);

### vips_filename_suffix_match ()

    int
    vips_filename_suffix_match (const char *path,
                                const char *suffixes[]);

### vips_file_length ()

    gint64
    vips_file_length (int fd);

### vips__write ()

    int
    vips__write (int fd,
                 const void *buf,
                 size_t count);

### vips__open ()

    int
    vips__open (const char *filename,
                int flags,
                int mode);

### vips__open_read ()

    int
    vips__open_read (const char *filename);

### vips__fopen ()

    FILE *
    vips__fopen (const char *filename,
                 const char *mode);

### vips__file_open_read ()

    FILE *
    vips__file_open_read (const char *filename,
                          const char *fallback_dir,
                          gboolean text_mode);

### vips__file_open_write ()

    FILE *
    vips__file_open_write (const char *filename,
                           gboolean text_mode);

### vips__file_read ()

    char *
    vips__file_read (FILE *fp,
                     const char *name,
                     size_t *length_out);

### vips__file_read_name ()

    char *
    vips__file_read_name (const char *name,
                          const char *fallback_dir,
                          size_t *length_out);

### vips__file_write ()

    int
    vips__file_write (void *data,
                      size_t size,
                      size_t nmemb,
                      FILE *stream);

### vips__get_bytes ()

    gint64
    vips__get_bytes (const char *filename,
                     unsigned char buf[],
                     gint64 len);

### vips__fgetc ()

    int
    vips__fgetc (FILE *fp);

### vips__gvalue_ref_string_new ()

    GValue *
    vips__gvalue_ref_string_new (const char *text);

### vips__gslist_gvalue_free ()

    void
    vips__gslist_gvalue_free (GSList *list);

### vips__gslist_gvalue_copy ()

    GSList *
    vips__gslist_gvalue_copy (const GSList *list);

### vips__gslist_gvalue_merge ()

    GSList *
    vips__gslist_gvalue_merge (GSList *a,
                               const GSList *b);

### vips__gslist_gvalue_get ()

    char *
    vips__gslist_gvalue_get (const GSList *list);

### vips__seek_no_error ()

    gint64
    vips__seek_no_error (int fd,
                         gint64 pos,
                         int whence);

### vips__seek ()

    gint64
    vips__seek (int fd,
                gint64 pos,
                int whence);

### vips__ftruncate ()

    int
    vips__ftruncate (int fd,
                     gint64 pos);

### vips_existsf ()

    int
    vips_existsf (const char *name,
                  ...);

### vips_isdirf ()

    int
    vips_isdirf (const char *name,
                 ...);

### vips_mkdirf ()

    int
    vips_mkdirf (const char *name,
                 ...);

### vips_rmdirf ()

    int
    vips_rmdirf (const char *name,
                 ...);

### vips_rename ()

    int
    vips_rename (const char *old_name,
                 const char *new_name);

### vips__token_get ()

    const char *
    vips__token_get (const char *buffer,
                     VipsToken *token,
                     char *string,
                     int size);

### vips__token_must ()

    const char *
    vips__token_must (const char *buffer,
                      VipsToken *token,
                      char *string,
                      int size);

### vips__token_need ()

    const char *
    vips__token_need (const char *buffer,
                      VipsToken need_token,
                      char *string,
                      int size);

### vips__token_segment ()

    const char *
    vips__token_segment (const char *p,
                         VipsToken *token,
                         char *string,
                         int size);

### vips__token_segment_need ()

    const char *
    vips__token_segment_need (const char *p,
                              VipsToken need_token,
                              char *string,
                              int size);

### vips__find_rightmost_brackets ()

    const char *
    vips__find_rightmost_brackets (const char *p);

### vips__filename_split8 ()

    void
    vips__filename_split8 (const char *name,
                           char *filename,
                           char *option_string);

### vips_ispoweroftwo ()

    int
    vips_ispoweroftwo (int p);

### vips_amiMSBfirst ()

    int
    vips_amiMSBfirst (void);

### vips__temp_name ()

    char *
    vips__temp_name (const char *format);

### vips__change_suffix ()

    void
    vips__change_suffix (const char *name,
                         char *out,
                         int mx,
                         const char *new_suff,
                         const char **olds,
                         int nolds);

### vips_realpath ()

    char *
    vips_realpath (const char *path);

### vips__random ()

    guint32
    vips__random (guint32 seed);

### vips__random_add ()

    guint32
    vips__random_add (guint32 seed,
                      int value);

### vips__icc_dir ()

    const char *
    vips__icc_dir (void);

### vips__windows_prefix ()

    const char *
    vips__windows_prefix (void);

### vips__get_iso8601 ()

    char *
    vips__get_iso8601 (void);

### vips_strtod ()

    int
    vips_strtod (const char *str,
                 double *out);

## Types and Values

### VIPS_PI

    #define VIPS_PI (3.14159265358979323846)

### VIPS_PATH_MAX

    #define VIPS_PATH_MAX (4096)

### enum VipsToken

Tokens returned by the vips lexical analyzer, see `vips__token_get()`. This is used to parse option strings for arguments.

Left and right brackets can be any of (, {, [, <.

Strings may be in double quotes, and may contain escaped quote characters, for example string, "string" and "str\"ing".

#### Members

VIPS_TOKEN_LEFT | left bracket |
VIPS_TOKEN_RIGHT | right bracket |
VIPS_TOKEN_STRING | string constant |
VIPS_TOKEN_EQUALS | equals sign |
VIPS_TOKEN_COMMA | comma |