header.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /* image header funcs
  2. *
  3. * 20/9/09
  4. * - from proto.h
  5. */
  6. /*
  7. This file is part of VIPS.
  8. VIPS is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU Lesser General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU Lesser General Public License for more details.
  16. You should have received a copy of the GNU Lesser General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19. 02110-1301 USA
  20. */
  21. /*
  22. These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
  23. */
  24. #ifndef VIPS_HEADER_H
  25. #define VIPS_HEADER_H
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif /*__cplusplus*/
  29. /**
  30. * VIPS_META_EXIF_NAME:
  31. *
  32. * The name that JPEG read and write operations use for the image's EXIF data.
  33. */
  34. #define VIPS_META_EXIF_NAME "exif-data"
  35. /**
  36. * VIPS_META_XMP_NAME:
  37. *
  38. * The name that read and write operations use for the image's XMP data.
  39. */
  40. #define VIPS_META_XMP_NAME "xmp-data"
  41. /**
  42. * VIPS_META_IPTC_NAME:
  43. *
  44. * The name that read and write operations use for the image's IPTC data.
  45. */
  46. #define VIPS_META_IPTC_NAME "iptc-data"
  47. /**
  48. * VIPS_META_PHOTOSHOP_NAME:
  49. *
  50. * The name that TIFF read and write operations use for the image's
  51. * TIFFTAG_PHOTOSHOP data.
  52. */
  53. #define VIPS_META_PHOTOSHOP_NAME "photoshop-data"
  54. /**
  55. * VIPS_META_ICC_NAME:
  56. *
  57. * The name we use to attach an ICC profile. The file read and write
  58. * operations for TIFF, JPEG, PNG and others use this item of metadata to
  59. * attach and save ICC profiles. The profile is updated by the
  60. * vips_icc_transform() operations.
  61. */
  62. #define VIPS_META_ICC_NAME "icc-profile-data"
  63. /**
  64. * VIPS_META_IMAGEDESCRIPTION:
  65. *
  66. * The IMAGEDESCRIPTION tag. Often has useful metadata.
  67. */
  68. #define VIPS_META_IMAGEDESCRIPTION "image-description"
  69. /**
  70. * VIPS_META_RESOLUTION_UNIT:
  71. *
  72. * The JPEG and TIFF read and write operations use this to record the
  73. * file's preferred unit for resolution.
  74. */
  75. #define VIPS_META_RESOLUTION_UNIT "resolution-unit"
  76. /**
  77. * VIPS_META_LOADER:
  78. *
  79. * Record the name of the original loader here. Handy for hinting file formats
  80. * and for debugging.
  81. */
  82. #define VIPS_META_LOADER "vips-loader"
  83. /**
  84. * VIPS_META_SEQUENTIAL:
  85. *
  86. * Images loaded via vips_sequential() have this int field defined. Some
  87. * operations (eg. vips_shrinkv()) add extra caches if they see it on their
  88. * input.
  89. */
  90. #define VIPS_META_SEQUENTIAL "vips-sequential"
  91. /**
  92. * VIPS_META_ORIENTATION:
  93. *
  94. * The orientation tag for this image. An int from 1 - 8 using the standard
  95. * exif/tiff meanings.
  96. *
  97. * * 1 - The 0th row represents the visual top of the image, and the 0th column
  98. * represents the visual left-hand side.
  99. * * 2 - The 0th row represents the visual top of the image, and the 0th column
  100. * represents the visual right-hand side.
  101. * * 3 - The 0th row represents the visual bottom of the image, and the 0th
  102. * column represents the visual right-hand side.
  103. * * 4 - The 0th row represents the visual bottom of the image, and the 0th
  104. * column represents the visual left-hand side.
  105. * * 5 - The 0th row represents the visual left-hand side of the image, and the
  106. * 0th column represents the visual top.
  107. * * 6 - The 0th row represents the visual right-hand side of the image, and the
  108. * 0th column represents the visual top.
  109. * * 7 - The 0th row represents the visual right-hand side of the image, and the
  110. * 0th column represents the visual bottom.
  111. * * 8 - The 0th row represents the visual left-hand side of the image, and the
  112. * 0th column represents the visual bottom.
  113. */
  114. #define VIPS_META_ORIENTATION "orientation"
  115. /**
  116. * VIPS_META_PAGE_HEIGHT:
  117. *
  118. * If set, the height of each page when this image was loaded. If you save an
  119. * image with "page-height" set to a format that supports multiple pages, such
  120. * as tiff, the image will be saved as a series of pages.
  121. */
  122. #define VIPS_META_PAGE_HEIGHT "page-height"
  123. /**
  124. * VIPS_META_N_PAGES:
  125. *
  126. * If set, the number of pages in the original file.
  127. */
  128. #define VIPS_META_N_PAGES "n-pages"
  129. guint64 vips_format_sizeof( VipsBandFormat format );
  130. guint64 vips_format_sizeof_unsafe( VipsBandFormat format );
  131. int vips_image_get_width( const VipsImage *image );
  132. int vips_image_get_height( const VipsImage *image );
  133. int vips_image_get_bands( const VipsImage *image );
  134. VipsBandFormat vips_image_get_format( const VipsImage *image );
  135. VipsBandFormat vips_image_guess_format( const VipsImage *image );
  136. VipsCoding vips_image_get_coding( const VipsImage *image );
  137. VipsInterpretation vips_image_get_interpretation( const VipsImage *image );
  138. VipsInterpretation vips_image_guess_interpretation( const VipsImage *image );
  139. double vips_image_get_xres( const VipsImage *image );
  140. double vips_image_get_yres( const VipsImage *image );
  141. int vips_image_get_xoffset( const VipsImage *image );
  142. int vips_image_get_yoffset( const VipsImage *image );
  143. const char *vips_image_get_filename( const VipsImage *image );
  144. const char *vips_image_get_mode( const VipsImage *image );
  145. double vips_image_get_scale( const VipsImage *image );
  146. double vips_image_get_offset( const VipsImage *image );
  147. int vips_image_get_page_height( VipsImage *image );
  148. int vips_image_get_n_pages( VipsImage *image );
  149. const void *vips_image_get_data( VipsImage *image );
  150. void vips_image_init_fields( VipsImage *image,
  151. int xsize, int ysize, int bands,
  152. VipsBandFormat format, VipsCoding coding,
  153. VipsInterpretation interpretation,
  154. double xres, double yres );
  155. void vips_image_set( VipsImage *image, const char *name, GValue *value );
  156. int vips_image_get( const VipsImage *image,
  157. const char *name, GValue *value_copy );
  158. int vips_image_get_as_string( const VipsImage *image,
  159. const char *name, char **out );
  160. GType vips_image_get_typeof( const VipsImage *image, const char *name );
  161. gboolean vips_image_remove( VipsImage *image, const char *name );
  162. typedef void *(*VipsImageMapFn)( VipsImage *image,
  163. const char *name, GValue *value, void *a );
  164. void *vips_image_map( VipsImage *image, VipsImageMapFn fn, void *a );
  165. gchar **vips_image_get_fields( VipsImage *image );
  166. void vips_image_set_area( VipsImage *image,
  167. const char *name, VipsCallbackFn free_fn, void *data );
  168. int vips_image_get_area( const VipsImage *image,
  169. const char *name, const void **data );
  170. void vips_image_set_blob( VipsImage *image,
  171. const char *name,
  172. VipsCallbackFn free_fn, const void *data, size_t length );
  173. void vips_image_set_blob_copy( VipsImage *image,
  174. const char *name, const void *data, size_t length );
  175. int vips_image_get_blob( const VipsImage *image,
  176. const char *name, const void **data, size_t *length );
  177. int vips_image_get_int( const VipsImage *image, const char *name, int *out );
  178. void vips_image_set_int( VipsImage *image, const char *name, int i );
  179. int vips_image_get_double( const VipsImage *image,
  180. const char *name, double *out );
  181. void vips_image_set_double( VipsImage *image, const char *name, double d );
  182. int vips_image_get_string( const VipsImage *image,
  183. const char *name, const char **out );
  184. void vips_image_set_string( VipsImage *image,
  185. const char *name, const char *str );
  186. void vips_image_print_field( const VipsImage *image, const char *field );
  187. int vips_image_get_image( const VipsImage *image,
  188. const char *name, VipsImage **out );
  189. void vips_image_set_image( VipsImage *image, const char *name, VipsImage *im );
  190. void vips_image_set_array_int( VipsImage *image, const char *name,
  191. const int *array, int n );
  192. int vips_image_get_array_int( VipsImage *image, const char *name,
  193. int **out, int *n );
  194. int vips_image_history_printf( VipsImage *image, const char *format, ... )
  195. __attribute__((format(printf, 2, 3)));
  196. int vips_image_history_args( VipsImage *image,
  197. const char *name, int argc, char *argv[] );
  198. const char *vips_image_get_history( VipsImage *image );
  199. #ifdef __cplusplus
  200. }
  201. #endif /*__cplusplus*/
  202. #endif /*VIPS_HEADER_H*/