From f200cb4d3c9af99dc383fbabfb688d051f9f2093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Thu, 10 Sep 2026 19:02:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E6=A0=87=E8=AE=B0=E5=9B=BE?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E9=87=8D=E5=A4=8D=E5=A4=8D=E5=88=B6=E5=83=8F?= =?UTF-8?q?=E7=B4=A0=E7=BC=93=E5=86=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 复用同一个 DynamicImage 完成文件保存和返回数据编码。 保持标记图内容和错误处理不变。 --- .../src-tauri/src/ui_editor/commands/separation/marker.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/marker.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/marker.rs index 1964f7311..771d1f352 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/marker.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/marker.rs @@ -94,11 +94,12 @@ fn build_marked_image_blocking( height, ); } - image::DynamicImage::ImageRgba8(image.clone()) + let image = image::DynamicImage::ImageRgba8(image); + image .save_with_format(target, image::ImageFormat::Png) .map_err(|e| format!("写入标记图失败:{e}"))?; let mut png = Vec::new(); - image::DynamicImage::ImageRgba8(image) + image .write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png) .map_err(|e| format!("编码标记图失败:{e}"))?; Ok(format!(