Commit caf980ea for libheif

commit caf980ea2a533f62964a12d8f146b51df76c3464
Author: Dirk Farin <dirk.farin@gmail.com>
Date:   Sat Mar 21 00:34:19 2026 +0100

    fix ordering of transformative properties in grid items (#1730)

diff --git a/libheif/image-items/grid.cc b/libheif/image-items/grid.cc
index de3d3662..937d04af 100644
--- a/libheif/image-items/grid.cc
+++ b/libheif/image-items/grid.cc
@@ -731,7 +731,7 @@ Result<std::shared_ptr<ImageItem_Grid>> ImageItem_Grid::add_new_grid_item(HeifCo
   grid_image->set_tile_encoding_options(encoding_options);
   grid_image->set_grid_spec(grid);
   grid_image->set_resolution(output_width, output_height);
-  ctx->get_heif_file()->add_orientation_properties(grid_id, encoding_options->image_orientation);
+  grid_image->m_grid_orientation = encoding_options->image_orientation;

   ctx->insert_image_item(grid_id, grid_image);
   const int construction_method = 1; // 0=mdat 1=idat
@@ -808,6 +808,10 @@ Error ImageItem_Grid::add_image_tile(uint32_t tile_x, uint32_t tile_y,
     for (auto& property : colr_boxes) {
       add_property(property, is_property_essential(property));
     }
+
+    // Add transformative properties
+
+    get_context()->get_heif_file()->add_orientation_properties(get_id(), m_grid_orientation);
   }

   return Error::Ok;
diff --git a/libheif/image-items/grid.h b/libheif/image-items/grid.h
index 5cc7e9d0..d65a0f2d 100644
--- a/libheif/image-items/grid.h
+++ b/libheif/image-items/grid.h
@@ -155,6 +155,7 @@ private:
   ImageGrid m_grid_spec;
   std::vector<heif_item_id> m_grid_tile_ids;

+  heif_orientation m_grid_orientation = heif_orientation_normal;
   heif_encoding_options* m_tile_encoding_options = nullptr;

   Error read_grid_spec();