@img/sharp-libvips-dev 1.2.0-rc.3 → 1.2.0

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 (38) hide show
  1. package/include/fontconfig/fontconfig.h +12 -2
  2. package/include/glib-2.0/girepository/girepository.h +3 -0
  3. package/include/glib-2.0/glib/gmarkup.h +4 -0
  4. package/include/libheif/heif.h +16 -2603
  5. package/include/libheif/heif_aux_images.h +182 -0
  6. package/include/libheif/heif_brands.h +373 -0
  7. package/include/libheif/heif_color.h +357 -0
  8. package/include/libheif/heif_context.h +329 -0
  9. package/include/libheif/heif_cxx.h +6 -6
  10. package/include/libheif/heif_decoding.h +162 -0
  11. package/include/libheif/heif_encoding.h +391 -0
  12. package/include/libheif/heif_entity_groups.h +60 -0
  13. package/include/libheif/heif_error.h +302 -0
  14. package/include/libheif/heif_image.h +352 -0
  15. package/include/libheif/heif_image_handle.h +120 -0
  16. package/include/libheif/heif_items.h +45 -45
  17. package/include/libheif/heif_library.h +216 -0
  18. package/include/libheif/heif_metadata.h +133 -0
  19. package/include/libheif/heif_plugin.h +53 -41
  20. package/include/libheif/heif_properties.h +73 -36
  21. package/include/libheif/heif_regions.h +95 -95
  22. package/include/libheif/heif_security.h +102 -0
  23. package/include/libheif/heif_sequences.h +577 -0
  24. package/include/libheif/heif_tai_timestamps.h +202 -0
  25. package/include/libheif/heif_tiling.h +137 -0
  26. package/include/libheif/heif_uncompressed.h +109 -0
  27. package/include/libheif/heif_version.h +2 -2
  28. package/include/libpng16/png.h +7 -7
  29. package/include/libpng16/pngconf.h +1 -1
  30. package/include/libpng16/pnglibconf.h +1 -1
  31. package/include/pango-1.0/pango/pango-attributes.h +1 -1
  32. package/include/pango-1.0/pango/pango-features.h +2 -2
  33. package/include/png.h +7 -7
  34. package/include/pngconf.h +1 -1
  35. package/include/pnglibconf.h +1 -1
  36. package/include/vips/version.h +4 -4
  37. package/package.json +1 -1
  38. package/versions.json +5 -5
@@ -0,0 +1,120 @@
1
+ /*
2
+ * HEIF codec.
3
+ * Copyright (c) 2017-2025 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_IMAGE_HANDLE_H
22
+ #define LIBHEIF_HEIF_IMAGE_HANDLE_H
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+
28
+ #include <stddef.h>
29
+ #include <stdint.h>
30
+
31
+ #include <libheif/heif_library.h>
32
+ #include <libheif/heif_image.h>
33
+
34
+
35
+ // ========================= heif_image_handle =========================
36
+
37
+ // An heif_image_handle is a handle to a logical image in the HEIF file.
38
+ // To get the actual pixel data, you have to decode the handle to an heif_image.
39
+ // An heif_image_handle also gives you access to the thumbnails and Exif data
40
+ // associated with an image.
41
+
42
+ // Once you obtained an heif_image_handle, you can already release the heif_context,
43
+ // since it is internally ref-counted.
44
+
45
+ // Release image handle.
46
+ LIBHEIF_API
47
+ void heif_image_handle_release(const heif_image_handle*);
48
+
49
+ // Check whether the given image_handle is the primary image of the file.
50
+ LIBHEIF_API
51
+ int heif_image_handle_is_primary_image(const heif_image_handle* handle);
52
+
53
+ LIBHEIF_API
54
+ heif_item_id heif_image_handle_get_item_id(const heif_image_handle* handle);
55
+
56
+ // Get the resolution of an image.
57
+ LIBHEIF_API
58
+ int heif_image_handle_get_width(const heif_image_handle* handle);
59
+
60
+ LIBHEIF_API
61
+ int heif_image_handle_get_height(const heif_image_handle* handle);
62
+
63
+ LIBHEIF_API
64
+ int heif_image_handle_has_alpha_channel(const heif_image_handle*);
65
+
66
+ LIBHEIF_API
67
+ int heif_image_handle_is_premultiplied_alpha(const heif_image_handle*);
68
+
69
+ // Returns -1 on error, e.g. if this information is not present in the image.
70
+ // Only defined for images coded in the YCbCr or monochrome colorspace.
71
+ LIBHEIF_API
72
+ int heif_image_handle_get_luma_bits_per_pixel(const heif_image_handle*);
73
+
74
+ // Returns -1 on error, e.g. if this information is not present in the image.
75
+ // Only defined for images coded in the YCbCr colorspace.
76
+ LIBHEIF_API
77
+ int heif_image_handle_get_chroma_bits_per_pixel(const heif_image_handle*);
78
+
79
+ // Return the colorspace that libheif proposes to use for decoding.
80
+ // Usually, these will be either YCbCr or Monochrome, but it may also propose RGB for images
81
+ // encoded with matrix_coefficients=0 or for images coded natively in RGB.
82
+ // It may also return *_undefined if the file misses relevant information to determine this without decoding.
83
+ // These are only proposed values that avoid colorspace conversions as much as possible.
84
+ // You can still request the output in your preferred colorspace, but this may involve an internal conversion.
85
+ LIBHEIF_API
86
+ 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);
89
+
90
+ // Get the image width from the 'ispe' box. This is the original image size without
91
+ // any transformations applied to it. Do not use this unless you know exactly what
92
+ // you are doing.
93
+ LIBHEIF_API
94
+ int heif_image_handle_get_ispe_width(const heif_image_handle* handle);
95
+
96
+ LIBHEIF_API
97
+ int heif_image_handle_get_ispe_height(const heif_image_handle* handle);
98
+
99
+ // Returns whether the image has 'pixel aspect ratio information' information. If 0 is returned, the output is filled with the 1:1 default.
100
+ LIBHEIF_API
101
+ int heif_image_handle_get_pixel_aspect_ratio(const heif_image_handle*, uint32_t* aspect_h, uint32_t* aspect_v);
102
+
103
+
104
+ // This gets the context associated with the image handle.
105
+ // Note that you have to release the returned context with heif_context_free() in any case.
106
+ //
107
+ // This means: when you have several image-handles that originate from the same file and you get the
108
+ // context of each of them, the returned pointer may be different even though it refers to the same
109
+ // logical context. You have to call heif_context_free() on all those context pointers.
110
+ // After you freed a context pointer, you can still use the context through a different pointer that you
111
+ // might have acquired from elsewhere.
112
+ LIBHEIF_API
113
+ heif_context* heif_image_handle_get_context(const heif_image_handle* handle);
114
+
115
+
116
+ #ifdef __cplusplus
117
+ }
118
+ #endif
119
+
120
+ #endif
@@ -38,7 +38,7 @@ extern "C" {
38
38
  * @return the number of items
39
39
  */
40
40
  LIBHEIF_API
41
- int heif_context_get_number_of_items(const struct heif_context* ctx);
41
+ int heif_context_get_number_of_items(const heif_context* ctx);
42
42
 
43
43
  /**
44
44
  * Get the item identifiers.
@@ -51,7 +51,7 @@ int heif_context_get_number_of_items(const struct heif_context* ctx);
51
51
  * @return the total number of IDs filled into the array, which may be less than {@code count}.
52
52
  */
53
53
  LIBHEIF_API
