Commit b409f442 for libheif
commit b409f442f077627b1057ba26232c16b3871d1735
Author: Devon Sookhoo <devonsookhoo14@gmail.com>
Date: Wed Feb 4 10:55:44 2026 -0700
set primary item when using unci api
diff --git a/libheif/api/libheif/heif_uncompressed.cc b/libheif/api/libheif/heif_uncompressed.cc
index 152f5af8..ae3edef5 100644
--- a/libheif/api/libheif/heif_uncompressed.cc
+++ b/libheif/api/libheif/heif_uncompressed.cc
@@ -808,6 +808,12 @@ heif_error heif_context_add_empty_unci_image(heif_context* ctx,
Result<std::shared_ptr<ImageItem_uncompressed>> unciImageResult;
unciImageResult = ImageItem_uncompressed::add_unci_item(ctx->context.get(), parameters, encoding_options, prototype->image);
+ // mark the new image as primary image
+
+ if (ctx->context->is_primary_image_set() == false) {
+ ctx->context->set_primary_image(*unciImageResult);
+ }
+
if (encoding_options) {
heif_encoding_options_free(default_options);
}