@img/sharp-libvips-dev-wasm32 1.3.0-rc.1 → 1.3.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +23 -23
  2. package/include/aom/aom_codec.h +1 -1
  3. package/include/aom/aom_decoder.h +4 -0
  4. package/include/aom/aom_encoder.h +19 -8
  5. package/include/aom/aom_ext_ratectrl.h +664 -0
  6. package/include/aom/aom_image.h +93 -30
  7. package/include/aom/aom_tpl.h +99 -0
  8. package/include/aom/aomcx.h +89 -16
  9. package/include/aom/aomdx.h +12 -0
  10. package/include/expat.h +15 -3
  11. package/include/expat_config.h +6 -6
  12. package/include/expat_external.h +4 -4
  13. package/include/glib-2.0/gio/gdbusconnection.h +2 -8
  14. package/include/glib-2.0/gio/gfileattribute.h +1 -1
  15. package/include/glib-2.0/gio/gfileinfo.h +5 -0
  16. package/include/glib-2.0/gio/gicon.h +1 -1
  17. package/include/glib-2.0/gio/gio-autocleanups.h +0 -1
  18. package/include/glib-2.0/gio/gio-visibility.h +34 -0
  19. package/include/glib-2.0/gio/gio.h +2 -0
  20. package/include/glib-2.0/gio/gioenums.h +66 -44
  21. package/include/glib-2.0/gio/gioenumtypes.h +2 -0
  22. package/include/glib-2.0/gio/giptosmessage.h +46 -0
  23. package/include/glib-2.0/gio/gipv6tclassmessage.h +46 -0
  24. package/include/glib-2.0/gio/gresolver.h +1 -1
  25. package/include/glib-2.0/gio/gsettings.h +1 -1
  26. package/include/glib-2.0/gio/gsocketcontrolmessage.h +2 -0
  27. package/include/glib-2.0/glib/gatomic.h +26 -2
  28. package/include/glib-2.0/glib/gfileutils.h +2 -2
  29. package/include/glib-2.0/glib/ghook.h +3 -1
  30. package/include/glib-2.0/glib/giochannel.h +1 -1
  31. package/include/glib-2.0/glib/gkeyfile.h +1 -1
  32. package/include/glib-2.0/glib/glib-visibility.h +34 -0
  33. package/include/glib-2.0/glib/gmacros.h +32 -0
  34. package/include/glib-2.0/glib/gmain.h +4 -0
  35. package/include/glib-2.0/glib/gmarkup.h +18 -1
  36. package/include/glib-2.0/glib/gmem.h +4 -4
  37. package/include/glib-2.0/glib/gmessages.h +7 -9
  38. package/include/glib-2.0/glib/gnode.h +1 -1
  39. package/include/glib-2.0/glib/goption.h +1 -1
  40. package/include/glib-2.0/glib/gsequence.h +2 -2
  41. package/include/glib-2.0/glib/gslice.h +12 -4
  42. package/include/glib-2.0/glib/gspawn.h +1 -1
  43. package/include/glib-2.0/glib/gstrfuncs.h +191 -1
  44. package/include/glib-2.0/glib/gtestutils.h +6 -3
  45. package/include/glib-2.0/glib/gtimer.h +1 -0
  46. package/include/glib-2.0/glib/guri.h +3 -3
  47. package/include/glib-2.0/glib/gutils.h +10 -1
  48. package/include/glib-2.0/glib/gvarianttype.h +16 -16
  49. package/include/glib-2.0/glib/gversionmacros.h +22 -0
  50. package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
  51. package/include/glib-2.0/gmodule.h +1 -1
  52. package/include/glib-2.0/gobject/gbinding.h +1 -1
  53. package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
  54. package/include/glib-2.0/gobject/gobject.h +1 -1
  55. package/include/glib-2.0/gobject/gparam.h +1 -1
  56. package/include/glib-2.0/gobject/gsignal.h +8 -8
  57. package/include/glib-2.0/gobject/gtype.h +17 -17
  58. package/include/hwy/aligned_allocator.h +44 -2
  59. package/include/hwy/auto_tune.h +22 -6
  60. package/include/hwy/base.h +60 -90
  61. package/include/hwy/bit_set.h +410 -0
  62. package/include/hwy/cache_control.h +3 -2
  63. package/include/hwy/detect_compiler_arch.h +134 -14
  64. package/include/hwy/detect_targets.h +82 -36
  65. package/include/hwy/highway.h +15 -0
  66. package/include/hwy/nanobenchmark.h +12 -3
  67. package/include/hwy/ops/arm_neon-inl.h +96 -25
  68. package/include/hwy/ops/arm_sve-inl.h +250 -95
  69. package/include/hwy/ops/emu128-inl.h +12 -7
  70. package/include/hwy/ops/generic_ops-inl.h +271 -131
  71. package/include/hwy/ops/loongarch_lasx-inl.h +31 -9
  72. package/include/hwy/ops/loongarch_lsx-inl.h +33 -12
  73. package/include/hwy/ops/ppc_vsx-inl.h +99 -19
  74. package/include/hwy/ops/rvv-inl.h +239 -130
  75. package/include/hwy/ops/scalar-inl.h +22 -7
  76. package/include/hwy/ops/set_macros-inl.h +163 -107
  77. package/include/hwy/ops/wasm_128-inl.h +13 -22
  78. package/include/hwy/ops/x86_128-inl.h +223 -120
  79. package/include/hwy/ops/x86_256-inl.h +70 -134
  80. package/include/hwy/ops/x86_512-inl.h +130 -134
  81. package/include/hwy/print-inl.h +2 -0
  82. package/include/hwy/profiler.h +355 -264
  83. package/include/hwy/robust_statistics.h +3 -1
  84. package/include/hwy/timer.h +44 -0
  85. package/include/lcms2.h +35 -5
  86. package/include/lcms2_plugin.h +1 -1
  87. package/include/libexif/exif-utils.h +1 -1
  88. package/include/libheif/heif.h +2 -0
  89. package/include/libheif/heif_aux_images.h +2 -2
  90. package/include/libheif/heif_brands.h +16 -4
  91. package/include/libheif/heif_color.h +147 -25
  92. package/include/libheif/heif_components.h +264 -0
  93. package/include/libheif/heif_context.h +18 -4
  94. package/include/libheif/heif_cxx.h +20 -18
  95. package/include/libheif/heif_decoding.h +63 -9
  96. package/include/libheif/heif_encoding.h +46 -12
  97. package/include/libheif/heif_error.h +15 -6
  98. package/include/libheif/heif_export.h +48 -0
  99. package/include/libheif/heif_image.h +94 -32
  100. package/include/libheif/heif_image_handle.h +54 -3
  101. package/include/libheif/heif_items.h +25 -2
  102. package/include/libheif/heif_library.h +13 -18
  103. package/include/libheif/heif_metadata.h +5 -2
  104. package/include/libheif/heif_omaf.h +104 -0
  105. package/include/libheif/heif_plugin.h +80 -13
  106. package/include/libheif/heif_properties.h +259 -5
  107. package/include/libheif/heif_regions.h +5 -3
  108. package/include/libheif/heif_security.h +24 -2
  109. package/include/libheif/heif_sequences.h +163 -14
  110. package/include/libheif/heif_text.h +161 -0
  111. package/include/libheif/heif_tiling.h +2 -2
  112. package/include/libheif/heif_uncompressed.h +29 -5
  113. package/include/libheif/heif_version.h +2 -2
  114. package/include/libpng16/png.h +637 -488
  115. package/include/libpng16/pngconf.h +2 -2
  116. package/include/libpng16/pnglibconf.h +2 -2
  117. package/include/png.h +637 -488
  118. package/include/pngconf.h +2 -2
  119. package/include/pnglibconf.h +2 -2
  120. package/include/resvg.h +3 -3
  121. package/include/tiffconf.h +9 -10
  122. package/include/tiffio.h +10 -9
  123. package/include/tiffvers.h +1 -1
  124. package/include/ultrahdr_api.h +5 -11
  125. package/include/vips/colour.h +2 -2
  126. package/include/vips/memory.h +1 -1
  127. package/include/vips/version.h +4 -4
  128. package/include/zlib.h +3 -3
  129. package/lib/glib-2.0/include/glibconfig.h +1 -3
  130. package/lib/libaom.a +0 -0
  131. package/lib/libcgif.a +0 -0
  132. package/lib/libexif.a +0 -0
  133. package/lib/libexif.la +1 -1
  134. package/lib/libexpat.a +0 -0
  135. package/lib/libexpat.la +2 -2
  136. package/lib/libffi.a +0 -0
  137. package/lib/libgio-2.0.a +0 -0
  138. package/lib/libglib-2.0.a +0 -0
  139. package/lib/libgmodule-2.0.a +0 -0
  140. package/lib/libgobject-2.0.a +0 -0
  141. package/lib/libgthread-2.0.a +0 -0
  142. package/lib/libheif.a +0 -0
  143. package/lib/libhwy.a +0 -0
  144. package/lib/libimagequant.a +0 -0
  145. package/lib/libjpeg.a +0 -0
  146. package/lib/liblcms2.a +0 -0
  147. package/lib/libpng.a +0 -0
  148. package/lib/libpng.la +2 -2
  149. package/lib/libpng16.a +0 -0
  150. package/lib/libpng16.la +2 -2
  151. package/lib/libresvg.a +0 -0
  152. package/lib/libsharpyuv.a +0 -0
  153. package/lib/libtiff.a +0 -0
  154. package/lib/libuhdr.a +0 -0
  155. package/lib/libvips-cpp.a +0 -0
  156. package/lib/libvips.a +0 -0
  157. package/lib/libwebp.a +0 -0
  158. package/lib/libwebpdecoder.a +0 -0
  159. package/lib/libwebpdemux.a +0 -0
  160. package/lib/libwebpmux.a +0 -0
  161. package/lib/libz.a +0 -0
  162. package/lib/pkgconfig/aom.pc +2 -2
  163. package/lib/pkgconfig/cgif.pc +1 -1
  164. package/lib/pkgconfig/expat.pc +1 -1
  165. package/lib/pkgconfig/gio-2.0.pc +1 -1
  166. package/lib/pkgconfig/glib-2.0.pc +1 -1
  167. package/lib/pkgconfig/gmodule-2.0.pc +1 -1
  168. package/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
  169. package/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  170. package/lib/pkgconfig/gobject-2.0.pc +1 -1
  171. package/lib/pkgconfig/gthread-2.0.pc +1 -1
  172. package/lib/pkgconfig/lcms2.pc +1 -1
  173. package/lib/pkgconfig/libexif.pc +1 -1
  174. package/lib/pkgconfig/libheif.pc +1 -1
  175. package/lib/pkgconfig/libhwy.pc +3 -4
  176. package/lib/pkgconfig/libpng.pc +1 -1
  177. package/lib/pkgconfig/libpng16.pc +1 -1
  178. package/lib/pkgconfig/libsharpyuv.pc +1 -1
  179. package/lib/pkgconfig/libtiff-4.pc +2 -2
  180. package/lib/pkgconfig/libwebp.pc +1 -1
  181. package/lib/pkgconfig/libwebpdecoder.pc +11 -0
  182. package/lib/pkgconfig/libwebpmux.pc +1 -1
  183. package/lib/pkgconfig/vips-cpp.pc +1 -1
  184. package/lib/pkgconfig/vips.pc +1 -1
  185. package/package.json +1 -1
  186. package/versions.json +15 -15
  187. package/lib/libsharpyuv.la +0 -41
  188. package/lib/libtiff.la +0 -41
  189. package/lib/libwebp.la +0 -41
  190. package/lib/libwebpdemux.la +0 -41
  191. package/lib/libwebpmux.la +0 -41
@@ -34,10 +34,17 @@ extern "C" {
34
34
  #include <libheif/heif_brands.h>
35
35
  #include <libheif/heif_color.h>
36
36
 
37
+ // Forward declaration. The full definition lives in heif_uncompressed.h.
38
+ // heif_encoding_options only stores a pointer, so a forward typedef is enough here
39
+ // and avoids a circular include (heif_uncompressed.h pulls in heif.h, which pulls in this header).
40
+ typedef struct heif_unci_image_parameters heif_unci_image_parameters;
41
+
37
42
 
38
43
  // ----- encoder -----
39
44
 
40
- // The encoder used for actually encoding an image.
45
+ /**
46
+ * Opaque object that represents the encoder used to code the images.
47
+ */
41
48
  typedef struct heif_encoder heif_encoder;
42
49
 
43
50
  // A description of the encoder's capabilities and name.
@@ -53,7 +60,7 @@ typedef struct heif_encoder_parameter heif_encoder_parameter;
53
60
  // Note that the encoder may be limited to a certain subset of features (e.g. only 8 bit, only lossy).
54
61
  // You will have to query the specific capabilities further.
55
62
  LIBHEIF_API
56
- int heif_have_encoder_for_format(enum heif_compression_format format);
63
+ int heif_have_encoder_for_format(heif_compression_format format);
57
64
 
58
65
  // Get a list of available encoders. You can filter the encoders by compression format and name.
59
66
  // Use format_filter==heif_compression_undefined and name_filter==NULL as wildcards.
@@ -62,7 +69,7 @@ int heif_have_encoder_for_format(enum heif_compression_format format);
62
69
  // By setting out_encoders==nullptr, you can query the number of encoders, 'count' is ignored.
63
70
  // Note: to get the actual encoder from the descriptors returned here, use heif_context_get_encoder().
64
71
  LIBHEIF_API
65
- int heif_get_encoder_descriptors(enum heif_compression_format format_filter,
72
+ int heif_get_encoder_descriptors(heif_compression_format format_filter,
66
73
  const char* name_filter,
67
74
  const heif_encoder_descriptor** out_encoders,
68
75
  int count);
@@ -77,7 +84,7 @@ LIBHEIF_API
77
84
  const char* heif_encoder_descriptor_get_id_name(const heif_encoder_descriptor*);
78
85
 
79
86
  LIBHEIF_API
80
- enum heif_compression_format
87
+ heif_compression_format
81
88
  heif_encoder_descriptor_get_compression_format(const heif_encoder_descriptor*);
82
89
 
83
90
  LIBHEIF_API
@@ -97,10 +104,12 @@ heif_error heif_context_get_encoder(heif_context* context,
97
104
  // for this format, the encoder with the highest plugin priority will be returned.
98
105
  LIBHEIF_API
99
106
  heif_error heif_context_get_encoder_for_format(heif_context* context,
100
- enum heif_compression_format format,
107
+ heif_compression_format format,
101
108
  heif_encoder**);
102
109
 
103
- // You have to release the encoder after use.
110
+ /**
111
+ * Release the encoder object after use.
112
+ */
104
113
  LIBHEIF_API
105
114
  void heif_encoder_release(heif_encoder*);
106
115
 
@@ -142,12 +151,12 @@ LIBHEIF_API
142
151
  const char* heif_encoder_parameter_get_name(const heif_encoder_parameter*);
143
152
 
144
153
 
145
- enum heif_encoder_parameter_type
154
+ typedef enum heif_encoder_parameter_type
146
155
  {
147
156
  heif_encoder_parameter_type_integer = 1,
148
157
  heif_encoder_parameter_type_boolean = 2,
149
158
  heif_encoder_parameter_type_string = 3
150
- };
159
+ } heif_encoder_parameter_type;
151
160
 
152
161
  // Return the parameter type.
153
162
  LIBHEIF_API
@@ -252,7 +261,7 @@ int heif_encoder_has_default(heif_encoder*,
252
261
 
253
262
 
254
263
  // The orientation values are defined equal to the EXIF Orientation tag.
255
- enum heif_orientation
264
+ typedef enum heif_orientation
256
265
  {
257
266
  heif_orientation_normal = 1,
258
267
  heif_orientation_flip_horizontally = 2,
@@ -262,7 +271,11 @@ enum heif_orientation
262
271
  heif_orientation_rotate_90_cw = 6,
263
272
  heif_orientation_rotate_90_cw_then_flip_vertically = 7,
264
273
  heif_orientation_rotate_270_cw = 8
265
- };
274
+ } heif_orientation;
275
+
276
+
277
+ LIBHEIF_API
278
+ heif_orientation heif_orientation_concat(heif_orientation first, heif_orientation second);
266
279
 
267
280
 
268
281
  typedef struct heif_encoding_options
@@ -293,7 +306,7 @@ typedef struct heif_encoding_options
293
306
  // version 5 options
294
307
 
295
308
  // libheif will generate irot/imir boxes to match these orientations
296
- enum heif_orientation image_orientation;
309
+ heif_orientation image_orientation;
297
310
 
298
311
  // version 6 options
299
312
 
@@ -304,6 +317,14 @@ typedef struct heif_encoding_options
304
317
  // Set this to true to use compressed form of uncC where possible.
305
318
  uint8_t prefer_uncC_short_form;
306
319
 
320
+ // version 8 options
321
+
322
+ // Optional 'unci'-specific encoding parameters (compression method, and future fields
323
+ // such as interleave type and padding).
324
+ //
325
+ // Default: nullptr
326
+ const heif_unci_image_parameters* unci_parameters;
327
+
307
328
  // TODO: we should add a flag to force MIAF compatible outputs. E.g. this will put restrictions on grid tile sizes and
308
329
  // might add a clap box when the grid output size does not match the color subsampling factors.
309
330
  // Since some of these constraints have to be known before actually encoding the image, "forcing MIAF compatibility"
@@ -360,6 +381,19 @@ LIBHEIF_API
360
381
  void heif_context_add_compatible_brand(heif_context* ctx,
361
382
  heif_brand2 compatible_brand);
362
383
 
384
+ /**
385
+ * Enable the unified ID namespace ('unif' brand).
386
+ *
387
+ * When enabled, item IDs, track IDs, and entity group IDs share a single
388
+ * global counter so no ID value is reused across categories. The 'unif'
389
+ * compatible brand is automatically added to the output file.
390
+ *
391
+ * @param ctx the encoding context
392
+ * @param flag non-zero to enable, zero to disable
393
+ */
394
+ LIBHEIF_API
395
+ void heif_context_set_unif(heif_context* ctx, int flag);
396
+
363
397
  // --- deprecated functions ---
364
398
 
365
399
  // DEPRECATED, typo in function name
@@ -379,7 +413,7 @@ int heif_encoder_descriptor_supportes_lossless_compression(const heif_encoder_de
379
413
  // Note: to get the actual encoder from the descriptors returned here, use heif_context_get_encoder().
380
414
  LIBHEIF_API
381
415
  int heif_context_get_encoder_descriptors(heif_context*, // TODO: why do we need this parameter?
382
- enum heif_compression_format format_filter,
416
+ heif_compression_format format_filter,
383
417
  const char* name_filter,
384
418
  const heif_encoder_descriptor** out_encoders,
385
419
  int count);
@@ -28,8 +28,10 @@ extern "C" {
28
28
  #include <stddef.h>
29
29
  #include <stdint.h>
30
30
 
31
+ #include <libheif/heif_export.h>
31
32
 
32
- enum heif_error_code
33
+
34
+ typedef enum heif_error_code
33
35
  {
34
36
  // Everything ok, no error occurred.
35
37
  heif_error_Ok = 0,
@@ -71,10 +73,10 @@ enum heif_error_code
71
73
  heif_error_Canceled = 12,
72
74
 
73
75
  heif_error_End_of_sequence = 13
74
- };
76
+ } heif_error_code;
75
77
 
76
78
 
77
- enum heif_suberror_code
79
+ typedef enum heif_suberror_code
78
80
  {
79
81
  // no further information available
80
82
  heif_suberror_Unspecified = 0,
@@ -191,6 +193,11 @@ enum heif_suberror_code
191
193
 
192
194
  heif_suberror_No_moov_box = 151,
193
195
 
196
+ // The colr (NCLX) box and the codec bitstream VUI/color signalling disagree.
197
+ // Per ISO/IEC 14496-12 and ISO/IEC 23000-22 (MIAF) the colr box takes precedence,
198
+ // but the conflict is reported as a warning.
199
+ heif_suberror_NCLX_colr_VUI_mismatch = 152,
200
+
194
201
  // --- Memory_allocation_error ---
195
202
 
196
203
  // A security limit preventing unreasonable memory allocations was exceeded by the input file.
@@ -254,6 +261,8 @@ enum heif_suberror_code
254
261
 
255
262
  heif_suberror_Unsupported_essential_property = 3007,
256
263
 
264
+ heif_suberror_Unsupported_track_type = 3008,
265
+
257
266
  // --- Encoder_plugin_error ---
258
267
 
259
268
  heif_suberror_Unsupported_bit_depth = 4000,
@@ -276,16 +285,16 @@ enum heif_suberror_code
276
285
  heif_suberror_Plugin_is_not_loaded = 6001, // trying to remove a plugin that is not loaded
277
286
  heif_suberror_Cannot_read_plugin_directory = 6002, // error while scanning the directory for plugins
278
287
  heif_suberror_No_matching_decoder_installed = 6003 // no decoder found for that compression format
279
- };
288
+ } heif_suberror_code;
280
289
 
281
290
 
282
291
  typedef struct heif_error
283
292
  {
284
293
  // main error category
285
- enum heif_error_code code;
294
+ heif_error_code code;
286
295
 
287
296
  // more detailed error code
288
- enum heif_suberror_code subcode;
297
+ heif_suberror_code subcode;
289
298
 
290
299
  // textual error message (is always defined, you do not have to check for NULL)
291
300
  const char* message;
@@ -0,0 +1,48 @@
1
+ /*
2
+ * HEIF codec.
3
+ * Copyright (c) 2017-2026 Dirk Farin <dirk.farin@gmail.com>
4
+ *
5
+ * This file is part of libheif.
6
+ *
7
+ * libheif is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as
9
+ * published by the Free Software Foundation, either version 3 of
10
+ * the License, or (at your option) any later version.
11
+ *
12
+ * libheif 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
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with libheif. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+ #ifndef LIBHEIF_HEIF_EXPORT_H
22
+ #define LIBHEIF_HEIF_EXPORT_H
23
+
24
+ // LIBHEIF_API marks the symbols that are exported from the shared library.
25
+ //
26
+ // This macro lives in its own tiny, dependency-free header so that every
27
+ // public header can pull it in without creating include cycles. In particular,
28
+ // heif_library.h and heif_error.h are mutually dependent (heif_library.h needs
29
+ // the heif_error type while heif_error.h needs LIBHEIF_API), so the macro
30
+ // cannot live in either of them if both are to compile standalone.
31
+
32
+ #if (defined(_WIN32) || defined __CYGWIN__) && !defined(LIBHEIF_STATIC_BUILD)
33
+ #ifdef LIBHEIF_EXPORTS
34
+ #define LIBHEIF_API __declspec(dllexport)
35
+ #else
36
+ #define LIBHEIF_API __declspec(dllimport)
37
+ #endif
38
+ #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
39
+ #ifdef LIBHEIF_EXPORTS
40
+ #define LIBHEIF_API __attribute__((__visibility__("default")))
41
+ #else
42
+ #define LIBHEIF_API
43
+ #endif
44
+ #else
45
+ #define LIBHEIF_API
46
+ #endif
47
+
48
+ #endif // LIBHEIF_HEIF_EXPORT_H
@@ -31,10 +31,29 @@ extern "C" {
31
31
  #include <stdint.h>
32
32
 
33
33
 
34
- enum heif_chroma
34
+ // The heif_chroma enum describes pixel layout (planar vs interleaved, and any
35
+ // YUV chroma subsampling). It does NOT describe pixel semantics; the semantic
36
+ // interpretation of the planes comes from heif_colorspace.
37
+ //
38
+ // heif_chroma_planar covers "one or more planar components, no subsampling".
39
+ // It is used for:
40
+ // - heif_colorspace_monochrome (single luma plane)
41
+ // - heif_colorspace_filter_array (single CFA mosaic plane)
42
+ // - heif_colorspace_custom (any number of planar components)
43
+ // For heif_colorspace_RGB the historical name heif_chroma_444 is the
44
+ // canonical form for planar RGB. heif_chroma_planar is accepted as a
45
+ // synonym at the C API boundary and is internally canonicalized to
46
+ // heif_chroma_444 so existing callers and internal code paths keep seeing
47
+ // heif_chroma_444 on read-back. Callers should also accept a returned
48
+ // heif_chroma_planar as a synonym. We might switch to this as the
49
+ // canonical name in the future.
50
+ //
51
+ // The YUV subsampling names (heif_chroma_420 / _422 / _444) are kept for
52
+ // heif_colorspace_YCbCr.
53
+ typedef enum heif_chroma
35
54
  {
36
55
  heif_chroma_undefined = 99,
37
- heif_chroma_monochrome = 0,
56
+ heif_chroma_planar = 0,
38
57
  heif_chroma_420 = 1,
39
58
  heif_chroma_422 = 2,
40
59
  heif_chroma_444 = 3,
@@ -44,14 +63,19 @@ enum heif_chroma
44
63
  heif_chroma_interleaved_RRGGBBAA_BE = 13, // HDR, big endian.
45
64
  heif_chroma_interleaved_RRGGBB_LE = 14, // HDR, little endian.
46
65
  heif_chroma_interleaved_RRGGBBAA_LE = 15 // HDR, little endian.
47
- };
66
+ } heif_chroma;
48
67
 
49
68
  // DEPRECATED ENUM NAMES
50
69
  #define heif_chroma_interleaved_24bit heif_chroma_interleaved_RGB
51
70
  #define heif_chroma_interleaved_32bit heif_chroma_interleaved_RGBA
52
71
 
72
+ // Legacy alias for heif_chroma_planar. The name "monochrome" was misleading
73
+ // for non-grayscale planar layouts (filter_array, custom); use
74
+ // heif_chroma_planar in new code.
75
+ #define heif_chroma_monochrome heif_chroma_planar
53
76
 
54
- enum heif_colorspace
77
+
78
+ typedef enum heif_colorspace
55
79
  {
56
80
  heif_colorspace_undefined = 99,
57
81
 
@@ -63,6 +87,8 @@ enum heif_colorspace
63
87
 
64
88
  // heif_colorspace_RGB should be used with one of these heif_chroma values:
65
89
  // * heif_chroma_444 (for planar RGB)
90
+ // * heif_chroma_planar is accepted as a synonym and is internally canonicalized to heif_chroma_444.
91
+ // It is the preferred, future-proof value.
66
92
  // * heif_chroma_interleaved_RGB
67
93
  // * heif_chroma_interleaved_RGBA
68
94
  // * heif_chroma_interleaved_RRGGBB_BE
@@ -71,14 +97,22 @@ enum heif_colorspace
71
97
  // * heif_chroma_interleaved_RRGGBBAA_LE
72
98
  heif_colorspace_RGB = 1,
73
99
 
74
- // heif_colorspace_monochrome should only be used with heif_chroma = heif_chroma_monochrome
100
+ // heif_colorspace_monochrome should only be used with heif_chroma = heif_chroma_planar.
75
101
  heif_colorspace_monochrome = 2,
76
102
 
77
- // Indicates that this image has no visual channels.
78
- heif_colorspace_nonvisual = 3
79
- };
103
+ // Indicates that this image has a special, custom arrangement of components.
104
+ // For example, it can have several monochrome channels or just a depth component with no color image.
105
+ // Images of this type are always planar and use heif_chroma_planar.
106
+ heif_colorspace_custom = 3,
107
+
108
+ // Images of this type are filter-array (CFA / Bayer) mosaics. The single
109
+ // mosaicked plane is described as heif_chroma_planar.
110
+ heif_colorspace_filter_array = 4
111
+ } heif_colorspace;
112
+
113
+ #define heif_colorspace_nonvisual heif_colorspace_custom
80
114
 
81
- enum heif_channel
115
+ typedef enum heif_channel
82
116
  {
83
117
  heif_channel_Y = 0,
84
118
  heif_channel_Cb = 1,
@@ -90,9 +124,9 @@ enum heif_channel
90
124
  heif_channel_interleaved = 10,
91
125
  heif_channel_filter_array = 11,
92
126
  heif_channel_depth = 12,
93
- heif_channel_disparity = 13
94
- };
95
-
127
+ heif_channel_disparity = 13,
128
+ heif_channel_unknown = 65535
129
+ } heif_channel;
96
130
 
97
131
  // An heif_image contains a decoded pixel image in various colorspaces, chroma formats,
98
132
  // and bit depths.
@@ -102,6 +136,9 @@ enum heif_channel
102
136
  // containing the interleaved R,G,B values.
103
137
 
104
138
  // Planar RGB images are specified as heif_colorspace_RGB / heif_chroma_444.
139
+ // heif_chroma_planar is accepted as a synonym and is internally canonicalized
140
+ // to heif_chroma_444 so heif_image_get_chroma_format() always returns
141
+ // heif_chroma_444 for planar RGB.
105
142
 
106
143
  typedef struct heif_image heif_image;
107
144
  typedef struct heif_image_handle heif_image_handle;
@@ -110,11 +147,11 @@ typedef struct heif_security_limits heif_security_limits;
110
147
 
111
148
  // Get the colorspace format of the image.
112
149
  LIBHEIF_API
113
- enum heif_colorspace heif_image_get_colorspace(const heif_image*);
150
+ heif_colorspace heif_image_get_colorspace(const heif_image*);
114
151
 
115
152
  // Get the chroma format of the image.
116
153
  LIBHEIF_API
117
- enum heif_chroma heif_image_get_chroma_format(const heif_image*);
154
+ heif_chroma heif_image_get_chroma_format(const heif_image*);
118
155
 
119
156
  /**
120
157
  * Get the width of a specified image channel.
@@ -124,7 +161,7 @@ enum heif_chroma heif_image_get_chroma_format(const heif_image*);
124
161
  * @return the width of the channel in pixels, or -1 the channel does not exist in the image
125
162
  */
126
163
  LIBHEIF_API
127
- int heif_image_get_width(const heif_image* img, enum heif_channel channel);
164
+ int heif_image_get_width(const heif_image* img, heif_channel channel);
128
165
 
129
166
  /**
130
167
  * Get the height of a specified image channel.
@@ -134,12 +171,13 @@ int heif_image_get_width(const heif_image* img, enum heif_channel channel);
134
171
  * @return the height of the channel in pixels, or -1 the channel does not exist in the image
135
172
  */
136
173
  LIBHEIF_API
137
- int heif_image_get_height(const heif_image* img, enum heif_channel channel);
174
+ int heif_image_get_height(const heif_image* img, heif_channel channel);
138
175
 
139
176
  /**
140
- * Get the width of the main channel.
177
+ * Get the logical width of the image.
141
178
  *
142
- * This is the Y channel in YCbCr or mono, or any in RGB.
179
+ * For well-formed images this equals the size of the main channel (the Y channel
180
+ * in YCbCr or mono, or the RGB channels). Subsampled chroma channels may be smaller.
143
181
  *
144
182
  * @param img the image to get the primary width for
145
183
  * @return the width in pixels
@@ -148,9 +186,10 @@ LIBHEIF_API
148
186
  int heif_image_get_primary_width(const heif_image* img);
149
187
 
150
188
  /**
151
- * Get the height of the main channel.
189
+ * Get the logical height of the image.
152
190
  *
153
- * This is the Y channel in YCbCr or mono, or any in RGB.
191
+ * For well-formed images this equals the size of the main channel (the Y channel
192
+ * in YCbCr or mono, or the RGB channels). Subsampled chroma channels may be smaller.
154
193
  *
155
194
  * @param img the image to get the primary height for
156
195
  * @return the height in pixels
@@ -158,6 +197,27 @@ int heif_image_get_primary_width(const heif_image* img);
158
197
  LIBHEIF_API
159
198
  int heif_image_get_primary_height(const heif_image* img);
160
199
 
200
+ /**
201
+ * Crop the image in place by removing margins from each edge.
202
+ *
203
+ * The four parameters specify the number of pixels to remove from each side,
204
+ * not absolute pixel coordinates. For example, to crop a 100x100 image down
205
+ * to its central 80x80 region, pass `left=10, right=10, top=10, bottom=10`.
206
+ * Passing all zeros leaves the image unchanged.
207
+ *
208
+ * The resulting image has dimensions `(w - left - right) x (h - top - bottom)`,
209
+ * which must be at least 1x1. All four values must be non-negative and the
210
+ * sums `left + right` and `top + bottom` must each be strictly less than the
211
+ * corresponding image dimension; otherwise `heif_error_Usage_error` /
212
+ * `heif_suberror_Invalid_parameter_value` is returned and the image is left
213
+ * unchanged.
214
+ *
215
+ * @param img the image to crop (modified in place on success)
216
+ * @param left number of pixels to remove from the left edge
217
+ * @param right number of pixels to remove from the right edge
218
+ * @param top number of pixels to remove from the top edge
219
+ * @param bottom number of pixels to remove from the bottom edge
220
+ */
161
221
  LIBHEIF_API
162
222
  heif_error heif_image_crop(heif_image* img,
163
223
  int left, int right, int top, int bottom);
@@ -175,7 +235,7 @@ heif_error heif_image_extract_area(const heif_image*,
175
235
  // Especially for HDR images, this is probably not what you want. Have a look at
176
236
  // heif_image_get_bits_per_pixel_range() instead.
177
237
  LIBHEIF_API
178
- int heif_image_get_bits_per_pixel(const heif_image*, enum heif_channel channel);
238
+ int heif_image_get_bits_per_pixel(const heif_image*, heif_channel channel);
179
239
 
180
240
  // Get the number of bits per pixel in the given image channel. This function returns
181
241
  // the number of bits used for representing the pixel value, which might be smaller
@@ -184,10 +244,10 @@ int heif_image_get_bits_per_pixel(const heif_image*, enum heif_channel channel);
184
244
  // are reserved for storage. For interleaved RGBA with 12 bit, this function also returns
185
245
  // '12', not '48' or '64' (heif_image_get_bits_per_pixel returns 64 in this case).
186
246
  LIBHEIF_API
187
- int heif_image_get_bits_per_pixel_range(const heif_image*, enum heif_channel channel);
247
+ int heif_image_get_bits_per_pixel_range(const heif_image*, heif_channel channel);
188
248
 
189
249
  LIBHEIF_API
190
- int heif_image_has_channel(const heif_image*, enum heif_channel channel);
250
+ int heif_image_has_channel(const heif_image*, heif_channel channel);
191
251
 
192
252
  // Get a pointer to the actual pixel data.
193
253
  // The 'out_stride' is returned as "bytes per line".
@@ -196,27 +256,27 @@ int heif_image_has_channel(const heif_image*, enum heif_channel channel);
196
256
  // Deprecated, use the safer version heif_image_get_plane_readonly2() instead.
197
257
  LIBHEIF_API
198
258
  const uint8_t* heif_image_get_plane_readonly(const heif_image*,
199
- enum heif_channel channel,
259
+ heif_channel channel,
200
260
  int* out_stride);
201
261
 
202
262
  // Deprecated, use the safer version heif_image_get_plane2() instead.
203
263
  LIBHEIF_API
204
264
  uint8_t* heif_image_get_plane(heif_image*,
205
- enum heif_channel channel,
265
+ heif_channel channel,
206
266
  int* out_stride);
207
267
 
208
268
  // These are safer variants of the two functions above.
209
269
  // The 'stride' parameter is often multiplied by the image height in the client application.
210
270
  // For very large images, this can lead to integer overflows and, consequently, illegal memory accesses.
211
- // The changed 'stride' parameter types eliminates this common error.
271
+ // The changed 'stride' parameter type eliminates this common error.
212
272
  LIBHEIF_API
213
273
  const uint8_t* heif_image_get_plane_readonly2(const heif_image*,
214
- enum heif_channel channel,
274
+ heif_channel channel,
215
275
  size_t* out_stride);
216
276
 
217
277
  LIBHEIF_API
218
278
  uint8_t* heif_image_get_plane2(heif_image*,
219
- enum heif_channel channel,
279
+ heif_channel channel,
220
280
  size_t* out_stride);
221
281
 
222
282
 
@@ -262,6 +322,8 @@ void heif_image_get_pixel_aspect_ratio(const heif_image*, uint32_t* aspect_h, ui
262
322
  LIBHEIF_API
263
323
  void heif_image_set_pixel_aspect_ratio(heif_image*, uint32_t aspect_h, uint32_t aspect_v);
264
324
 
325
+ LIBHEIF_API
326
+ void heif_image_handle_set_pixel_aspect_ratio(heif_image_handle*, uint32_t aspect_h, uint32_t aspect_v);
265
327
 
266
328
  // --- heif_image allocation
267
329
 
@@ -280,8 +342,8 @@ void heif_image_set_pixel_aspect_ratio(heif_image*, uint32_t aspect_h, uint32_t
280
342
  */
281
343
  LIBHEIF_API
282
344
  heif_error heif_image_create(int width, int height,
283
- enum heif_colorspace colorspace,
284
- enum heif_chroma chroma,
345
+ heif_colorspace colorspace,
346
+ heif_chroma chroma,
285
347
  heif_image** out_image);
286
348
 
287
349
  /**
@@ -314,7 +376,7 @@ heif_error heif_image_create(int width, int height,
314
376
  */
315
377
  LIBHEIF_API
316
378
  heif_error heif_image_add_plane(heif_image* image,
317
- enum heif_channel channel,
379
+ heif_channel channel,
318
380
  int width, int height, int bit_depth);
319
381
 
320
382
  /*
@@ -323,7 +385,7 @@ heif_error heif_image_add_plane(heif_image* image,
323
385
  */
324
386
  LIBHEIF_API
325
387
  heif_error heif_image_add_plane_safe(heif_image* image,
326
- enum heif_channel channel,
388
+ heif_channel channel,
327
389
  int width, int height, int bit_depth,
328
390
  const heif_security_limits* limits);
329
391
 
@@ -53,10 +53,17 @@ int heif_image_handle_is_primary_image(const heif_image_handle* handle);
53
53
  LIBHEIF_API
54
54
  heif_item_id heif_image_handle_get_item_id(const heif_image_handle* handle);
55
55
 
56
- // Get the resolution of an image.
56
+ /** Get the image width.
57
+ *
58
+ * If 'handle' is invalid (NULL) or if the image size exceeds the range of `int`, 0 is returned.
59
+ */
57
60
  LIBHEIF_API
58
61
  int heif_image_handle_get_width(const heif_image_handle* handle);
59
62
 
63
+ /** Get the image height.
64
+ *
65
+ * If 'handle' is invalid (NULL) or if the image size exceeds the range of `int`, 0 is returned.
66
+ */
60
67
  LIBHEIF_API
61
68
  int heif_image_handle_get_height(const heif_image_handle* handle);
62
69
 
@@ -84,8 +91,8 @@ int heif_image_handle_get_chroma_bits_per_pixel(const heif_image_handle*);
84
91
  // You can still request the output in your preferred colorspace, but this may involve an internal conversion.
85
92
  LIBHEIF_API
86
93
  heif_error heif_image_handle_get_preferred_decoding_colorspace(const heif_image_handle* image_handle,
87
- enum heif_colorspace* out_colorspace,
88
- enum heif_chroma* out_chroma);
94
+ heif_colorspace* out_colorspace,
95
+ heif_chroma* out_chroma);
89
96
 
90
97
  // Get the image width from the 'ispe' box. This is the original image size without
91
98
  // any transformations applied to it. Do not use this unless you know exactly what
@@ -112,6 +119,50 @@ int heif_image_handle_get_pixel_aspect_ratio(const heif_image_handle*, uint32_t*
112
119
  LIBHEIF_API
113
120
  heif_context* heif_image_handle_get_context(const heif_image_handle* handle);
114
121
 
122
+ LIBHEIF_API
123
+ const char* heif_image_handle_get_gimi_content_id(const heif_image_handle* handle);
124
+
125
+ LIBHEIF_API
126
+ void heif_image_handle_set_gimi_content_id(heif_image_handle* handle, const char* content_id);
127
+
128
+
129
+ // --- cmpd component queries
130
+
131
+ // Returns the number of components in the cmpd box, or 0 if no cmpd property exists.
132
+ LIBHEIF_API
133
+ uint32_t heif_image_handle_get_number_of_cmpd_components(const heif_image_handle*);
134
+
135
+ // Returns the component_type for the given cmpd component index.
136
+ // Returns 0 if out of range or no cmpd property.
137
+ LIBHEIF_API
138
+ uint16_t heif_image_handle_get_cmpd_component_type(const heif_image_handle*, uint32_t component_idx);
139
+
140
+ // Returns the component_type_uri for the given cmpd component index (component_type >= 0x8000).
141
+ // Returns NULL if the component does not have a URI.
142
+ // The returned string must be freed with heif_string_release().
143
+ LIBHEIF_API
144
+ const char* heif_image_handle_get_cmpd_component_type_uri(const heif_image_handle*, uint32_t component_idx);
145
+
146
+
147
+ // --- GIMI component content IDs (handle-level)
148
+
149
+ // Returns non-zero (count of content IDs) if an ItemComponentContentIDProperty is set, 0 otherwise.
150
+ LIBHEIF_API
151
+ int heif_image_handle_has_gimi_component_content_ids(const heif_image_handle*);
152
+
153
+ // Returns the GIMI component content ID for the given component index.
154
+ // Returns NULL if no ItemComponentContentIDProperty is set or index is out of range.
155
+ // The returned string must be freed with heif_string_release().
156
+ LIBHEIF_API
157
+ const char* heif_image_handle_get_gimi_component_content_id(const heif_image_handle*, uint32_t component_idx);
158
+
159
+ // Set a GIMI component content ID for a single component.
160
+ // If an ItemComponentContentIDProperty does not yet exist, one will be created.
161
+ // The content IDs array is resized as needed (new entries default to empty).
162
+ LIBHEIF_API
163
+ void heif_image_handle_set_gimi_component_content_id(heif_image_handle*,
164
+ uint32_t component_idx,
165
+ const char* content_id);
115
166
 
116
167
  #ifdef __cplusplus
117
168
  }
@@ -21,7 +21,9 @@
21
21
  #ifndef LIBHEIF_HEIF_ITEMS_H
22
22
  #define LIBHEIF_HEIF_ITEMS_H
23
23
 
24
- #include "libheif/heif.h"
24
+ #include "heif_library.h"
25
+ #include "heif_error.h"
26
+ #include "heif_metadata.h"
25
27
 
26
28
  #ifdef __cplusplus
27
29
  extern "C" {
@@ -59,7 +61,7 @@ int heif_context_get_list_of_item_IDs(const heif_context* ctx,
59
61
  * Gets the item type.
60
62
  *
61
63
  * Usually, this is a four character code (e.g. `mime` or `uri `), but it can theoretically be
62
- * any 4-byte number. Thus, the type is returned as an integer. You can use {@link heif_fourcc} to map
64
+ * any 4-byte number. Thus, the type is returned as an integer. You can use #heif_fourcc to map
63
65
  * between the two representations.
64
66
  *
65
67
  * @param ctx the file context
@@ -167,6 +169,27 @@ LIBHEIF_API
167
169
  void heif_release_item_data(const heif_context* ctx, uint8_t** item_data);
168
170
 
169
171
 
172
+ // ------------------------- item language -------------------------
173
+
174
+ /**
175
+ * Get the extended language associated with the item.
176
+ * The item is usually a text item.
177
+ *
178
+ * @param context the heif file context containg the item.
179
+ * @param itemId the identifier for the item
180
+ * @param out_language output parameter with the item's language. Free with heif_string_release().
181
+ * @return heif_error_ok on success, or an error value indicating the problem
182
+ */
183
+ LIBHEIF_API
184
+ heif_error heif_item_get_property_extended_language(const heif_context* context,
185
+ heif_item_id itemId,
186
+ char** out_language);
187
+
188
+ LIBHEIF_API
189
+ heif_error heif_item_set_property_extended_language(heif_context* context,
190
+ heif_item_id item_id,
191
+ const char* language, heif_property_id* out_optional_propertyId);
192
+
170
193
  // ------------------------- item references -------------------------
171
194
 
172
195
  /**