54
- int heif_context_get_list_of_item_IDs(const struct heif_context* ctx,
54
+ int heif_context_get_list_of_item_IDs(const heif_context* ctx,
55
55
  heif_item_id* ID_array,
56
56
  int count);
57
57
 
@@ -67,13 +67,13 @@ int heif_context_get_list_of_item_IDs(const struct heif_context* ctx,
67
67
  * @return the item type
68
68
  */
69
69
  LIBHEIF_API
70
- uint32_t heif_item_get_item_type(const struct heif_context* ctx, heif_item_id item_id);
70
+ uint32_t heif_item_get_item_type(const heif_context* ctx, heif_item_id item_id);
71
71
 
72
72
  #define heif_item_type_mime heif_fourcc('m','i','m','e')
73
73
  #define heif_item_type_uri heif_fourcc('u','r','i',' ')
74
74
 
75
75
  LIBHEIF_API
76
- int heif_item_is_item_hidden(const struct heif_context* ctx, heif_item_id item_id);
76
+ int heif_item_is_item_hidden(const heif_context* ctx, heif_item_id item_id);
77
77
 
78
78
 
79
79
  /**
@@ -87,7 +87,7 @@ int heif_item_is_item_hidden(const struct heif_context* ctx, heif_item_id item_i
87
87
  * @return the item content_type
88
88
  */
89
89
  LIBHEIF_API
90
- const char* heif_item_get_mime_item_content_type(const struct heif_context* ctx, heif_item_id item_id);
90
+ const char* heif_item_get_mime_item_content_type(const heif_context* ctx, heif_item_id item_id);
91
91
 
92
92
  /**
93
93
  * Gets the content_encoding for a MIME item.
@@ -102,7 +102,7 @@ const char* heif_item_get_mime_item_content_type(const struct heif_context* ctx,
102
102
  * @return the item content_type
103
103
  */
104
104
  LIBHEIF_API
105
- const char* heif_item_get_mime_item_content_encoding(const struct heif_context* ctx, heif_item_id item_id);
105
+ const char* heif_item_get_mime_item_content_encoding(const heif_context* ctx, heif_item_id item_id);
106
106
 
107
107
  /**
108
108
  * Gets the item_uri_type for an item.
@@ -115,15 +115,15 @@ const char* heif_item_get_mime_item_content_encoding(const struct heif_context*
115
115
  * @return the item item_uri_type
116
116
  */
117
117
  LIBHEIF_API
118
- const char* heif_item_get_uri_item_uri_type(const struct heif_context* ctx, heif_item_id item_id);
118
+ const char* heif_item_get_uri_item_uri_type(const heif_context* ctx, heif_item_id item_id);
119
119
 
120
120
  LIBHEIF_API
121
- const char* heif_item_get_item_name(const struct heif_context* ctx, heif_item_id item_id);
121
+ const char* heif_item_get_item_name(const heif_context* ctx, heif_item_id item_id);
122
122
 
123
123
  LIBHEIF_API
124
- struct heif_error heif_item_set_item_name(struct heif_context* ctx,
125
- heif_item_id item,
126
- const char* item_name);
124
+ heif_error heif_item_set_item_name(heif_context* ctx,
125
+ heif_item_id item,
126
+ const char* item_name);
127
127
 
128
128
 
129
129
  /**
@@ -149,10 +149,10 @@ struct heif_error heif_item_set_item_name(struct heif_context* ctx,
149
149
  * @return whether the call succeeded, or there was an error
150
150
  */
151
151
  LIBHEIF_API
152
- struct heif_error heif_item_get_item_data(const struct heif_context* ctx,
153
- heif_item_id item_id,
154
- enum heif_metadata_compression* out_compression_format,
155
- uint8_t** out_data, size_t* out_data_size);
152
+ heif_error heif_item_get_item_data(const heif_context* ctx,
153
+ heif_item_id item_id,
154
+ enum heif_metadata_compression* out_compression_format,
155
+ uint8_t** out_data, size_t* out_data_size);
156
156
 
157
157
  /**
158
158
  * Free the item data.
@@ -164,7 +164,7 @@ struct heif_error heif_item_get_item_data(const struct heif_context* ctx,
164
164
  * @param item_data the data to free
165
165
  */
166
166
  LIBHEIF_API
167
- void heif_release_item_data(const struct heif_context* ctx, uint8_t** item_data);
167
+ void heif_release_item_data(const heif_context* ctx, uint8_t** item_data);
168
168
 
169
169
 
170
170
  // ------------------------- item references -------------------------
@@ -180,55 +180,55 @@ void heif_release_item_data(const struct heif_context* ctx, uint8_t** item_data)
180
180
  * @return the number of items that reference the given item. Returns 0 if the index exceeds the number of references.
181
181
  */
182
182
  LIBHEIF_API
183
- size_t heif_context_get_item_references(const struct heif_context* ctx,
183
+ size_t heif_context_get_item_references(const heif_context* ctx,
184
184
  heif_item_id from_item_id,
185
185
  int index,
186
186
  uint32_t* out_reference_type_4cc,
187
187
  heif_item_id** out_references_to);
188
188
 
189
189
  LIBHEIF_API
190
- void heif_release_item_references(const struct heif_context* ctx, heif_item_id** references);
190
+ void heif_release_item_references(const heif_context* ctx, heif_item_id** references);
191
191
 
192
192
  LIBHEIF_API
193
- struct heif_error heif_context_add_item_reference(struct heif_context* ctx,
194
- uint32_t reference_type,
195
- heif_item_id from_item,
196
- heif_item_id to_item);
193
+ heif_error heif_context_add_item_reference(heif_context* ctx,
194
+ uint32_t reference_type,
195
+ heif_item_id from_item,
196
+ heif_item_id to_item);
197
197
 
198
198
  LIBHEIF_API
199
- struct heif_error heif_context_add_item_references(struct heif_context* ctx,
200
- uint32_t reference_type,
201
- heif_item_id from_item,
202
- const heif_item_id* to_item,
203
- int num_to_items);
199
+ heif_error heif_context_add_item_references(heif_context* ctx,
200
+ uint32_t reference_type,
201
+ heif_item_id from_item,
202
+ const heif_item_id* to_item,
203
+ int num_to_items);
204
204
 
205
205
  // ------------------------- adding new items -------------------------
206
206
 
207
207
  LIBHEIF_API
208
- struct heif_error heif_context_add_item(struct heif_context* ctx,
209
- const char* item_type,
210
- const void* data, int size,
211
- heif_item_id* out_item_id);
208
+ heif_error heif_context_add_item(heif_context* ctx,
209
+ const char* item_type,
210
+ const void* data, int size,
211
+ heif_item_id* out_item_id);
212
212
 
213
213
  LIBHEIF_API
214
- struct heif_error heif_context_add_mime_item(struct heif_context* ctx,
215
- const char* content_type,
216
- enum heif_metadata_compression content_encoding,
217
- const void* data, int size,
218
- heif_item_id* out_item_id);
214
+ heif_error heif_context_add_mime_item(heif_context* ctx,
215
+ const char* content_type,
216
+ enum heif_metadata_compression content_encoding,
217
+ const void* data, int size,
218
+ heif_item_id* out_item_id);
219
219
 
220
220
  LIBHEIF_API
221
- struct heif_error heif_context_add_precompressed_mime_item(struct heif_context* ctx,
222
- const char* content_type,
223
- const char* content_encoding,
224
- const void* data, int size,
225
- heif_item_id* out_item_id);
221
+ heif_error heif_context_add_precompressed_mime_item(heif_context* ctx,
222
+ const char* content_type,
223
+ const char* content_encoding,
224
+ const void* data, int size,
225
+ heif_item_id* out_item_id);
226
226
 
227
227
  LIBHEIF_API
228
- struct heif_error heif_context_add_uri_item(struct heif_context* ctx,
229
- const char* item_uri_type,
230
- const void* data, int size,
231
- heif_item_id* out_item_id);
228
+ heif_error heif_context_add_uri_item(heif_context* ctx,
229
+ const char* item_uri_type,
230
+ const void* data, int size,
231
+ heif_item_id* out_item_id);
232
232
 
233
233
  #ifdef __cplusplus
234
234
  }
@@ -0,0 +1,216 @@
1
+ /*
2
+ * HEIF codec.
3
+ * Copyright (c) 2017-2023 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_LIBRARY_H
22
+ #define LIBHEIF_HEIF_LIBRARY_H
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+
28
+ #include <stddef.h>
29
+ #include <stdint.h>
30
+
31
+
32
+ // API versions table
33
+ //
34
+ // release dec.options enc.options heif_reader heif_writer depth.rep col.profile
35
+ // ------------------------------------------------------------------------------------------
36
+ // 1.0 1 N/A N/A N/A 1 N/A
37
+ // 1.1 1 N/A N/A 1 1 N/A
38
+ // 1.3 1 1 1 1 1 N/A
39
+ // 1.4 1 1 1 1 1 1
40
+ // 1.7 2 1 1 1 1 1
41
+ // 1.9.2 2 2 1 1 1 1
42
+ // 1.10 2 3 1 1 1 1
43
+ // 1.11 2 4 1 1 1 1
44
+ // 1.13 3 4 1 1 1 1
45
+ // 1.14 3 5 1 1 1 1
46
+ // 1.15 4 5 1 1 1 1
47
+ // 1.16 5 6 1 1 1 1
48
+ // 1.18 5 7 1 1 1 1
49
+ // 1.19 6 7 2 1 1 1
50
+ // 1.20 7 7 2 1 1 1
51
+
52
+ #if (defined(_WIN32) || defined __CYGWIN__) && !defined(LIBHEIF_STATIC_BUILD)
53
+ #ifdef LIBHEIF_EXPORTS
54
+ #define LIBHEIF_API __declspec(dllexport)
55
+ #else
56
+ #define LIBHEIF_API __declspec(dllimport)
57
+ #endif
58
+ #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
59
+ #ifdef LIBHEIF_EXPORTS
60
+ #define LIBHEIF_API __attribute__((__visibility__("default")))
61
+ #else
62
+ #define LIBHEIF_API
63
+ #endif
64
+ #else
65
+ #define LIBHEIF_API
66
+ #endif
67
+
68
+ #define heif_fourcc(a, b, c, d) ((uint32_t)((a<<24) | (b<<16) | (c<<8) | d))
69
+
70
+ #include <libheif/heif_version.h>
71
+ #include <libheif/heif_error.h>
72
+
73
+
74
+ /* === version numbers === */
75
+
76
+ // Version string of linked libheif library.
77
+ LIBHEIF_API const char* heif_get_version(void);
78
+
79
+ // Numeric version of linked libheif library, encoded as 0xHHMMLL00 = hh.mm.ll, where hh, mm, ll is the decimal representation of HH, MM, LL.
80
+ // For example: 0x02150300 is version 2.21.3
81
+ LIBHEIF_API uint32_t heif_get_version_number(void);
82
+
83
+ // Numeric part "HH" from above. Returned as a decimal number.
84
+ LIBHEIF_API int heif_get_version_number_major(void);
85
+ // Numeric part "MM" from above. Returned as a decimal number.
86
+ LIBHEIF_API int heif_get_version_number_minor(void);
87
+ // Numeric part "LL" from above. Returned as a decimal number.
88
+ LIBHEIF_API int heif_get_version_number_maintenance(void);
89
+
90
+ // Helper macros to check for given versions of libheif at compile time.
91
+ #define LIBHEIF_MAKE_VERSION(h, m, l) ((h) << 24 | (m) << 16 | (l) << 8)
92
+ #define LIBHEIF_HAVE_VERSION(h, m, l) (LIBHEIF_NUMERIC_VERSION >= LIBHEIF_MAKE_VERSION(h, m, l))
93
+
94
+ typedef struct heif_context heif_context;
95
+ typedef struct heif_image_handle heif_image_handle;
96
+
97
+ typedef uint32_t heif_item_id;
98
+ typedef uint32_t heif_property_id;
99
+
100
+ /**
101
+ * Free a string returned by libheif in various API functions.
102
+ * You may pass NULL.
103
+ */
104
+ LIBHEIF_API
105
+ void heif_string_release(const char*);
106
+
107
+
108
+ // ========================= library initialization ======================
109
+
110
+ typedef struct heif_init_params
111
+ {
112
+ int version;
113
+
114
+ // currently no parameters
115
+ } heif_init_params;
116
+
117
+
118
+ /**
119
+ * Initialise library.
120
+ *
121
+ * You should call heif_init() when you start using libheif and heif_deinit() when you are finished.
122
+ * These calls are reference counted. Each call to heif_init() should be matched by one call to heif_deinit().
123
+ *
124
+ * For backwards compatibility, it is not really necessary to call heif_init(), but some library memory objects
125
+ * will never be freed if you do not call heif_init()/heif_deinit().
126
+ *
127
+ * heif_init() will load the external modules installed in the default plugin path. Thus, you need it when you
128
+ * want to load external plugins from the default path.
129
+ * Codec plugins that are compiled into the library directly (selected by the compile-time parameters of libheif)
130
+ * will be available even without heif_init().
131
+ *
132
+ * Make sure that you do not have one part of your program use heif_init()/heif_deinit() and another part that does
133
+ * not use it as the latter may try to use an uninitialized library. If in doubt, enclose everything with init/deinit.
134
+ *
135
+ * You may pass nullptr to get default parameters. Currently, no parameters are supported.
136
+ */
137
+ LIBHEIF_API
138
+ heif_error heif_init(heif_init_params*);
139
+
140
+ /**
141
+ * Deinitialise and clean up library.
142
+ *
143
+ * You should call heif_init() when you start using libheif and heif_deinit() when you are finished.
144
+ * These calls are reference counted. Each call to heif_init() should be matched by one call to heif_deinit().
145
+ *
146
+ * Note: heif_deinit() must not be called after exit(), for example in a global C++ object's destructor.
147
+ * If you do, global variables in libheif might have already been released when heif_deinit() is running,
148
+ * leading to a crash.
149
+ *
150
+ * \sa heif_init()
151
+ */
152
+ LIBHEIF_API
153
+ void heif_deinit(void);
154
+
155
+
156
+ // --- Codec plugins ---
157
+
158
+ // --- Plugins are currently only supported on Unix platforms.
159
+
160
+ enum heif_plugin_type
161
+ {
162
+ heif_plugin_type_encoder,
163
+ heif_plugin_type_decoder
164
+ };
165
+
166
+ typedef struct heif_plugin_info
167
+ {
168
+ int version; // version of this info struct
169
+ enum heif_plugin_type type;
170
+ const void* plugin;
171
+ void* internal_handle; // for internal use only
172
+ } heif_plugin_info;
173
+
174
+ LIBHEIF_API
175
+ heif_error heif_load_plugin(const char* filename, heif_plugin_info const** out_plugin);
176
+
177
+ LIBHEIF_API
178
+ heif_error heif_load_plugins(const char* directory,
179
+ const heif_plugin_info** out_plugins,
180
+ int* out_nPluginsLoaded,
181
+ int output_array_size);
182
+
183
+ LIBHEIF_API
184
+ heif_error heif_unload_plugin(const heif_plugin_info* plugin);
185
+
186
+ // Get a NULL terminated array of the plugin directories that are searched by libheif.
187
+ // This includes the paths specified in the environment variable LIBHEIF_PLUGIN_PATHS and the built-in path
188
+ // (if not overridden by the environment variable).
189
+ LIBHEIF_API
190
+ const char* const* heif_get_plugin_directories(void);
191
+
192
+ LIBHEIF_API
193
+ void heif_free_plugin_directories(const char* const*);
194
+
195
+
196
+ // --- register plugins
197
+
198
+ typedef struct heif_decoder_plugin heif_decoder_plugin;
199
+ typedef struct heif_encoder_plugin heif_encoder_plugin;
200
+
201
+ LIBHEIF_API
202
+ heif_error heif_register_decoder_plugin(const heif_decoder_plugin*);
203
+
204
+ LIBHEIF_API
205
+ heif_error heif_register_encoder_plugin(const heif_encoder_plugin*);
206
+
207
+
208
+ // DEPRECATED. Use heif_register_decoder_plugin(const struct heif_decoder_plugin*) instead.
209
+ LIBHEIF_API
210
+ heif_error heif_register_decoder(heif_context* heif, const heif_decoder_plugin*);
211
+
212
+ #ifdef __cplusplus
213
+ }
214
+ #endif
215
+
216
+ #endif
@@ -0,0 +1,133 @@
1
+ /*
2
+ * HEIF codec.
3
+ * Copyright (c) 2017-2023 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_METADATA_H
22
+ #define LIBHEIF_HEIF_METADATA_H
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+
28
+ #include <libheif/heif_library.h>
29
+
30
+
31
+ enum heif_metadata_compression
32
+ {
33
+ heif_metadata_compression_off = 0,
34
+ heif_metadata_compression_auto = 1,
35
+ heif_metadata_compression_unknown = 2, // only used when reading unknown method from input file
36
+ heif_metadata_compression_deflate = 3,
37
+ heif_metadata_compression_zlib = 4, // do not use for header data
38
+ heif_metadata_compression_brotli = 5
39
+ };
40
+
41
+ // ------------------------- metadata (Exif / XMP) -------------------------
42
+
43
+ // How many metadata blocks are attached to an image. If you only want to get EXIF data,
44
+ // set the type_filter to "Exif". Otherwise, set the type_filter to NULL.
45
+ LIBHEIF_API
46
+ int heif_image_handle_get_number_of_metadata_blocks(const heif_image_handle* handle,
47
+ const char* type_filter);
48
+
49
+ // 'type_filter' can be used to get only metadata of specific types, like "Exif".
50
+ // If 'type_filter' is NULL, it will return all types of metadata IDs.
51
+ LIBHEIF_API
52
+ int heif_image_handle_get_list_of_metadata_block_IDs(const heif_image_handle* handle,
53
+ const char* type_filter,
54
+ heif_item_id* ids, int count);
55
+
56
+ // Return a string indicating the type of the metadata, as specified in the HEIF file.
57
+ // Exif data will have the type string "Exif".
58
+ // This string will be valid until the next call to a libheif function.
59
+ // You do not have to free this string.
60
+ LIBHEIF_API
61
+ const char* heif_image_handle_get_metadata_type(const heif_image_handle* handle,
62
+ heif_item_id metadata_id);
63
+
64
+ // For EXIF, the content type is empty.
65
+ // For XMP, the content type is "application/rdf+xml".
66
+ LIBHEIF_API
67
+ const char* heif_image_handle_get_metadata_content_type(const heif_image_handle* handle,
68
+ heif_item_id metadata_id);
69
+
70
+ // Get the size of the raw metadata, as stored in the HEIF file.
71
+ LIBHEIF_API
72
+ size_t heif_image_handle_get_metadata_size(const heif_image_handle* handle,
73
+ heif_item_id metadata_id);
74
+
75
+ // 'out_data' must point to a memory area of the size reported by heif_image_handle_get_metadata_size().
76
+ // The data is returned exactly as stored in the HEIF file.
77
+ // For Exif data, you probably have to skip the first four bytes of the data, since they
78
+ // indicate the offset to the start of the TIFF header of the Exif data.
79
+ LIBHEIF_API
80
+ heif_error heif_image_handle_get_metadata(const heif_image_handle* handle,
81
+ heif_item_id metadata_id,
82
+ void* out_data);
83
+
84
+ // Only valid for item type == "uri ", an absolute URI
85
+ LIBHEIF_API
86
+ const char* heif_image_handle_get_metadata_item_uri_type(const heif_image_handle* handle,
87
+ heif_item_id metadata_id);
88
+
89
+ // --- writing Exif / XMP metadata ---
90
+
91
+ // Add EXIF metadata to an image.
92
+ LIBHEIF_API
93
+ heif_error heif_context_add_exif_metadata(heif_context*,
94
+ const heif_image_handle* image_handle,
95
+ const void* data, int size);
96
+
97
+ // Add XMP metadata to an image.
98
+ LIBHEIF_API
99
+ heif_error heif_context_add_XMP_metadata(heif_context*,
100
+ const heif_image_handle* image_handle,
101
+ const void* data, int size);
102
+
103
+ // New version of heif_context_add_XMP_metadata() with data compression (experimental).
104
+ LIBHEIF_API
105
+ heif_error heif_context_add_XMP_metadata2(heif_context*,
106
+ const heif_image_handle* image_handle,
107
+ const void* data, int size,
108
+ enum heif_metadata_compression compression);
109
+
110
+ // Add generic, proprietary metadata to an image. You have to specify an 'item_type' that will
111
+ // identify your metadata. 'content_type' can be an additional type, or it can be NULL.
112
+ // For example, this function can be used to add IPTC metadata (IIM stream, not XMP) to an image.
113
+ // Although not standard, we propose to store IPTC data with item type="iptc", content_type=NULL.
114
+ LIBHEIF_API
115
+ heif_error heif_context_add_generic_metadata(heif_context* ctx,
116
+ const heif_image_handle* image_handle,
117
+ const void* data, int size,
118
+ const char* item_type, const char* content_type);
119
+
120
+ // Add generic metadata with item_type "uri ". Items with this type do not have a content_type, but
121
+ // an item_uri_type and they have no content_encoding (they are always stored uncompressed).
122
+ LIBHEIF_API
123
+ heif_error heif_context_add_generic_uri_metadata(heif_context* ctx,
124
+ const heif_image_handle* image_handle,
125
+ const void* data, int size,
126
+ const char* item_uri_type,
127
+ heif_item_id* out_item_id);
128
+
129
+ #ifdef __cplusplus
130
+ }
131
+ #endif
132
+
133
+ #endif