Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Image Assets: optionally keep a transparent artboard's full size

IbrahimOezhan68577e42e1e5
diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs
index ed8b7f148..d9437a9c2 100644
--- a/crates/engine/src/prefs.rs
+++ b/crates/engine/src/prefs.rs
@@ -496,6 +496,9 @@ pub struct Export {
pub webp_quality: u32,
pub metadata: ExportMetadata,
pub convert_to_srgb: bool,
+ /// File › Generate › Image Assets exports an artboard named like an asset at the board's
+ /// size, transparent edges included, instead of trimming it to its visible pixels.
+ pub image_assets_full_artboards: bool,
}
impl Default for Export {
@@ -508,6 +511,7 @@ impl Default for Export {
webp_quality: 85,
metadata: ExportMetadata::Copyright,
convert_to_srgb: true,
+ image_assets_full_artboards: false,
}
}
}
diff --git a/crates/engine/src/web_cmds.rs b/crates/engine/src/web_cmds.rs
index 755ba0732..d2734d5d2 100644
--- a/crates/engine/src/web_cmds.rs
+++ b/crates/engine/src/web_cmds.rs
@@ -1046,6 +1046,7 @@ fn export_preferences(s: &mut Session, p: &Value) -> Result<Value> {
("webpQuality", "export.webpQuality"),
("metadata", "export.metadata"),
("convertToSrgb", "export.convertToSrgb"),
+ ("imageAssetsFullArtboards", "export.imageAssetsFullArtboards"),
] {
if let Some(v) = p.get(k) {
values.insert(key.into(), v.clone());
@@ -1402,7 +1403,11 @@ fn asset_output_path(dir: &str, relative: &str) -> Result<(String, String)> {
/// same file, the one higher in the Layers panel keeps it and the other is reported in `errors`.
/// Names are compared ignoring case, as `Logo.png` and `logo.png` are one file on Windows and
/// macOS.
-pub fn generate_assets(doc: &Document, dir: &str) -> (Vec<String>, Vec<Value>) {
+///
+/// A layer is trimmed to its visible pixels. With `full_artboards` (Export Preferences › Image
+/// Assets: Keep Full Artboard Size) an artboard keeps its board, transparent edges included, as
+/// File › Export › Artboards to Files writes it.
+pub fn generate_assets(doc: &Document, dir: &str, full_artboards: bool) -> (Vec<String>, Vec<Value>) {
let dpi = f64::from(doc.resolution_dpi.max(1.0));
let mut defaults: Option<Vec<AssetDefault>> = None;
let mut by_layer: Vec<Vec<(LayerId, AssetSpec)>> = Vec::new();
@@ -1434,7 +1439,11 @@ pub fn generate_assets(doc: &Document, dir: &str) -> (Vec<String>, Vec<Value>) {
if written.contains(&key) {
return Err(other(format!("{rel}: another layer already writes this file; rename one of the layers")));
}
- let mut one = crate::layer_menu_cmds::layer_document(doc, *id)?;
+ let board = if full_artboards { crate::artboard_cmds::artboard_document(doc, *id)? } else { None };
+ let mut one = match board {
+ Some(board) => board,
+ None => crate::layer_menu_cmds::layer_document(doc, *id)?,
+ };
one.metadata = Default::default();
let (w0, h0) = (f64::from(one.size.width), f64::from(one.size.height));
// The layer's own size spec wins; default variants scale on top of it.
@@ -1506,7 +1515,7 @@ fn image_assets(s: &mut Session, p: &Value) -> Result<Value> {
}
match dir {
Some(dir) if !cfg!(target_arch = "wasm32") => {
- let (files, errors) = generate_assets(&d.doc, &dir);
+ let (files, errors) = generate_assets(&d.doc, &dir, s.prefs().export.image_assets_full_artboards);
Ok(json!({"enabled": true, "dir": dir, "files": files, "errors": errors}))
}
_ => Ok(json!({"enabled": true, "dir": null, "files": [], "note": "assets are written when the document is saved"})),
@@ -1520,7 +1529,7 @@ pub fn on_saved(s: &Session, index: usize) -> Option<Value> {
return None;
}
let dir = assets_dir(d.path.as_deref()?);
- let (files, errors) = generate_assets(&d.doc, &dir);
+ let (files, errors) = generate_assets(&d.doc, &dir, s.prefs().export.image_assets_full_artboards);
Some(json!({"dir": dir, "files": files, "errors": errors}))
}
@@ -1548,7 +1557,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Export Preferences…",
&["File", "Export"],
None,
- r##"{"quickExportFormat":"png|jpg|gif|webp"?,"quickExportLocation":"ask|sameFolder"?,"jpegQuality":1..100?,"webpLossless":bool?,"webpQuality":1..100?,"metadata":"none|copyright|all"?,"convertToSrgb":bool?} → {values}"##,
+ r##"{"quickExportFormat":"png|jpg|gif|webp"?,"quickExportLocation":"ask|sameFolder"?,"jpegQuality":1..100?,"webpLossless":bool?,"webpQuality":1..100?,"metadata":"none|copyright|all"?,"convertToSrgb":bool?,"imageAssetsFullArtboards":bool? (Image Assets export artboards at the board's size instead of trimming transparent edges)} → {values}"##,
|_| Ok(()),
export_preferences
),
diff --git a/crates/engine/src/web_cmds/tests.rs b/crates/engine/src/web_cmds/tests.rs
index 5791e5f27..22a66723a 100644
--- a/crates/engine/src/web_cmds/tests.rs
+++ b/crates/engine/src/web_cmds/tests.rs
@@ -599,12 +599,60 @@ fn image_assets_are_generated_now_and_on_save() {
d.layers.push(Layer::new("default 200% @2x", LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None })));
let lid = d.layers[1].id;
d.layer_mut(lid).unwrap().name = "icon.png".into();
- let (files, errors) = generate_assets(&d, &dir);
+ let (files, errors) = generate_assets(&d, &dir, false);
assert!(errors.is_empty(), "{errors:?}");
assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::<Vec<_>>(), vec![std::path::Path::new(&dir).join("[email protected]")]);
assert_eq!(decode(&files[0]).dimensions(), (128, 80));
}
+/// Export Preferences › Image Assets: Keep Full Artboard Size. A transparent artboard whose
+/// contents don't fill it is trimmed to its pixels by default; with the preference on it keeps
+/// the board's size, transparent edges included. Layers inside the board are still trimmed.
+#[test]
+fn image_assets_keep_full_artboards_when_asked() {
+ let dir = tmp("asset-artboards");
+ let mut s = Session::new();
+ s.execute("file.new", json!({"width": 64, "height": 48, "name": "boards.psd", "background": "transparent"})).unwrap();
+ s.edit("board", |doc, _| {
+ let fmt = doc.pixel_format();
+ let mut logo = Layer::raster("logo.png", fmt);
+ logo.surface_mut().unwrap().fill_rect(Rect::new(12, 10, 20, 16), &photocraft_raster::from_rgba(&fmt, [1.0, 0.0, 0.0, 1.0]));
+ let board =
+ photocraft_doc::Artboard { rect: Rect::new(4, 6, 44, 36), background: photocraft_doc::ArtboardBackground::Transparent, preset: String::new() };
+ let group = photocraft_doc::Group { children: vec![logo], expanded: true, artboard: Some(board) };
+ doc.layers = vec![Layer::new("board.png", LayerContent::Group(group))];
+ Ok(())
+ })
+ .unwrap();
+ assert!(!s.prefs().export.image_assets_full_artboards, "trimming stays the default");
+
+ let r = s.execute("file.generate.imageAssets", json!({"on": true, "dir": dir})).unwrap();
+ assert!(r["errors"].as_array().unwrap().is_empty(), "{r}");
+ assert_eq!(decode(&format!("{dir}/board.png")).dimensions(), (8, 6), "off: trimmed to the board's pixels");
+ assert_eq!(decode(&format!("{dir}/logo.png")).dimensions(), (8, 6));
+
+ let r = s.execute("file.export.exportPreferences", json!({"imageAssetsFullArtboards": true})).unwrap();
+ assert_eq!(r["values"]["imageAssetsFullArtboards"], true);
+ let r = s.execute("file.generate.imageAssets", json!({"on": true, "dir": dir})).unwrap();
+ assert!(r["errors"].as_array().unwrap().is_empty(), "{r}");
+ let board = decode(&format!("{dir}/board.png"));
+ assert_eq!(board.dimensions(), (40, 30), "on: the whole board");
+ let px = board.to_rgba8();
+ let at = |x: usize, y: usize| &px[(y * 40 + x) * 4..(y * 40 + x) * 4 + 4];
+ assert_eq!(at(0, 0)[3], 0, "the board's empty corner stays transparent");
+ assert_eq!(at(39, 29)[3], 0);
+ // The logo keeps its place on the board: document (12, 10) is board (8, 4).
+ assert!(at(8, 4)[0] > 250 && at(8, 4)[3] == 255, "{:?}", at(8, 4));
+ assert_eq!(at(7, 4)[3], 0);
+ assert_eq!(decode(&format!("{dir}/logo.png")).dimensions(), (8, 6), "a layer on the board is still trimmed");
+
+ // Preferences saved before this setting existed load with it off.
+ let mut old = s.prefs().to_json();
+ old["export"].as_object_mut().unwrap().remove("imageAssetsFullArtboards");
+ let restored: crate::prefs::Preferences = serde_json::from_value(old).unwrap();
+ assert!(!restored.export.image_assets_full_artboards);
+}
+
/// #6614: two layers, or two default variants, naming one file never overwrite each other: the
/// layer higher in the Layers panel keeps the file, whatever the case of its name, and the
/// others are reported.
@@ -626,7 +674,7 @@ fn image_assets_never_write_one_file_twice() {
let (top, logo) = (id(&d, "Top"), id(&d, "Logo"));
d.layer_mut(top).unwrap().name = "Logo.PNG".into();
d.layer_mut(logo).unwrap().name = "logo.png, logo.png".into();
- let (files, errors) = generate_assets(&d, &dir);
+ let (files, errors) = generate_assets(&d, &dir, false);
assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::<Vec<_>>(), vec![std::path::Path::new(&dir).join("Logo.png")]);
assert_eq!(decode(&files[0]).dimensions(), (4, 4), "the top layer keeps the file");
assert_eq!(errors.len(), 2, "{errors:?}");
@@ -639,7 +687,7 @@ fn image_assets_never_write_one_file_twice() {
d.layer_mut(logo).unwrap().name = "Logo".into();
d.layers
.push(Layer::new("default 50% + 200% + 200% @2x", LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None })));
- let (files, errors) = generate_assets(&d, &dir);
+ let (files, errors) = generate_assets(&d, &dir, false);
let names: Vec<_> = files.iter().map(|p| std::path::Path::new(p).file_name().unwrap().to_string_lossy().into_owned()).collect();
assert_eq!(names, ["icon.png", "[email protected]"]);
assert_eq!(decode(&files[0]).dimensions(), (2, 2), "the 50% variant keeps icon.png");
@@ -656,7 +704,7 @@ fn image_assets_reject_traversal_from_names_and_defaults() {
let id = d.layers[1].id;
d.layer_mut(id).unwrap().name =
format!("nested/ok.png, ../escaped.png, ..\\backslash.png, {outside}/absolute.png, C:\\drive\\escape.png, CON.png, aux/escape.png, foo./trailing.png");
- let (files, errors) = generate_assets(&d, &dir);
+ let (files, errors) = generate_assets(&d, &dir, false);
assert_eq!(files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::<Vec<_>>(), vec![std::path::Path::new(&dir).join("nested").join("ok.png")]);
assert_eq!(errors.len(), 7, "{errors:?}");
assert!(errors.iter().all(|e| e["error"].as_str().unwrap().contains("unsafe component")), "{errors:?}");
@@ -668,7 +716,7 @@ fn image_assets_reject_traversal_from_names_and_defaults() {
"default ../ + /outside/ + ..\\bad/ + C:\\drive/ + 50% nested/",
LayerContent::Group(photocraft_doc::Group { children: vec![], expanded: false, artboard: None }),
));
- let (files, errors) = generate_assets(&d, &dir);
+ let (files, errors) = generate_assets(&d, &dir, false);
assert_eq!(
files.iter().map(|p| std::path::PathBuf::from(p.as_str())).collect::<Vec<_>>(),
vec![std::path::Path::new(&dir).join("nested").join("safe.png")]
@@ -692,7 +740,7 @@ fn image_assets_reject_existing_symlinks_in_folders_and_files() {
let mut d = (*session(8).active().unwrap().doc).clone();
let id = d.layers[1].id;
d.layer_mut(id).unwrap().name = "linked/new/sub.png, leaf.png, leaf.webp, good/safe.png".into();
- let (files, errors) = generate_assets(&d, &dir);
+ let (files, errors) = generate_assets(&d, &dir, false);
assert_eq!(files, vec![format!("{dir}/good/safe.png")]);
assert_eq!(errors.len(), 3, "{errors:?}");
assert!(errors.iter().all(|e| e["error"].as_str().unwrap().contains("symlink")), "{errors:?}");
@@ -703,7 +751,7 @@ fn image_assets_reject_existing_symlinks_in_folders_and_files() {
let linked_root = format!("{dir}/rootlink");
std::os::unix::fs::symlink(&outside, &linked_root).unwrap();
d.layer_mut(id).unwrap().name = "root.png".into();
- let (files, errors) = generate_assets(&d, &format!("{linked_root}/"));
+ let (files, errors) = generate_assets(&d, &format!("{linked_root}/"), false);
assert!(errors.is_empty(), "{errors:?}");
assert_eq!(files, vec![format!("{linked_root}/root.png")]);
assert!(std::path::Path::new(&format!("{outside}/root.png")).is_file());
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 15879f60d..cfaadeb1b 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -3864,3 +3864,6 @@ navigator Zoom Zvětšení
# Graphics Adapter preference (#1885)
GPU adapter Adaptér GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Obrazové podklady: zachovat celou velikost kreslicí plochy
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index eb3ca7794..cde6b1147 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -3259,3 +3259,6 @@ curves Smooth Glätten
# Graphics Adapter preference (#1885)
GPU adapter GPU-Adapter
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Bild-Assets: Volle Zeichenbereichsgröße beibehalten
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index bac53b53d..16b237b3f 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -3956,3 +3956,6 @@ curves Smooth Εξομάλυνση
# Graphics Adapter preference (#1885)
GPU adapter Προσαρμογέας GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Πόροι εικόνας: διατήρηση πλήρους μεγέθους πίνακα σχεδίασης
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index 8629fc3fd..bd9733ccf 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -4218,3 +4218,6 @@ navigator Zoom Zoom
# Graphics Adapter preference (#1885)
GPU adapter Adaptador de GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Recursos de imagen: mantener el tamaño completo de la mesa de trabajo
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index fad669a4b..c877fdf7f 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -3265,3 +3265,6 @@ curves Smooth Lisser
# Graphics Adapter preference (#1885)
GPU adapter Adaptateur GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Ressources d'image : conserver la taille complète du plan de travail
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index c066f4271..f5751e7f8 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -4175,3 +4175,6 @@ cameraRaw Yellow Sárga
# Graphics Adapter preference (#1885)
GPU adapter GPU-adapter
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Képelemek: a rajztábla teljes méretének megtartása
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 9e0012bd6..3c94d6299 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -3252,3 +3252,6 @@ curves Smooth Haluskan
# Graphics Adapter preference (#1885)
GPU adapter Adaptor GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Aset Gambar: Pertahankan Ukuran Penuh Artboard
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index fe8d4cf8d..076de2464 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -4373,3 +4373,6 @@ shape Appearance Aspetto
# Graphics Adapter preference (#1885)
GPU adapter Adattatore GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Risorse immagine: mantieni la dimensione intera della tavola da disegno
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 9b121c4c9..5d1e57a25 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -3934,3 +3934,6 @@ curves Smooth スムーズ
# Graphics Adapter preference (#1885)
GPU adapter GPU アダプター
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size 画像アセット: アートボード全体のサイズを保持
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index dc4bf58c9..7dffb7240 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -3440,3 +3440,6 @@ curves Smooth 매끄럽게
# Graphics Adapter preference (#1885)
GPU adapter GPU 어댑터
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size 이미지 에셋: 전체 아트보드 크기 유지
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index 7104d69ed..f49f873d9 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -4016,3 +4016,6 @@ curves Smooth Vloeiend maken
# Graphics Adapter preference (#1885)
GPU adapter GPU-adapter
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Afbeeldingsmiddelen: volledige tekengebiedgrootte behouden
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 8abed62ba..95a9ab3e1 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -3856,3 +3856,6 @@ curves Smooth Wygładź
# Graphics Adapter preference (#1885)
GPU adapter Karta GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Zasoby obrazów: zachowaj pełny rozmiar obszaru roboczego
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index b21564e68..d2d75c8a2 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -4046,3 +4046,6 @@ layerLabel No Color Sem cor
# Graphics Adapter preference (#1885)
GPU adapter Adaptador de GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Recursos de imagem: manter o tamanho completo da prancheta
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index ff6fc08de..8ff569aaf 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -3231,3 +3231,6 @@ curves Smooth Сгладить
# Graphics Adapter preference (#1885)
GPU adapter Адаптер GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Ресурсы изображений: сохранять полный размер монтажной области
diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv
index 9a1ceff63..957b7bdbb 100644
--- a/crates/ui-egui/src/i18n/sr.tsv
+++ b/crates/ui-egui/src/i18n/sr.tsv
@@ -4329,3 +4329,6 @@ shape Appearance Izgled
# Graphics Adapter preference (#1885)
GPU adapter GPU adapter
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Slikovni resursi: zadrži punu veličinu radne table
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index def688abc..ad4881300 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -3986,3 +3986,6 @@ cameraData Lens Lens
# Graphics Adapter preference (#1885)
GPU adapter GPU bağdaştırıcısı
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Resim Varlıkları: Tam çalışma yüzeyi boyutunu koru
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index e28ea0008..878f2543e 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -3965,3 +3965,6 @@ curves Smooth Згладити
# Graphics Adapter preference (#1885)
GPU adapter Адаптер GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Ресурси зображення: зберігати повний розмір монтажної області
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index 503cc1006..63855349d 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -3744,3 +3744,6 @@ curves Smooth Làm mượt
# Graphics Adapter preference (#1885)
GPU adapter Bộ điều hợp GPU
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size Tài nguyên ảnh: Giữ nguyên kích thước bảng vẽ
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index a030a8885..484ac48da 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2882,3 +2882,6 @@ curves Smooth 平滑
# Graphics Adapter preference (#1885)
GPU adapter GPU 适配器
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size 图像资源:保留完整画板大小
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 25a05a182..a7738bdbe 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -2867,3 +2867,6 @@ curves Smooth 平滑
# Graphics Adapter preference (#1885)
GPU adapter GPU 介面卡
+
+# Export Preferences › Image Assets: Keep Full Artboard Size
+ Image Assets: Keep Full Artboard Size 影像資產:保留完整工作區域大小
diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs
index 5cd2e547d..8388210bc 100644
--- a/crates/ui-egui/src/prefs_ui.rs
+++ b/crates/ui-egui/src/prefs_ui.rs
@@ -1141,6 +1141,10 @@ fn humanize(key: &str) -> String {
if key == "webpQuality" {
return "Quality".into();
}
+ // File › Generate › Image Assets keeps a transparent artboard's full board instead of trimming it.
+ if key == "imageAssetsFullArtboards" {
+ return "Image Assets: Keep Full Artboard Size".into();
+ }
// The auto-hide notice settings read best with their own labels (Interface › Notification, #2022).
if key == "notificationAutoHide" {
return "Auto Hide Notifications".into();
@@ -2640,6 +2644,7 @@ mod tests {
assert!(export_field_visible(&obj, "webpQuality"));
assert_eq!(humanize("webpLossless"), "Lossless");
assert_eq!(humanize("webpQuality"), "Quality");
+ assert_eq!(humanize("imageAssetsFullArtboards"), "Image Assets: Keep Full Artboard Size");
}
#[test]
diff --git a/docs/scorecard.md b/docs/scorecard.md
index 42ae824b4..dd4600471 100644
--- a/docs/scorecard.md
+++ b/docs/scorecard.md
@@ -9,7 +9,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js
| [Performance](#performance) | 3 | 22 | 25 | 59 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 20 not run, 5 not measurable yet (baseline 2026-10-05) |
| [File compatibility](#file-compatibility) | 7 | 14 | 6 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 188/256, round trip ≥ 258/256 |
| [Tools](#tools) | 33 | 11 | 0 | |
-| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 170 (target 0) |
+| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 171 (target 0) |
| [Type](#type) | 4 | 3 | 2 | |
| [Automation](#automation) | 5 | 2 | 4 | 631 of 631 menu items live (100.0%) |
| [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 30 of 30 crates; panic_hunt present |
@@ -180,7 +180,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t
## Workspace and UI
-**Settings that do nothing: 26 of 170** (target 0, #204). Counted by the prefs audit (`xtask/src/scorecard.rs`): a `Preferences` field counts as read when code outside the prefs model (`prefs.rs` except its `impl Session` blocks; tests excluded; the schema-driven dialog never names a field) accesses `section.field`, or `.section` and `.field` in the same file, or calls a section method that reads `self.field`. It is a heuristic lower bound: a generic name can look read when it isn't.
+**Settings that do nothing: 26 of 171** (target 0, #204). Counted by the prefs audit (`xtask/src/scorecard.rs`): a `Preferences` field counts as read when code outside the prefs model (`prefs.rs` except its `impl Session` blocks; tests excluded; the schema-driven dialog never names a field) accesses `section.field`, or `.section` and `.field` in the same file, or calls a section method that reads `self.field`. It is a heuristic lower bound: a generic name can look read when it isn't.
Unread: `general.color_picker`, `general.animated_zoom`, `general.zoom_resizes_windows`, `workspace.auto_show_hidden_panels`, `workspace.enable_floating_document_window_docking`, `file_handling.save_in_background`, `performance.cache_levels`, `performance.gpu_adapter`, `performance.legacy_compositing`, `scratch_disks.disks`, `units_and_rulers.column_width`, `units_and_rulers.gutter`, `plug_ins.show_extension_panels`, `plug_ins.allow_scripts_to_connect`, `plug_ins.generator_enabled`, `type_.text_engine`, `type_.recent_fonts`, `enhanced_controls.scrubby_slider_acceleration`, `raw_defaults.color_space`, `raw_defaults.bit_depth`, `raw_defaults.resolution`, `raw_defaults.sharpen_for`, `raw_defaults.open_as_smart_object`, `raw_defaults.apply_auto_tone`, `integrations.allow_agent_control`, `integrations.control_port`.