Repository: zng-ui/zng (language: rust)

Issue:
Apply exif orientation to images
New release of `image` crate supports this.


Discussion / hints:
Looks like it already works, will add demo in images example.

Fix patch:
diff --git a/examples/image/res/exif rotated.jpg b/examples/image/res/exif rotated.jpg
new file mode 100644
index 000000000..0883e4e58
Binary files /dev/null and b/examples/image/res/exif rotated.jpg differ
diff --git a/examples/image/res/exif rotated.tif b/examples/image/res/exif rotated.tif
new file mode 100755
index 000000000..77582931d
Binary files /dev/null and b/examples/image/res/exif rotated.tif differ
diff --git a/examples/image/res/screenshot.png b/examples/image/res/screenshot.png
index b408f8f0f..6c91a911c 100644
Binary files a/examples/image/res/screenshot.png and b/examples/image/res/screenshot.png differ
diff --git a/examples/image/src/main.rs b/examples/image/src/main.rs
index 1672f27b8..9b8bf2050 100644
--- a/examples/image/src/main.rs
+++ b/examples/image/src/main.rs
@@ -203,6 +203,7 @@ fn main() {
                                     large_image(),
                                     repeat_image(),
                                     open_or_paste_image(),
+                                    exif_rotated(),
                                 ]
                             )
                         ];
@@ -522,6 +523,44 @@ fn open_or_paste_image() -> impl UiNode {
     }
 }
 
+fn exif_rotated() -> impl UiNode {
+    Button! {
+        child = Text!("Exif Rotated");
+        on_click = hn!(|_| {
+            WINDOWS.open(async {
+                fn example(file: &'static str) -> impl UiNode {
+                    Image! {
+                        zng::container::child_top = Text!{
+                            txt = file;
+                            txt_align = Align::CENTER;
+                            font_weight = FontWeight::BOLD;
+                        }, 0;
+                        source = zng::env::res(file);
+                    }
+                }
+                Window! {
+                    title = "Exif Rotated";
+                    child_align = Align::TOP;
+                    child_top = Text! {
+                        txt = "all arrows must point up";
+                        txt_align = Align::CENTER;
+                        font_size = 2.em();
+                        margin = 20;
+                    }, 0;
+                    child = Stack!(
+                        left_to_right,
+                        10,
+                        ui_vec![
+                            example("exif rotated.jpg"),
+                            example("exif rotated.tif"),
+                        ]
+                    )
+                }
+            });
+        });
+    }
+}
+
 async fn open_dialog() -> Option<PathBuf> {
     DIALOG
         .open_file("Open Image", std::env::current_dir().unwrap_or_default(), "", {


Test patch: