PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge branch 'main' into feat/4814-psd-palette-modes
Gert Pellin3f3d61a7ae9a
diff --cc crates/io/src/tiff_layers.rsindex c02b7225d,7da61fa46..91011c6eb--- a/crates/io/src/tiff_layers.rs+++ b/crates/io/src/tiff_layers.rs@@@ -209,17 -217,7 +217,17 @@@ pub(crate) fn export_layered(doc: &Documaximize_compatibility: true,document_path: opts.document_path.clone(),};+ // TIFF has no palette, bitmap or duotone layout: the PSD model of an Indexed Color, Bitmap+ // or Duotone document is made in its pixel format (RGB or Grayscale), which the PSD exporter+ // otherwise writes in the document's own mode.+ let plain;+ let doc = if matches!(doc.mode, ColorMode::Indexed | ColorMode::Bitmap | ColorMode::Duotone) {+ plain = Document { mode: doc.pixel_format().mode, ..doc.clone() };+ &plain+ } else {+ doc+ };- let (file, w) = crate::with_span(ctl, 0.0, TIFF_MODEL_DONE, |ctl| crate::psd_export::document_to_psd_interruptible(doc, &psd_opts, ctl));+ let (mut file, w) = crate::with_span(ctl, 0.0, TIFF_MODEL_DONE, |ctl| crate::psd_export::document_to_psd_interruptible(doc, &psd_opts, ctl));// A cancelled conversion stops early with an incomplete model: never encode it.ctl.check().map_err(|_| IoError::Cancelled)?;warnings.extend(w);