From 0bbd597df14d8f95bcd0d929d340e7c223295032 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 09:14:43 +0000 Subject: [PATCH 1/3] #1482: lossy WebP export through libwebp (native builds), with a Lossless option WebP exports are lossy at the export quality on desktop builds; a Lossless box keeps the old exact output. The encoder is libwebp (BSD-3-Clause, via the webp and libwebp-sys crates) behind lcc-codecs' webp-lossy feature; web and Android builds leave it out and stay lossless. Metadata (ICC, EXIF, XMP) is written into VP8X chunks around libwebp's bitstream. Sources: libwebp 1.3.1 (vendored by libwebp-sys 0.9.6), called through webp 0.3.1; no code copied. Manual: output/export-formats, platforms/web, docs/manual/import-export.md Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011VFDriGXJwNRKfVqKuo1hk --- Cargo.lock | 20 +++ Cargo.toml | 2 + NOTICE | 9 ++ crates/codecs/Cargo.toml | 10 +- crates/codecs/LICENSE-libwebp.txt | 56 ++++++++ crates/codecs/src/encode.rs | 132 ++++++++++++++++++ crates/codecs/src/lib.rs | 2 +- crates/codecs/tests/it/roundtrip.rs | 47 +++++++ crates/engine/src/export.rs | 43 +++++- crates/mcp/src/headless.rs | 2 +- crates/mcp/src/tools.rs | 1 + crates/ui-egui/locales/fork/cs.json | 2 + crates/ui-egui/locales/fork/de.json | 2 + crates/ui-egui/locales/fork/es.json | 2 + crates/ui-egui/locales/fork/fi.json | 2 + crates/ui-egui/locales/fork/fr.json | 2 + crates/ui-egui/locales/fork/id.json | 2 + crates/ui-egui/locales/fork/it.json | 2 + crates/ui-egui/locales/fork/ja.json | 2 + crates/ui-egui/locales/fork/ka.json | 2 + crates/ui-egui/locales/fork/pl.json | 2 + crates/ui-egui/locales/fork/pt-br.json | 2 + crates/ui-egui/locales/fork/ru.json | 2 + crates/ui-egui/locales/fork/sv.json | 2 + crates/ui-egui/locales/fork/uk.json | 2 + crates/ui-egui/locales/fork/vi.json | 2 + crates/ui-egui/locales/fork/zh-hans.json | 2 + crates/ui-egui/locales/fork/zh-hant.json | 2 + crates/ui-egui/src/export_preview.rs | 1 + crates/ui-egui/src/panels/dialogs.rs | 18 ++- .../2026-11-27-lossy-webp-export.md | 3 + .../content/docs/output/export-formats.mdx | 3 +- .../src/content/docs/platforms/web.mdx | 2 +- docs/manual/import-export.md | 2 +- .../whats-new/2026-11-27-lossy-webp-export.md | 4 + 35 files changed, 380 insertions(+), 11 deletions(-) create mode 100644 crates/codecs/LICENSE-libwebp.txt create mode 100644 docs/changelog/unreleased/2026-11-27-lossy-webp-export.md create mode 100644 docs/whats-new/2026-11-27-lossy-webp-export.md diff --git a/Cargo.lock b/Cargo.lock index 35c28413e1..5805c8abd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4780,6 +4780,7 @@ dependencies = [ "serde_json", "thiserror 2.0.21", "tiff", + "webp", "zune-core", "zune-jpeg", ] @@ -5834,6 +5835,16 @@ dependencies = [ "redox_syscall 0.9.4", ] +[[package]] +name = "libwebp-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54cd30df7c7165ce74a456e4ca9732c603e8dc5e60784558c1c6dc047f876733" +dependencies = [ + "cc", + "glob", +] + [[package]] name = "linebender_resource_handle" version = "0.1.1" @@ -10087,6 +10098,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c071456adef4aca59bf6a583c46b90ff5eb0b4f758fc347cea81290288f37ce1" +dependencies = [ + "libwebp-sys", +] + [[package]] name = "webpki-roots" version = "1.0.11" diff --git a/Cargo.toml b/Cargo.toml index f2c361d8e7..7a3138ef3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,6 +131,8 @@ ab_glyph = { version = "0.2", default-features = false, features = ["std"] } # png = "0.18" tiff = "0.11" image-webp = "0.2" +# lossy WebP export (libwebp, C; AGENTS.md → "Rust first", #1482): its safe wrapper, without the `image` integration +webp = { version = "0.3", default-features = false } exr = { version = "1.74", default-features = false } # BSD-3-Clause, pure Rust (no unsafe) OpenEXR; scene-linear export moxcms = { version = "0.9", default-features = false, features = ["lut"] } jxl-oxide = { version = "0.12", default-features = false } diff --git a/NOTICE b/NOTICE index aebf24955a..2eb84953c9 100644 --- a/NOTICE +++ b/NOTICE @@ -226,6 +226,15 @@ downloads cities15000.zip, admin1CodesASCII.txt and countryInfo.txt from GeoName under Creative Commons Attribution 4.0 (https://creativecommons.org/licenses/by/4.0/); attribution: "GeoNames, geonames.org". The lookup code (crates/geocode) is our own. +Lossy WebP export (native builds) +--------------------------------- +Desktop builds encode lossy WebP with libwebp 1.3.1 (https://chromium.googlesource.com/webm/libwebp), +Copyright (c) 2010, Google Inc., licensed under the BSD 3-Clause License with Google's additional +patent grant (crates/codecs/LICENSE-libwebp.txt). It is compiled from the C sources vendored in the +libwebp-sys crate 0.9.6 (MIT License, https://github.com/NoXF/libwebp-sys) and called through the +webp crate 0.3.1 (MIT OR Apache-2.0, https://github.com/jaredforth/webp). libwebp is a C library, used under the +Rust-first rule (AGENTS.md) behind the codecs crate's `webp-lossy` feature. Web and Android builds leave it out and export lossless WebP only. + Linux Wayland window decorations ------------------------------- sctk-adwaita 0.10.1 (https://github.com/PolyMeilex/sctk-adwaita, diff --git a/crates/codecs/Cargo.toml b/crates/codecs/Cargo.toml index 4b83529c19..e973049cb7 100644 --- a/crates/codecs/Cargo.toml +++ b/crates/codecs/Cargo.toml @@ -42,8 +42,16 @@ avif-serialize = { workspace = true, optional = true } # spawns threads of its own (std::thread), which wasm32 has not got jixel = { workspace = true, optional = true } +# Lossy WebP export through libwebp (C, BSD-3-Clause) behind its maintained safe wrapper `webp`: the one C library +# AGENTS.md → "Rust first" approves for this (#1482). Desktop only: the web build and Android keep lossless WebP +# (`image-webp`, pure Rust), and the export dialog says so. +[target.'cfg(not(any(target_arch = "wasm32", target_os = "android")))'.dependencies] +webp = { workspace = true, optional = true } + [features] -default = ["parallel", "jxl", "avif"] +default = ["parallel", "jxl", "avif", "webp-lossy"] +## Lossy WebP encoding (libwebp via `webp`); desktop targets only, lossless elsewhere. +webp-lossy = ["dep:webp"] parallel = ["dep:rayon", "lcc-raster/parallel", "jpeg-decoder/rayon"] ## JPEG XL decode (jxl-oxide) and, on native targets, encode (jixel); both pure Rust. jxl = ["dep:jxl-oxide", "dep:jixel"] diff --git a/crates/codecs/LICENSE-libwebp.txt b/crates/codecs/LICENSE-libwebp.txt new file mode 100644 index 0000000000..2b0fff60e4 --- /dev/null +++ b/crates/codecs/LICENSE-libwebp.txt @@ -0,0 +1,56 @@ +Copyright (c) 2010, Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +----- PATENTS ----- + +Additional IP Rights Grant (Patents) +------------------------------------ + +"These implementations" means the copyrightable works that implement the WebM +codecs distributed by Google as part of the WebM Project. + +Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge, +royalty-free, irrevocable (except as stated in this section) patent license to +make, have made, use, offer to sell, sell, import, transfer, and otherwise +run, modify and propagate the contents of these implementations of WebM, where +such license applies only to those patent claims, both currently owned by +Google and acquired in the future, licensable by Google that are necessarily +infringed by these implementations of WebM. This grant does not include claims +that would be infringed only as a consequence of further modification of these +implementations. If you or your agent or exclusive licensee institute or order +or agree to the institution of patent litigation or any other patent +enforcement activity against any entity (including a cross-claim or +counterclaim in a lawsuit) alleging that any of these implementations of WebM +or any code incorporated within any of these implementations of WebM +constitute direct or contributory patent infringement, or inducement of +patent infringement, then any patent rights granted to you under this License +for these implementations of WebM shall terminate as of the date such +litigation is filed. diff --git a/crates/codecs/src/encode.rs b/crates/codecs/src/encode.rs index 97132a78c9..68d67619d5 100644 --- a/crates/codecs/src/encode.rs +++ b/crates/codecs/src/encode.rs @@ -394,6 +394,138 @@ pub fn encode_webp_lossless(img: &EncodeImage, meta: &EncodeMeta) -> Result Result> { + img.validate()?; + let Samples::U8(s) = img.samples else { + return Err(Error::Encode("WebP needs 8-bit samples".into())); + }; + if img.width == 0 || img.height == 0 || img.width > WEBP_MAX_SIDE || img.height > WEBP_MAX_SIDE { + return Err(Error::Encode(format!("WebP images are at most {WEBP_MAX_SIDE} pixels a side ({} × {})", img.width, img.height))); + } + let n = img.width as usize * img.height as usize; + let ch = img.channels as usize; + let alpha = ch == 2 || ch == 4; + let px: Vec = s + .chunks_exact(ch.max(1)) + .take(n) + .flat_map(|c| match *c { + [g] => [g, g, g, 255], + [g, a] => [g, g, g, a], + [r, g, b] => [r, g, b, 255], + [r, g, b, a, ..] => [r, g, b, a], + _ => [0, 0, 0, 255], + }) + .enumerate() + .filter(|(i, _)| alpha || i % 4 != 3) + .map(|(_, v)| v) + .collect(); + if px.len() != n * if alpha { 4 } else { 3 } { + return Err(Error::Encode("WebP: fewer samples than the image needs".into())); + } + let bitstream = webp_lossy_bitstream(&px, alpha, img.width, img.height, quality.clamp(1, 100))?; + webp_with_metadata(&bitstream, img.width, img.height, meta) +} + +#[cfg(all(feature = "webp-lossy", not(any(target_arch = "wasm32", target_os = "android"))))] +fn webp_lossy_bitstream(px: &[u8], alpha: bool, w: u32, h: u32, quality: u8) -> Result> { + let layout = if alpha { webp::PixelLayout::Rgba } else { webp::PixelLayout::Rgb }; + // (the sizes were checked against `px` above: the wrapper's own check can't fail) + let enc = webp::Encoder::new(px, layout, w, h); + let out = enc.encode_simple(false, f32::from(quality)).map_err(|e| Error::Encode(format!("WebP: {e:?}")))?; + Ok(out.to_vec()) +} + +#[cfg(not(all(feature = "webp-lossy", not(any(target_arch = "wasm32", target_os = "android")))))] +fn webp_lossy_bitstream(_px: &[u8], _alpha: bool, _w: u32, _h: u32, _quality: u8) -> Result> { + Err(Error::Encode("lossy WebP is not available in this build (lossless WebP is)".into())) +} + +/// A RIFF chunk: tag, little-endian size, payload, padded to an even length. +fn riff_chunk(out: &mut Vec, tag: &[u8; 4], payload: &[u8]) -> Result<()> { + let len = u32::try_from(payload.len()).map_err(|_| Error::Encode("WebP: a chunk over 4 GB".into()))?; + out.extend_from_slice(tag); + out.extend_from_slice(&len.to_le_bytes()); + out.extend_from_slice(payload); + if payload.len() % 2 == 1 { + out.push(0); + } + Ok(()) +} + +/// The chunks of a WebP file after `RIFF size WEBP`, as (tag, payload); `None` when it isn't one. +fn webp_chunks(file: &[u8]) -> Option> { + if file.get(0..4)? != b"RIFF" || file.get(8..12)? != b"WEBP" { + return None; + } + let mut out = Vec::new(); + let mut at = 12usize; + while at < file.len() { + let tag: [u8; 4] = file.get(at..at + 4)?.try_into().ok()?; + let len = u32::from_le_bytes(file.get(at + 4..at + 8)?.try_into().ok()?) as usize; + let body = file.get(at + 8..at.checked_add(8)?.checked_add(len)?)?; + out.push((tag, body)); + at = at.checked_add(8)?.checked_add(len)?.checked_add(len % 2)?; + } + Some(out) +} + +/// `bitstream` (a simple or extended WebP file from the encoder) rewritten as an extended file carrying `meta`'s +/// ICC profile, EXIF and XMP, in the order the WebP container specification gives (VP8X, ICCP, ALPH, VP8, EXIF, XMP). +/// Unchanged when `meta` has none of them. +fn webp_with_metadata(bitstream: &[u8], w: u32, h: u32, meta: &EncodeMeta) -> Result> { + let xmp = meta.xmp.map(str::as_bytes); + if meta.icc.is_none() && meta.exif.is_none() && xmp.is_none() { + return Ok(bitstream.to_vec()); + } + let chunks = webp_chunks(bitstream).ok_or_else(|| Error::Encode("WebP: the encoder made no WebP file".into()))?; + let image: Vec<_> = chunks.iter().filter(|(t, _)| t == b"ALPH" || t == b"VP8 " || t == b"VP8L").collect(); + let has_alpha = image.iter().any(|(t, _)| t == b"ALPH"); + let mut flags = 0u8; + if meta.icc.is_some() { + flags |= 0x20; + } + if has_alpha { + flags |= 0x10; + } + if meta.exif.is_some() { + flags |= 0x08; + } + if xmp.is_some() { + flags |= 0x04; + } + let mut vp8x = vec![flags, 0, 0, 0]; + vp8x.extend_from_slice(&(w.saturating_sub(1)).to_le_bytes()[..3]); + vp8x.extend_from_slice(&(h.saturating_sub(1)).to_le_bytes()[..3]); + let mut body = b"WEBP".to_vec(); + riff_chunk(&mut body, b"VP8X", &vp8x)?; + if let Some(icc) = meta.icc { + riff_chunk(&mut body, b"ICCP", icc)?; + } + for (tag, payload) in image { + riff_chunk(&mut body, tag, payload)?; + } + if let Some(exif) = meta.exif { + riff_chunk(&mut body, b"EXIF", exif)?; + } + if let Some(xmp) = xmp { + riff_chunk(&mut body, b"XMP ", xmp)?; + } + let len = u32::try_from(body.len()).map_err(|_| Error::Encode("WebP: file over 4 GB".into()))?; + let mut out = b"RIFF".to_vec(); + out.extend_from_slice(&len.to_le_bytes()); + out.extend_from_slice(&body); + Ok(out) +} + /// Encode AVIF (sRGB, 4:4:4, 10-bit AV1) with `ravif` (rav1e). 8-bit samples are widened by the /// encoder; 16-bit samples keep 10 bits of precision (BT.601 full-range YCbCr computed here). /// `quality` 1..=100, `speed` 1 (slow) ..= 10. EXIF is embedded; ICC is not supported by the muxer diff --git a/crates/codecs/src/lib.rs b/crates/codecs/src/lib.rs index 5b6318f30a..bcf970928b 100644 --- a/crates/codecs/src/lib.rs +++ b/crates/codecs/src/lib.rs @@ -50,7 +50,7 @@ pub use avif_gainmap::encode_avif_gain_map; pub use encode::{ ChromaSubsampling, EncodeImage, EncodeMeta, HDR_REFERENCE_WHITE_NITS, HLG_REFERENCE_PEAK_NITS, HdrTransfer, Samples, TiffCompression, encode_avif, encode_avif_hdr, encode_avif_pq, encode_jpeg, encode_png, encode_png_pq, encode_psd, encode_tiff, encode_tiff_associated, - encode_webp_lossless, hlg_signal, + WEBP_LOSSY, WEBP_MAX_SIDE, encode_webp_lossless, encode_webp_lossy, hlg_signal, }; pub use exr_encode::{ACESCG, ExrOptions, encode_exr}; pub use jxl_encode::{JxlColour, JxlEffort, JxlOptions, encode_jxl, encode_jxl_gain_map}; diff --git a/crates/codecs/tests/it/roundtrip.rs b/crates/codecs/tests/it/roundtrip.rs index 73553e8152..64c3bf2e60 100644 --- a/crates/codecs/tests/it/roundtrip.rs +++ b/crates/codecs/tests/it/roundtrip.rs @@ -483,6 +483,53 @@ fn webp_lossless_exact() { assert_eq!(d.xmp.as_deref(), Some("")); } +/// Lossy WebP (#1482) decodes close to its source, keeps its metadata and alpha, gets smaller at a lower quality, +/// and refuses what WebP can't hold instead of panicking; a build without it says so. +#[test] +fn webp_lossy_close_with_metadata() { + let img = gradient(64, 48); + let icc = write_named(NamedSpace::Srgb); + let exif = minimal_exif(6); + let meta = EncodeMeta { icc: Some(&icc), exif: Some(&exif), xmp: Some(""), ..Default::default() }; + let e = EncodeImage::rgba8(&img); + if !WEBP_LOSSY { + assert!(encode_webp_lossy(&e, 90, &meta).is_err()); + return; + } + let bytes = encode_webp_lossy(&e, 90, &meta).unwrap(); + assert_eq!(sniff(&bytes), Some(Format::WebP)); + let d = decode(&bytes, DecodeOptions::default()).unwrap(); + assert_eq!((d.image.width, d.image.height, d.orientation), (64, 48, 6)); + assert_eq!(d.icc.as_deref(), Some(&icc[..])); + assert_eq!(d.xmp.as_deref(), Some("")); + let got = d.to_srgb8(); + let err: f64 = got.data.iter().zip(&img.data).flat_map(|(a, b)| (0..3).map(move |k| (a[k] as f64 - b[k] as f64).abs())).sum::() + / (64.0 * 48.0 * 3.0); + assert!(err < 6.0, "mean error {err}"); + // no metadata: the encoder's own file + let plain = encode_webp_lossy(&e, 90, &EncodeMeta::default()).unwrap(); + assert!(decode(&plain, DecodeOptions::default()).is_ok()); + // alpha survives + let mut see = img.clone(); + see.data.iter_mut().enumerate().for_each(|(i, p)| p[3] = if i % 2 == 0 { 255 } else { 0 }); + let a = encode_webp_lossy(&EncodeImage::rgba8(&see), 90, &meta).unwrap(); + let d = decode(&a, DecodeOptions::default()).unwrap(); + assert!(d.alpha.is_some(), "the transparency is kept"); + // grey and RGB inputs + let grey = vec![128u8; 16 * 8]; + assert!(encode_webp_lossy(&EncodeImage::new(16, 8, 1, Samples::U8(&grey)), 50, &meta).is_ok()); + // a smaller file at a lower quality + let noisy: Vec = (0..128 * 96 * 3).map(|i| ((i * 7919) % 251) as u8).collect(); + let n = EncodeImage::new(128, 96, 3, Samples::U8(&noisy)); + assert!(encode_webp_lossy(&n, 20, &meta).unwrap().len() < encode_webp_lossy(&n, 95, &meta).unwrap().len()); + // hostile: too wide, quality out of range, wrong depth + let wide = vec![0u8; (WEBP_MAX_SIDE as usize + 1) * 3]; + assert!(encode_webp_lossy(&EncodeImage::new(WEBP_MAX_SIDE + 1, 1, 3, Samples::U8(&wide)), 90, &meta).is_err()); + assert!(encode_webp_lossy(&n, 0, &meta).is_ok() && encode_webp_lossy(&n, 255, &meta).is_ok()); + let deep = vec![0u16; 4 * 4 * 3]; + assert!(encode_webp_lossy(&EncodeImage::new(4, 4, 3, Samples::U16(&deep)), 90, &meta).is_err()); +} + #[test] fn gif_and_bmp_decode() { use image::ImageEncoder; diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rs index 5599c0d833..3b8a4a17f5 100644 --- a/crates/engine/src/export.rs +++ b/crates/engine/src/export.rs @@ -878,6 +878,9 @@ pub struct ExportOptions { pub hdr_transfer: HdrCurve, /// JPEG XL: mathematically lossless instead of lossy (`quality` is then unused). pub jxl_lossless: bool, + /// WebP: lossless instead of lossy at `quality` (#1482). Builds without lossy WebP ([`lcc_codecs::WEBP_LOSSY`]: + /// the web, Android) always write lossless. + pub webp_lossless: bool, /// JPEG XL: encoder effort (time spent for a smaller file). pub jxl_effort: JxlEffort, /// JPEG XL: progressive file (a coarse image first, refined as it loads). @@ -925,6 +928,7 @@ impl Default for ExportOptions { hdr_mode: HdrMode::SingleLayer, hdr_transfer: HdrCurve::Pq, jxl_lossless: false, + webp_lossless: false, jxl_effort: JxlEffort::Normal, jxl_progressive: false, add_to_photos: false, @@ -976,6 +980,7 @@ pub const OPTION_PARAMS: &[&str] = &[ "hdrMode", "hdrTransfer", "jxlLossless", + "webpLossless", "jxlEffort", "jxlProgressive", "addToPhotos", @@ -1051,6 +1056,11 @@ fn watermark_from_json(v: &serde_json::Value) -> serde_json::Result { } impl ExportOptions { + /// Whether a WebP export is lossy: asked for, and this build has the encoder ([`lcc_codecs::WEBP_LOSSY`]). + pub fn webp_lossy(&self) -> bool { + !self.webp_lossless && lcc_codecs::WEBP_LOSSY + } + /// Stored export settings (a saved preset, `prefs.json ▸ lastExport`) with the keys an older or /// newer version may have written and this one doesn't know dropped, also inside `watermark`. /// [`ExportOptions::validate`] is strict about what a caller types; settings saved on disk are @@ -1197,7 +1207,7 @@ impl ExportOptions { } serde_json::from_value::(v.clone()).map_err(|e| bad(format!("`{k}`: {e}")))?; } - "dontEnlarge" | "removeLocation" | "background" | "hdr" | "jxlLossless" | "jxlProgressive" => { + "dontEnlarge" | "removeLocation" | "background" | "hdr" | "jxlLossless" | "webpLossless" | "jxlProgressive" => { boolean(k, v)?; } "addToPhotos" => { @@ -1421,6 +1431,7 @@ impl ExportOptions { hdr_mode: s("hdrMode").and_then(HdrMode::parse).unwrap_or(d.hdr_mode), hdr_transfer: s("hdrTransfer").and_then(HdrCurve::parse).unwrap_or(d.hdr_transfer), jxl_lossless: p.get("jxlLossless").and_then(Value::as_bool).unwrap_or(d.jxl_lossless), + webp_lossless: p.get("webpLossless").and_then(Value::as_bool).unwrap_or(d.webp_lossless), jxl_effort: s("jxlEffort").and_then(JxlEffort::parse).unwrap_or(d.jxl_effort), jxl_progressive: p.get("jxlProgressive").and_then(Value::as_bool).unwrap_or(d.jxl_progressive), add_to_photos: p.get("addToPhotos").and_then(Value::as_bool).unwrap_or(d.add_to_photos), @@ -1793,6 +1804,7 @@ fn encode_8bit(img: &Rgba8, o: &ExportOptions, meta: Option<&Metadata>) -> Resul ExportFormat::Png => encode::encode_png(&e, &meta), ExportFormat::Tiff => encode::encode_tiff_associated(&e, o.tiff_compression, &meta), ExportFormat::Psd => encode::encode_psd(&e, &meta), + ExportFormat::Webp if o.webp_lossy() => encode::encode_webp_lossy(&e, o.quality, &meta), ExportFormat::Webp => encode::encode_webp_lossless(&e, &meta), ExportFormat::Avif => encode::encode_avif(&e, o.quality, 8, &meta), ExportFormat::Jxl => lcc_codecs::encode_jxl(&e, &o.jxl(space, false), &meta), @@ -4084,7 +4096,7 @@ mod tests { let metadata = Metadata { copyright: Some("Synthetic export test".into()), ..Default::default() }; for format in [ExportFormat::Png, ExportFormat::Tiff, ExportFormat::Webp] { for compression in [TiffCompression::None, TiffCompression::Lzw, TiffCompression::Deflate, TiffCompression::PackBits] { - let options = ExportOptions { format, tiff_compression: compression, ..Default::default() }; + let options = ExportOptions { format, tiff_compression: compression, webp_lossless: true, ..Default::default() }; let bytes = encode_with_metadata(&img, &options, Some(&metadata)).unwrap(); let decoded = lcc_codecs::decode(&bytes, Default::default()).unwrap(); assert!(!decoded.has_alpha, "{format:?}/{compression:?} must be RGB"); @@ -4107,13 +4119,38 @@ mod tests { let mut img = test_image(); img.data[0][3] = 128; for format in [ExportFormat::Png, ExportFormat::Tiff, ExportFormat::Webp] { - let bytes = encode_image(&img, &ExportOptions { format, ..Default::default() }).unwrap(); + let bytes = encode_image(&img, &ExportOptions { format, webp_lossless: true, ..Default::default() }).unwrap(); let decoded = lcc_codecs::decode(&bytes, Default::default()).unwrap(); assert!(decoded.has_alpha, "{format:?} must retain real alpha"); assert_eq!(decoded.to_srgb8().data, img.data, "{format:?} samples"); } } + /// WebP is lossy at the export quality unless Lossless is on (#1482): smaller than the lossless file, close to + /// the picture, with its profile and transparency; a build without the encoder writes lossless. + #[test] + fn webp_exports_lossy_at_the_quality_or_lossless() { + let mut img = test_image(); + let lossless = encode_image(&img, &ExportOptions { format: ExportFormat::Webp, webp_lossless: true, ..Default::default() }).unwrap(); + let o = ExportOptions { format: ExportFormat::Webp, quality: 80, ..Default::default() }; + assert_eq!(o.webp_lossy(), lcc_codecs::WEBP_LOSSY); + let lossy = encode_image(&img, &o).unwrap(); + let d = lcc_codecs::decode(&lossy, Default::default()).unwrap(); + assert_eq!((d.width, d.height), (96, 64)); + assert_eq!(d.icc.as_deref(), Some(icc::write_named(NamedSpace::Srgb).as_slice())); + if lcc_codecs::WEBP_LOSSY { + assert!(lossy.len() < lossless.len(), "{} vs {}", lossy.len(), lossless.len()); + let got = d.to_srgb8(); + let err = got.data.iter().zip(&img.data).map(|(a, b)| (a[0] as i32 - b[0] as i32).abs()).sum::() as f64 / got.data.len() as f64; + assert!(err < 8.0, "mean error {err}"); + } else { + assert_eq!(d.to_srgb8().data, img.data, "lossless without the encoder"); + } + img.data[0][3] = 128; + let d = lcc_codecs::decode(&encode_image(&img, &o).unwrap(), Default::default()).unwrap(); + assert!(d.has_alpha, "transparency kept"); + } + /// Issue #2976: on a transparent area of an export that keeps alpha, the watermark composites /// over it and raises the alpha, so it shows; opaque pixels blend as before. #[test] diff --git a/crates/mcp/src/headless.rs b/crates/mcp/src/headless.rs index 5963b9480a..34f6bed2fb 100644 --- a/crates/mcp/src/headless.rs +++ b/crates/mcp/src/headless.rs @@ -192,7 +192,7 @@ impl Backend for Headless { "engine.commands" => { let mut v: Vec = self.session.commands().into_iter().map(|c| serde_json::to_value(c).unwrap_or_default()).collect(); v.push(json!({"id": "app.export", "label": "Export Now", "menu": [], "shortcut": null, - "params": "{path?: output file (.jpg/.png/.tif/.webp/.avif/.jxl/.exr/.psd/.dng) | dir?, ids?, preset?, format?: jpeg|png|tiff|webp|avif|jxl|exr|psd|dng|original, exrPrimaries?: rec2020|acescg, longEdge?|shortEdge?|width?|height?|megapixels?|percent? (default longEdge 3000; longEdge 0 = full size), fit?: dimensions|widthHeight (with width + height: dimensions fits either orientation, widthHeight limits the width to `width` and the height to `height`), dontEnlarge?, ppi?, quality?: 1..100, jxlLossless?, jxlEffort?: fast|normal, jxlProgressive?, videoFormat?: h264|prores (video clips export as movies: trim + video edits), videoQuality?: 1..100, videoMaxSide?: px (0 = clip size), limitKb?, colorSpace?: srgb|displayP3|adobeRgb|proPhoto|rec2020, bitDepth?: 8|10|16|32, hdr? (HDR output for HDR edits: gain map JPEG, PQ AVIF / PNG / JPEG XL, float TIFF), hdrMode?: hdr|gainMap (AVIF and JPEG XL: one HDR image, the default, or an SDR image with a gain map), sharpen?: none|screen|matte|glossy, sharpenAmount?: low|standard|high, metadata?: all|allExceptCamera|copyright|copyrightContact|none, removeLocation?, naming?, startNumber?, customText? (the {custom} token), destinationMode?: specificFolder|sameAsOriginal|chooseLater (sameAsOriginal = each photo into its original's folder, `dir` unused; chooseLater = the desktop app asks for the folder when the export starts, elsewhere `dir` as specificFolder), subfolder? (one folder name), conflict?: unique|overwrite|skip, tiffCompression?: none|lzw|zip, dngCompression?: lossless|deflate|uncompressed, addToPhotos?: bool (macOS: then add the files written to Apple Photos; outcome in `applePhotos`), photosAlbum?: top-level album name (made when missing), watermark?: text | {text?, vertical? (upright columns, right to left), size? (text height, 0.005..0.5 of the short edge; default 0.035), opacity? (0..1; 0.7), anchor?: topLeft|top|topRight|left|center|right|bottomLeft|bottom|bottomRight, insetX? (margin from the left/right edge, 0..0.4 of the short edge; 0.025), insetY? (from the top/bottom edge; 0.025), inset? (sets both), rotation?: 0|90|180|270 (degrees clockwise; 0), color? [r,g,b] sRGB, shadow?, image? (graphic drawn instead of the text), imageWidth? (0.01..1 of the photo's width; 0.2)}}: an unknown parameter, an out-of-range watermark size or a value of the wrong kind is an error, not a default", + "params": "{path?: output file (.jpg/.png/.tif/.webp/.avif/.jxl/.exr/.psd/.dng) | dir?, ids?, preset?, format?: jpeg|png|tiff|webp|avif|jxl|exr|psd|dng|original, exrPrimaries?: rec2020|acescg, longEdge?|shortEdge?|width?|height?|megapixels?|percent? (default longEdge 3000; longEdge 0 = full size), fit?: dimensions|widthHeight (with width + height: dimensions fits either orientation, widthHeight limits the width to `width` and the height to `height`), dontEnlarge?, ppi?, quality?: 1..100, jxlLossless?, webpLossless?, jxlEffort?: fast|normal, jxlProgressive?, videoFormat?: h264|prores (video clips export as movies: trim + video edits), videoQuality?: 1..100, videoMaxSide?: px (0 = clip size), limitKb?, colorSpace?: srgb|displayP3|adobeRgb|proPhoto|rec2020, bitDepth?: 8|10|16|32, hdr? (HDR output for HDR edits: gain map JPEG, PQ AVIF / PNG / JPEG XL, float TIFF), hdrMode?: hdr|gainMap (AVIF and JPEG XL: one HDR image, the default, or an SDR image with a gain map), sharpen?: none|screen|matte|glossy, sharpenAmount?: low|standard|high, metadata?: all|allExceptCamera|copyright|copyrightContact|none, removeLocation?, naming?, startNumber?, customText? (the {custom} token), destinationMode?: specificFolder|sameAsOriginal|chooseLater (sameAsOriginal = each photo into its original's folder, `dir` unused; chooseLater = the desktop app asks for the folder when the export starts, elsewhere `dir` as specificFolder), subfolder? (one folder name), conflict?: unique|overwrite|skip, tiffCompression?: none|lzw|zip, dngCompression?: lossless|deflate|uncompressed, addToPhotos?: bool (macOS: then add the files written to Apple Photos; outcome in `applePhotos`), photosAlbum?: top-level album name (made when missing), watermark?: text | {text?, vertical? (upright columns, right to left), size? (text height, 0.005..0.5 of the short edge; default 0.035), opacity? (0..1; 0.7), anchor?: topLeft|top|topRight|left|center|right|bottomLeft|bottom|bottomRight, insetX? (margin from the left/right edge, 0..0.4 of the short edge; 0.025), insetY? (from the top/bottom edge; 0.025), inset? (sets both), rotation?: 0|90|180|270 (degrees clockwise; 0), color? [r,g,b] sRGB, shadow?, image? (graphic drawn instead of the text), imageWidth? (0.01..1 of the photo's width; 0.2)}}: an unknown parameter, an out-of-range watermark size or a value of the wrong kind is an error, not a default", "enabled": self.session.active().is_some()})); Ok(Value::Array(v)) } diff --git a/crates/mcp/src/tools.rs b/crates/mcp/src/tools.rs index 1a1f7a2a6d..54f36d1933 100644 --- a/crates/mcp/src/tools.rs +++ b/crates/mcp/src/tools.rs @@ -253,6 +253,7 @@ pub fn helper_tools(has_ui: bool) -> Vec { "ppi": {"type": "integer", "description": "Print resolution written into the file (default 240)"}, "quality": {"type": "integer", "description": "JPEG/AVIF/lossy JPEG XL quality 1..100"}, "jxlLossless": {"type": "boolean", "description": "JPEG XL: mathematically lossless (quality unused); default false"}, + "webpLossless": {"type": "boolean", "description": "WebP: lossless instead of lossy at `quality`; default false (builds without lossy WebP, such as the web, always write lossless)"}, "jxlEffort": {"type": "string", "enum": ["fast", "normal"], "description": "JPEG XL encoder effort: normal (default) makes files about a quarter smaller than fast, in about twice the time"}, "jxlProgressive": {"type": "boolean", "description": "JPEG XL: progressive file, a coarse image first (default false)"}, "exrPrimaries": {"type": "string", "enum": ["rec2020", "acescg"], "description": "OpenEXR: primaries of the linear samples, written into the file (default rec2020)"}, diff --git a/crates/ui-egui/locales/fork/cs.json b/crates/ui-egui/locales/fork/cs.json index cc53aa1a99..5470b720dc 100644 --- a/crates/ui-egui/locales/fork/cs.json +++ b/crates/ui-egui/locales/fork/cs.json @@ -966,6 +966,7 @@ "Every device keeps the originals and can add photos.": "Každé zařízení uchovává originály a může přidávat fotky.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Všechny složky, které {app} používá. Změny platí ihned; každá je také na vlastní kartě.", "Every photo here is in the catalog already": "Všechny fotografie zde už jsou v katalogu", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Každý pixel zachován přesně (větší soubory); vypnuto: menší soubory v Kvalitě níže", "Every selected photo is edited the same way.": "Všechny vybrané fotky se upraví stejně.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Všechny návrhy byly odmítnuty: odmítnutý obličej zůstává neznámý a už se jako tato osoba nenavrhuje.", "Every time the app exits": "Při každém ukončení aplikace", @@ -3317,6 +3318,7 @@ "This spot has no colour to defringe: click on the fringe itself": "Toto místo nemá barvu k odstranění lemu: klikněte přímo na lem", "This version has no AI features to download.": "Tato verze nemá žádné funkce AI ke stažení.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Tato verze už v Immich je. Immich neumí nahradit soubor, takže nové uložení se nahraje jako nová položka navrch sady.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Tato verze zapisuje jen bezeztrátový WebP: ztrátový WebP je v desktopové aplikaci", "This {app} can't install it: open {app}.lplug4 from the {app} download to install it in Logi Options+.": "Tato instalace {app} jej nemůže nainstalovat: otevřete {app}.lplug4 ze staženého balíku {app} a nainstalujte jej do Logi Options+.", "Three with Caption": "Tři s popiskem", "Tile Cache": "Mezipaměť dlaždic", diff --git a/crates/ui-egui/locales/fork/de.json b/crates/ui-egui/locales/fork/de.json index 44dce7f73e..5f99d52a76 100644 --- a/crates/ui-egui/locales/fork/de.json +++ b/crates/ui-egui/locales/fork/de.json @@ -931,6 +931,7 @@ "Every device keeps the originals and can add photos.": "Jedes Gerät behält die Originale und kann Fotos hinzufügen.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Alle Ordner, die {app} verwendet. Änderungen gelten sofort; jeder steht auch auf seinem eigenen Tab.", "Every photo here is in the catalog already": "Jedes Foto hier ist schon im Katalog", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Jedes Pixel bleibt exakt erhalten (größere Dateien); aus: kleinere Dateien mit der Qualität darunter", "Every selected photo is edited the same way.": "Alle ausgewählten Fotos werden gleich bearbeitet.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Alle Vorschläge wurden abgelehnt: ein abgelehntes Gesicht bleibt unbekannt und wird nicht mehr als diese Person vorgeschlagen.", "Every time the app exits": "Bei jedem Beenden der App", @@ -3189,6 +3190,7 @@ "This spot has no colour to defringe: click on the fringe itself": "Diese Stelle hat keine Farbe zum Entfernen von Farbsäumen: Klicken Sie direkt auf den Farbsaum", "This version has no AI features to download.": "Diese Version hat keine KI-Funktionen zum Herunterladen.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Diese Version ist bereits in Immich. Immich kann keine Datei ersetzen, daher wird die neue Speicherung als neues Asset oben im Stapel hochgeladen.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Diese Version schreibt nur verlustfreies WebP: verlustbehaftetes WebP gibt es in der Desktop-App", "Three with Caption": "Drei mit Bildunterschrift", "Thumbnail size": "Miniaturgröße", "Tick the box to accept the model's terms first": "Setze zuerst das Häkchen, um die Bedingungen des Modells zu akzeptieren", diff --git a/crates/ui-egui/locales/fork/es.json b/crates/ui-egui/locales/fork/es.json index 11d59616e9..951af07a42 100644 --- a/crates/ui-egui/locales/fork/es.json +++ b/crates/ui-egui/locales/fork/es.json @@ -1011,6 +1011,7 @@ "Every device keeps the originals and can add photos.": "Cada dispositivo conserva los originales y puede añadir fotos.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Todas las carpetas que usa {app}. Los cambios se aplican al instante; cada una está también en su propia pestaña.", "Every photo here is in the catalog already": "Todas las fotos de aquí ya están en el catálogo", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Cada píxel se conserva exactamente (archivos más grandes); desactivado: archivos más pequeños con la Calidad de abajo", "Every selected photo is edited the same way.": "Todas las fotos seleccionadas se editan del mismo modo.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Todas las sugerencias se rechazaron: una cara rechazada sigue siendo desconocida y no se vuelve a sugerir como esa persona.", "Every time the app exits": "Cada vez que se cierra la app", @@ -3440,6 +3441,7 @@ "This spot has no colour to defringe: click on the fringe itself": "Este punto no tiene color que corregir: haz clic en el propio borde de color", "This version has no AI features to download.": "Esta versión no tiene funciones de IA para descargar.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Esta versión ya está en Immich. Immich no puede sustituir un archivo, así que el nuevo guardado se sube como un recurso nuevo encima de la pila.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Esta versión solo escribe WebP sin pérdida: el WebP con pérdida está en la aplicación de escritorio", "Three with Caption": "Tres con pie de foto", "Thumbnail size": "Tamaño de miniatura", "Tick the box to accept the model's terms first": "Marque primero la casilla para aceptar las condiciones del modelo", diff --git a/crates/ui-egui/locales/fork/fi.json b/crates/ui-egui/locales/fork/fi.json index 5b303a8d21..0ae0b1ffaa 100644 --- a/crates/ui-egui/locales/fork/fi.json +++ b/crates/ui-egui/locales/fork/fi.json @@ -1015,6 +1015,7 @@ "Every device keeps the originals and can add photos.": "Jokainen laite säilyttää alkuperäiset ja voi lisätä kuvia.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Kaikki kansiot, joita {app} käyttää. Muutokset tulevat voimaan heti; kukin on myös omalla välilehdellään.", "Every photo here is in the catalog already": "Kaikki täällä olevat kuvat ovat jo katalogissa", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Jokainen pikseli säilyy tarkasti (suuremmat tiedostot); pois: pienemmät tiedostot alla olevalla laadulla", "Every selected photo is edited the same way.": "Kaikki valitut kuvat muokataan samalla tavalla.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Kaikki ehdotukset hylättiin: hylätty kasvo jää tuntemattomaksi, eikä sitä enää ehdoteta kyseiseksi henkilöksi.", "Every time the app exits": "Aina kun sovellus suljetaan", @@ -3506,6 +3507,7 @@ "This version doesn't come with an AI Denoise model, and none can be downloaded from here yet.": "Tämän version mukana ei tule tekoälykohinanpoiston mallia, eikä sellaista voi vielä ladata täältä.", "This version has no AI features to download.": "Tässä versiossa ei ole ladattavia tekoälyominaisuuksia.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Tämä versio on jo Immichissä. Immich ei voi korvata tiedostoa, joten uusi tallennus lähetetään uutena kohteena pinon päällimmäiseksi.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Tämä versio kirjoittaa vain häviötöntä WebP:tä: häviöllinen WebP on työpöytäsovelluksessa", "This {app} can't install it: open {app}.lplug4 from the {app} download to install it in Logi Options+.": "Tämä versio ({app}) ei voi asentaa sitä: avaa {app}.lplug4 latauspaketista ({app}) asentaaksesi sen Logi Options+ -ohjelmaan.", "Three with Caption": "Kolme kuvatekstillä", "Tile Cache": "Karttatiilien välimuisti", diff --git a/crates/ui-egui/locales/fork/fr.json b/crates/ui-egui/locales/fork/fr.json index 4dea6c0423..f14c3e3359 100644 --- a/crates/ui-egui/locales/fork/fr.json +++ b/crates/ui-egui/locales/fork/fr.json @@ -920,6 +920,7 @@ "Every device keeps the originals and can add photos.": "Chaque appareil garde les originaux et peut ajouter des photos.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Tous les dossiers utilisés par {app}. Les modifications s’appliquent immédiatement ; chacun figure aussi dans son propre onglet.", "Every photo here is in the catalog already": "Toutes les photos ici sont déjà dans le catalogue", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Chaque pixel conservé à l'identique (fichiers plus gros) ; désactivé : fichiers plus petits à la Qualité ci-dessous", "Every selected photo is edited the same way.": "Toutes les photos sélectionnées sont modifiées de la même façon.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Toutes les suggestions ont été rejetées : un visage rejeté reste inconnu et n'est plus suggéré comme cette personne.", "Every time the app exits": "À chaque fermeture de l’application", @@ -3140,6 +3141,7 @@ "This spot has no colour to defringe: click on the fringe itself": "Ce point n'a pas de couleur à corriger : cliquez sur la frange elle-même", "This version has no AI features to download.": "Cette version n’a aucune fonction d’IA à télécharger.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Cette version est déjà dans Immich. Immich ne peut pas remplacer un fichier : le nouvel enregistrement est envoyé comme nouvel élément en haut de la pile.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Cette version n'écrit que du WebP sans perte : le WebP avec perte est dans l'application de bureau", "Three with Caption": "Trois avec légende", "Thumbnail size": "Taille des vignettes", "Tile Cache": "Cache de tuiles", diff --git a/crates/ui-egui/locales/fork/id.json b/crates/ui-egui/locales/fork/id.json index 9025748bdf..2cb0ea1fef 100644 --- a/crates/ui-egui/locales/fork/id.json +++ b/crates/ui-egui/locales/fork/id.json @@ -1013,6 +1013,7 @@ "Every device keeps the originals and can add photos.": "Setiap perangkat menyimpan aslinya dan dapat menambahkan foto.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Semua folder yang dipakai {app}. Perubahan langsung berlaku; masing-masing juga ada di tabnya sendiri.", "Every photo here is in the catalog already": "Semua foto di sini sudah ada di katalog", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Setiap piksel dipertahankan persis (berkas lebih besar); mati: berkas lebih kecil pada Kualitas di bawah", "Every selected photo is edited the same way.": "Semua foto yang dipilih diedit dengan cara yang sama.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Semua saran ditolak: wajah yang ditolak tetap tak dikenal dan tidak lagi disarankan sebagai orang itu.", "Every time the app exits": "Setiap kali aplikasi ditutup", @@ -3515,6 +3516,7 @@ "This version doesn't come with an AI Denoise model, and none can be downloaded from here yet.": "Versi ini tidak disertai model Pengurangan noise AI, dan belum ada yang bisa diunduh dari sini.", "This version has no AI features to download.": "Versi ini tidak memiliki fitur AI untuk diunduh.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Versi ini sudah ada di Immich. Immich tidak dapat mengganti file, sehingga simpanan baru diunggah sebagai aset baru di atas tumpukan.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Versi ini hanya menulis WebP lossless: WebP lossy ada di aplikasi desktop", "This {app} can't install it: open {app}.lplug4 from the {app} download to install it in Logi Options+.": "{app} ini tidak dapat menginstalnya: buka {app}.lplug4 dari unduhan {app} untuk menginstalnya di Logi Options+.", "Three with Caption": "Tiga dengan keterangan", "Thumbnail size": "Ukuran thumbnail", diff --git a/crates/ui-egui/locales/fork/it.json b/crates/ui-egui/locales/fork/it.json index 2d9e57be1e..6e88710b10 100644 --- a/crates/ui-egui/locales/fork/it.json +++ b/crates/ui-egui/locales/fork/it.json @@ -961,6 +961,7 @@ "Every device keeps the originals and can add photos.": "Ogni dispositivo conserva gli originali e può aggiungere foto.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Tutte le cartelle che {app} usa. Le modifiche si applicano subito; ognuna è anche nella propria scheda.", "Every photo here is in the catalog already": "Tutte le foto qui sono già nel catalogo", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Ogni pixel conservato esattamente (file più grandi); disattivato: file più piccoli con la Qualità qui sotto", "Every selected photo is edited the same way.": "Tutte le foto selezionate vengono modificate allo stesso modo.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Tutti i suggerimenti sono stati scartati: un volto scartato resta sconosciuto e non viene più suggerito come quella persona.", "Every time the app exits": "A ogni chiusura dell'app", @@ -3316,6 +3317,7 @@ "This spot has no colour to defringe: click on the fringe itself": "Questo punto non ha colore da correggere: fai clic sull'alone stesso", "This version has no AI features to download.": "Questa versione non ha funzioni IA da scaricare.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Questa versione è già su Immich. Immich non può sostituire un file, quindi il nuovo salvataggio viene caricato come nuovo asset in cima alla pila.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Questa versione scrive solo WebP senza perdita: il WebP con perdita è nell'app desktop", "This {app} can't install it: open {app}.lplug4 from the {app} download to install it in Logi Options+.": "Questa installazione di {app} non può installarlo: apri {app}.lplug4 dal download di {app} per installarlo in Logi Options+.", "Three with Caption": "Tre con didascalia", "Thumbnail size": "Dimensione delle miniature", diff --git a/crates/ui-egui/locales/fork/ja.json b/crates/ui-egui/locales/fork/ja.json index f528243f21..1333d9391b 100644 --- a/crates/ui-egui/locales/fork/ja.json +++ b/crates/ui-egui/locales/fork/ja.json @@ -1013,6 +1013,7 @@ "Every device keeps the originals and can add photos.": "すべてのデバイスが元画像を保持し、写真を追加できます。", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "{app} が使うすべてのフォルダー。変更はすぐに適用されます。それぞれ専用のタブにもあります。", "Every photo here is in the catalog already": "ここの写真はすべてカタログにあります", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "すべてのピクセルを正確に保持します(ファイルは大きくなります)。オフ:下の品質で小さなファイル", "Every selected photo is edited the same way.": "選択したすべての写真が同じ方法で編集されます。", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "候補はすべて不採用になりました。不採用にした顔は不明のままで、その人物として再び候補になることはありません。", "Every time the app exits": "アプリを終了するたび", @@ -3442,6 +3443,7 @@ "This spot has no colour to defringe: click on the fringe itself": "この位置には色のにじみがありません。にじみそのものをクリックしてください", "This version has no AI features to download.": "このバージョンにはダウンロードできる AI 機能はありません。", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "このバージョンはすでに Immich にあります。Immich はファイルを置き換えられないため、新しい保存はスタックの一番上に新しいアセットとしてアップロードされます。", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "このバージョンはロスレス WebP のみ書き出します。非可逆 WebP はデスクトップアプリにあります", "Three with Caption": "3 枚とキャプション", "Thumbnail size": "サムネールのサイズ", "Tick the box to accept the model's terms first": "先にチェックボックスをオンにして、モデルの利用条件に同意してください", diff --git a/crates/ui-egui/locales/fork/ka.json b/crates/ui-egui/locales/fork/ka.json index 547e20bc59..ec778a6482 100644 --- a/crates/ui-egui/locales/fork/ka.json +++ b/crates/ui-egui/locales/fork/ka.json @@ -1076,6 +1076,7 @@ "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "ყველა საქაღალდე, რომელსაც {app} იყენებს. ცვლილებები მაშინვე მოქმედებს; თითოეული საკუთარ ჩანართზეც არის.", "Every photo cropped to fill the whole screen, with slow crossfades.": "ყველა ფოტო ჩამოჭრილია მთელი ეკრანის შესავსებად, ნელი გადადინებებით.", "Every photo here is in the catalog already": "აქ ყველა ფოტო უკვე კატალოგშია", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "ყველა პიქსელი ზუსტად ინახება (უფრო დიდი ფაილები); გამორთული: უფრო პატარა ფაილები ქვემოთ მოცემული ხარისხით", "Every selected photo is edited the same way.": "ყველა მონიშნული ფოტო ერთნაირად რედაქტირდება.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "ყველა შეთავაზება უარყოფილია: უარყოფილი სახე უცნობად რჩება და აღარ შემოგვთავაზებს როგორც ეს ადამიანი.", "Every time the app exits": "აპიდან ყოველი გასვლისას", @@ -3708,6 +3709,7 @@ "This version doesn't come with an AI Denoise model, and none can be downloaded from here yet.": "ეს ვერსია AI ხმაურის მოცილების მოდელს არ შეიცავს და აქედან ჩამოტვირთვა ჯერ შეუძლებელია.", "This version has no AI features to download.": "ამ ვერსიას ჩამოსატვირთი AI ფუნქციები არ აქვს.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "ეს ვერსია უკვე Immich-შია. Immich-ს ფაილის ჩანაცვლება არ შეუძლია, ამიტომ ახალი შენახვა დასტის თავზე ახალ ფაილად აიტვირთება.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "ეს ვერსია მხოლოდ დანაკარგის გარეშე WebP-ს წერს: დანაკარგიანი WebP დესკტოპის აპშია", "This {app} can't install it: open {app}.lplug4 from the {app} download to install it in Logi Options+.": "აპის ამ ვერსიას ({app}) მისი ინსტალაცია არ შეუძლია: Logi Options+-ში დასაინსტალირებლად გახსენით ფაილი {app}.lplug4 აპის ჩამოტვირთული პაკეტიდან ({app}).", "Three with Caption": "სამი, წარწერით", "Thumbnail size": "ესკიზის ზომა", diff --git a/crates/ui-egui/locales/fork/pl.json b/crates/ui-egui/locales/fork/pl.json index 16faf4d9ac..1fd8d20e58 100644 --- a/crates/ui-egui/locales/fork/pl.json +++ b/crates/ui-egui/locales/fork/pl.json @@ -1041,6 +1041,7 @@ "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Wszystkie foldery używane przez {app}. Zmiany działają od razu; każdy jest też na własnej karcie.", "Every photo cropped to fill the whole screen, with slow crossfades.": "Każde zdjęcie przycięte, by wypełnić cały ekran, z powolnym przenikaniem.", "Every photo here is in the catalog already": "Wszystkie te zdjęcia są już w katalogu", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Każdy piksel zachowany dokładnie (większe pliki); wyłączone: mniejsze pliki przy Jakości poniżej", "Every selected photo is edited the same way.": "Wszystkie zaznaczone zdjęcia są edytowane tak samo.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Wszystkie sugestie odrzucono: odrzucona twarz pozostaje nieznana i nie jest już sugerowana jako ta osoba.", "Every time the app exits": "Przy każdym zamknięciu aplikacji", @@ -3553,6 +3554,7 @@ "This spot has no colour to defringe: click on the fringe itself": "W tym miejscu nie ma koloru do usunięcia: kliknij samą obwódkę", "This version has no AI features to download.": "Ta wersja nie ma funkcji AI do pobrania.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Ta wersja jest już w Immich. Immich nie może zastąpić pliku, więc nowy zapis zostanie przesłany jako nowy zasób na wierzchu stosu.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Ta wersja zapisuje tylko bezstratny WebP: stratny WebP jest w aplikacji na komputer", "This {app} can't install it: open {app}.lplug4 from the {app} download to install it in Logi Options+.": "Ta wersja {app} nie może go zainstalować: otwórz {app}.lplug4 z pobranych plików {app}, aby zainstalować go w Logi Options+.", "Three with Caption": "Trzy z podpisem", "Thumbnail size": "Rozmiar miniatur", diff --git a/crates/ui-egui/locales/fork/pt-br.json b/crates/ui-egui/locales/fork/pt-br.json index fb9fdc749d..7d9e01a466 100644 --- a/crates/ui-egui/locales/fork/pt-br.json +++ b/crates/ui-egui/locales/fork/pt-br.json @@ -1013,6 +1013,7 @@ "Every device keeps the originals and can add photos.": "Cada dispositivo mantém os originais e pode adicionar fotos.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Todas as pastas que o {app} usa. As mudanças valem na hora; cada uma também está em sua própria aba.", "Every photo here is in the catalog already": "Todas as fotos aqui já estão no catálogo", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Cada pixel mantido exatamente (arquivos maiores); desligado: arquivos menores na Qualidade abaixo", "Every selected photo is edited the same way.": "Todas as fotos selecionadas são editadas da mesma forma.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Todas as sugestões foram rejeitadas: um rosto rejeitado permanece desconhecido e não é mais sugerido como essa pessoa.", "Every time the app exits": "Sempre que o app for fechado", @@ -3439,6 +3440,7 @@ "This spot has no colour to defringe: click on the fringe itself": "Este ponto não tem cor para corrigir: clique na própria franja", "This version has no AI features to download.": "Esta versão não tem recursos de IA para baixar.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Esta versão já está no Immich. O Immich não consegue substituir um arquivo, então o novo salvamento é enviado como um novo recurso no topo da pilha.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Esta versão grava só WebP sem perdas: o WebP com perdas está no aplicativo para computador", "Three with Caption": "Três com legenda", "Thumbnail size": "Tamanho da miniatura", "Tick the box to accept the model's terms first": "Marque a caixa para aceitar primeiro os termos do modelo", diff --git a/crates/ui-egui/locales/fork/ru.json b/crates/ui-egui/locales/fork/ru.json index acd65381d0..4db3dc80eb 100644 --- a/crates/ui-egui/locales/fork/ru.json +++ b/crates/ui-egui/locales/fork/ru.json @@ -1014,6 +1014,7 @@ "Every device keeps the originals and can add photos.": "Каждое устройство хранит оригиналы и может добавлять фото.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Все папки, которые использует {app}. Изменения применяются сразу; каждая также есть на своей вкладке.", "Every photo here is in the catalog already": "Все фото здесь уже есть в каталоге", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Каждый пиксель сохраняется точно (файлы больше); выкл.: файлы меньше с качеством ниже", "Every selected photo is edited the same way.": "Все выбранные фото редактируются одинаково.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Все предложения отклонены: отклонённое лицо остаётся неизвестным, и оно больше не предлагается как этот человек.", "Every time the app exits": "При каждом выходе из приложения", @@ -3427,6 +3428,7 @@ "This spot has no colour to defringe: click on the fringe itself": "В этой точке нет цвета для устранения каймы: щёлкните прямо по кайме", "This version has no AI features to download.": "В этой версии нет функций ИИ для загрузки.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Эта версия уже есть в Immich. Immich не умеет заменять файл, поэтому новое сохранение загружается как новый объект наверх стопки.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Эта версия пишет только WebP без потерь: WebP с потерями есть в настольном приложении", "Three with Caption": "Три с подписью", "Thumbnail size": "Размер миниатюр", "Tile Cache": "Кэш тайлов", diff --git a/crates/ui-egui/locales/fork/sv.json b/crates/ui-egui/locales/fork/sv.json index f87ff8305a..f3a39bc1fe 100644 --- a/crates/ui-egui/locales/fork/sv.json +++ b/crates/ui-egui/locales/fork/sv.json @@ -1037,6 +1037,7 @@ "Every device keeps the originals and can add photos.": "Varje enhet behåller originalen och kan lägga till foton.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Alla mappar som {app} använder. Ändringar gäller direkt; var och en finns också på en egen flik.", "Every photo here is in the catalog already": "Alla foton här finns redan i katalogen", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Varje pixel bevaras exakt (större filer); av: mindre filer med kvaliteten nedan", "Every selected photo is edited the same way.": "Alla markerade foton redigeras på samma sätt.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Alla förslag avvisades: ett avvisat ansikte förblir okänt och föreslås inte som den personen igen.", "Every time the app exits": "Varje gång appen avslutas", @@ -3581,6 +3582,7 @@ "This version doesn't come with an AI Denoise model, and none can be downloaded from here yet.": "Den här versionen levereras inte med någon modell för AI-brusreducering, och ingen kan hämtas härifrån än.", "This version has no AI features to download.": "Den här versionen har inga AI-funktioner att ladda ned.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Den här versionen finns redan på Immich. Immich kan inte ersätta en fil, så det nya sparandet laddas upp som ett nytt objekt överst i stapeln.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Den här versionen skriver bara förlustfri WebP: WebP med förluster finns i skrivbordsappen", "This {app} can't install it: open {app}.lplug4 from the {app} download to install it in Logi Options+.": "Den här installationen av {app} kan inte installera det: öppna {app}.lplug4 från nedladdningen av {app} för att installera det i Logi Options+.", "Three with Caption": "Tre med bildtext", "Tile Cache": "Kartcache", diff --git a/crates/ui-egui/locales/fork/uk.json b/crates/ui-egui/locales/fork/uk.json index 364632ad7c..b5d6090dc9 100644 --- a/crates/ui-egui/locales/fork/uk.json +++ b/crates/ui-egui/locales/fork/uk.json @@ -956,6 +956,7 @@ "Every device keeps the originals and can add photos.": "Кожен пристрій зберігає оригінали і може додавати фото.", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Усі теки, які використовує {app}. Зміни діють одразу; кожна також є на власній вкладці.", "Every photo here is in the catalog already": "Усі фото тут уже є в каталозі", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Кожен піксель зберігається точно (файли більші); вимк.: менші файли з якістю нижче", "Every selected photo is edited the same way.": "Усі вибрані фото редагуються однаково.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Усі пропозиції відхилено: відхилене обличчя залишається невідомим, і його більше не пропонують як цю людину.", "Every time the app exits": "Щоразу під час виходу з програми", @@ -3297,6 +3298,7 @@ "This spot has no colour to defringe: click on the fringe itself": "У цій точці немає кольору для усунення каймки: клацніть саме на каймці", "This version has no AI features to download.": "У цій версії немає функцій ШІ для завантаження.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Ця версія вже є в Immich. Immich не вміє замінювати файл, тож нове збереження завантажується як новий об’єкт нагору стосу.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Ця версія записує лише WebP без втрат: WebP із втратами є в настільному застосунку", "Three with Caption": "Три з підписом", "Thumbnail size": "Розмір мініатюр", "Tile Cache": "Кеш тайлів", diff --git a/crates/ui-egui/locales/fork/vi.json b/crates/ui-egui/locales/fork/vi.json index 3b39133d9c..2f8a71b10b 100644 --- a/crates/ui-egui/locales/fork/vi.json +++ b/crates/ui-egui/locales/fork/vi.json @@ -1090,6 +1090,7 @@ "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "Mọi thư mục mà {app} dùng. Thay đổi áp dụng ngay; mỗi thư mục cũng có thẻ riêng.", "Every photo cropped to fill the whole screen, with slow crossfades.": "Mọi ảnh được cắt để lấp đầy màn hình, chuyển mờ chậm.", "Every photo here is in the catalog already": "Mọi ảnh ở đây đã có trong catalog", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "Giữ chính xác từng điểm ảnh (tệp lớn hơn); tắt: tệp nhỏ hơn theo Chất lượng bên dưới", "Every selected photo is edited the same way.": "Mọi ảnh đã chọn được sửa theo cùng một cách.", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "Mọi gợi ý đã bị từ chối: khuôn mặt bị từ chối vẫn là không rõ và không còn được gợi ý là người đó nữa.", "Every time the app exits": "Mỗi lần thoát ứng dụng", @@ -3748,6 +3749,7 @@ "This version doesn't come with an AI Denoise model, and none can be downloaded from here yet.": "Phiên bản này không kèm mô hình Khử nhiễu AI, và hiện chưa thể tải mô hình nào từ đây.", "This version has no AI features to download.": "Phiên bản này không có tính năng AI để tải về.", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "Phiên bản này đã có trên Immich. Immich không thay thế được tệp, nên lần lưu mới được tải lên như một tài nguyên mới ở đầu chồng.", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "Phiên bản này chỉ ghi WebP không mất dữ liệu: WebP nén mất dữ liệu có trong ứng dụng máy tính", "This {app} can't install it: open {app}.lplug4 from the {app} download to install it in Logi Options+.": "Bản {app} này không cài được nó: hãy mở {app}.lplug4 từ gói tải {app} để cài vào Logi Options+.", "Three with Caption": "Ba ảnh kèm chú thích", "Thumbnail size": "Kích thước hình thu nhỏ", diff --git a/crates/ui-egui/locales/fork/zh-hans.json b/crates/ui-egui/locales/fork/zh-hans.json index 974d2b6711..951692de29 100644 --- a/crates/ui-egui/locales/fork/zh-hans.json +++ b/crates/ui-egui/locales/fork/zh-hans.json @@ -988,6 +988,7 @@ "Every device keeps the originals and can add photos.": "每台设备都保留原片并可添加照片。", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "{app} 使用的所有文件夹。更改立即生效;每个文件夹也有各自的标签页。", "Every photo here is in the catalog already": "这里的照片都已在目录中", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "精确保留每个像素(文件更大);关闭:按下方的质量生成更小的文件", "Every selected photo is edited the same way.": "所有选中的照片都以相同方式编辑。", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "所有建议都已被排除:被排除的面部保持未知状态,不会再被建议为此人。", "Every time the app exits": "每次退出应用时", @@ -3384,6 +3385,7 @@ "This spot has no colour to defringe: click on the fringe itself": "此处没有可去除的色彩:请直接点击色边", "This version has no AI features to download.": "此版本没有可下载的 AI 功能。", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "此版本已在 Immich 上。Immich 无法替换文件,因此新的保存将作为新资源上传到堆叠顶部。", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "此版本只写入无损 WebP:有损 WebP 在桌面应用中", "Three with Caption": "三张带题注", "Thumbnail size": "缩览图大小", "Tile Cache": "瓦片缓存", diff --git a/crates/ui-egui/locales/fork/zh-hant.json b/crates/ui-egui/locales/fork/zh-hant.json index 982af0c424..0db4225087 100644 --- a/crates/ui-egui/locales/fork/zh-hant.json +++ b/crates/ui-egui/locales/fork/zh-hant.json @@ -1012,6 +1012,7 @@ "Every device keeps the originals and can add photos.": "每台裝置都保留原始檔並可加入相片。", "Every folder {app} uses. Changes apply at once; each is also on its own tab.": "{app} 使用的所有資料夾。變更會立即套用;每個資料夾也各有自己的標籤頁。", "Every photo here is in the catalog already": "這裡的照片都已在目錄中", + "Every pixel kept exactly (larger files); off: smaller files at the Quality below": "精確保留每個像素(檔案較大);關閉:依下方的品質產生較小的檔案", "Every selected photo is edited the same way.": "所有選取的照片都以相同方式編輯。", "Every suggestion was rejected: a rejected face stays unknown, and is not suggested as that person again.": "所有建議都已被排除:被排除的臉孔保持未知狀態,不會再被建議為此人。", "Every time the app exits": "每次結束應用程式時", @@ -3439,6 +3440,7 @@ "This spot has no colour to defringe: click on the fringe itself": "此處沒有可去除的色彩:請直接點擊色邊", "This version has no AI features to download.": "此版本沒有可下載的 AI 功能。", "This version is already on Immich. Immich can't replace a file, so the new save is uploaded as a new asset on top of the stack.": "此版本已在 Immich 上。Immich 無法取代檔案,因此新的儲存會作為新資產上傳到堆疊頂端。", + "This version writes lossless WebP only: lossy WebP is in the desktop app": "此版本只寫入無損 WebP:有損 WebP 在桌面應用程式中", "Three with Caption": "三張含說明文字", "Thumbnail size": "縮圖大小", "Tick the box to accept the model's terms first": "請先勾選方塊以接受模型的條款", diff --git a/crates/ui-egui/src/export_preview.rs b/crates/ui-egui/src/export_preview.rs index 3abfe2f372..d4ceb275a8 100644 --- a/crates/ui-egui/src/export_preview.rs +++ b/crates/ui-egui/src/export_preview.rs @@ -160,6 +160,7 @@ fn picture_opts(o: &ExportOptions) -> ExportOptions { bit_depth: o.bit_depth, hdr: o.hdr, jxl_lossless: o.jxl_lossless, + webp_lossless: o.webp_lossless, ..Default::default() } } diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rs index db45d8d58d..b5ce0f9d4c 100644 --- a/crates/ui-egui/src/panels/dialogs.rs +++ b/crates/ui-egui/src/panels/dialogs.rs @@ -3849,7 +3849,7 @@ pub(crate) fn export_settings(app: &mut LccApp, ui: &mut egui::Ui, f: ExportForm const SPACES: [(C, &str); 5] = [(C::Srgb, "sRGB"), (C::DisplayP3, "P3"), (C::AdobeRgb, "Adobe RGB"), (C::ProPhoto, "ProPhoto"), (C::Rec2020, "Rec.2020")]; let mut summary = label_of(&FORMATS, opts.format); - if matches!(opts.format, F::Jpeg | F::Avif) || (opts.format == F::Jxl && !opts.jxl_lossless) { + if matches!(opts.format, F::Jpeg | F::Avif) || (opts.format == F::Jxl && !opts.jxl_lossless) || (opts.format == F::Webp && opts.webp_lossy()) { summary = format!("{summary} ({}%)", opts.quality); } if rendered { @@ -4021,7 +4021,21 @@ pub(crate) fn export_settings(app: &mut LccApp, ui: &mut egui::Ui, f: ExportForm let tip = "Mathematically lossless: every pixel is kept exactly (larger files)"; crate::dialog_frame::checkbox(ui, &mut opts.jxl_lossless, crate::i18n::tr("Lossless")).on_hover_text(crate::i18n::tr(tip)); } - if matches!(opts.format, F::Jpeg | F::Avif) || (opts.format == F::Jxl && !opts.jxl_lossless) { + if opts.format == F::Webp { + // lossy WebP needs libwebp, which the web and Android builds don't carry (#1482) + let tip = if lcc_codecs::WEBP_LOSSY { + "Every pixel kept exactly (larger files); off: smaller files at the Quality below" + } else { + "This version writes lossless WebP only: lossy WebP is in the desktop app" + }; + let mut on = opts.webp_lossless || !lcc_codecs::WEBP_LOSSY; + ui.add_enabled_ui(lcc_codecs::WEBP_LOSSY, |ui| { + if crate::dialog_frame::checkbox(ui, &mut on, crate::i18n::tr("Lossless")).on_hover_text(crate::i18n::tr(tip)).on_disabled_hover_text(crate::i18n::tr(tip)).changed() { + opts.webp_lossless = on; + } + }); + } + if matches!(opts.format, F::Jpeg | F::Avif) || (opts.format == F::Jxl && !opts.jxl_lossless) || (opts.format == F::Webp && opts.webp_lossy()) { let mut q = opts.quality as f64; if num(ui, &QUALITY, &mut q) { opts.quality = q as u8; diff --git a/docs/changelog/unreleased/2026-11-27-lossy-webp-export.md b/docs/changelog/unreleased/2026-11-27-lossy-webp-export.md new file mode 100644 index 0000000000..7b9aeb6bee --- /dev/null +++ b/docs/changelog/unreleased/2026-11-27-lossy-webp-export.md @@ -0,0 +1,3 @@ +## Export + +- **Lossy WebP:** WebP exports are lossy at the chosen quality on desktop builds, with a **Lossless** box for exact copies (libwebp, BSD-3-Clause). Older presets now export lossy; the web and Android apps stay lossless. diff --git a/docs/manual-site/src/content/docs/output/export-formats.mdx b/docs/manual-site/src/content/docs/output/export-formats.mdx index 2a5e301a02..3ae39e7603 100644 --- a/docs/manual-site/src/content/docs/output/export-formats.mdx +++ b/docs/manual-site/src/content/docs/output/export-formats.mdx @@ -11,7 +11,8 @@ import { Aside } from '@astrojs/starlight/components'; ## File Settings ▸ Format - **JPEG**: **Quality** 1–100; **Limit file size (KB)** finds the quality that fits; when it has to go below **Quality**, the message after the export and the command-line tool say which quality it settled on. -- **PNG**, **TIFF**, **PSD** (flat, 8/16-bit, no layers), **WebP**, **AVIF**. +- **PNG**, **TIFF**, **PSD** (flat, 8/16-bit, no layers), **AVIF**. +- **WebP**: lossy at **Quality** 1–100 by default; tick **Lossless** for an exact copy (bigger files). Lossy WebP needs a desktop build; the web and Android apps export lossless WebP only and show the box ticked and greyed out. Presets saved before lossy WebP existed now export lossy; tick **Lossless** in them to keep the old output. - **JPEG XL**: native builds only; lossy or lossless, 8/16-bit. - **OpenEXR**: the finished photo scene-linear for compositing and grading (Nuke, Resolve, Blender). **Bit depth** 16-bit half float (default) or 32-bit float; **Primaries** Linear Rec. 2020 (the working space) or ACEScg. Lossless ZIP compression; the primaries and white point are written into the file's `chromaticities` attribute. Photos edited in HDR keep their values above white with **HDR output** on; others are clipped at white like any other export. Transparency is flattened onto white. diff --git a/docs/manual-site/src/content/docs/platforms/web.mdx b/docs/manual-site/src/content/docs/platforms/web.mdx index 73564c1990..efa7795738 100644 --- a/docs/manual-site/src/content/docs/platforms/web.mdx +++ b/docs/manual-site/src/content/docs/platforms/web.mdx @@ -13,7 +13,7 @@ The same interface compiled to WebAssembly. Photos stay on your machine; nothing - **Persistent library** in the browser's storage for that site, with demo photos at first. - **Import** by file picker or dropping files onto the page: JPEG, PNG, TIFF, WebP, JXL and supported raws. - **Every Develop control** (sliders, curves, masking, crop) works as on the desktop. Rendering runs in background workers. -- **Export** downloads the file (JPEG, PNG, TIFF, WebP). +- **Export** downloads the file (JPEG, PNG, TIFF, WebP; WebP is lossless only on the web). - **File ▸ Back Up Library…** downloads a zip; **Restore Library from Backup…** reads one into a new library. Experimental: the library lives only in this browser, so back up. - Use **one tab** at a time; a second tab says the app is already open. diff --git a/docs/manual/import-export.md b/docs/manual/import-export.md index 1b7489446b..cb7165f363 100644 --- a/docs/manual/import-export.md +++ b/docs/manual/import-export.md @@ -44,7 +44,7 @@ gives the image's size in megapixels and the limit. File → Export… opens the export dialog; File → Export with Previous (`Cmd+Alt+Shift+E`) repeats the last one. -- Formats: JPEG, PNG, TIFF (8/16/32-bit, LZW/ZIP), WebP, AVIF, OpenEXR (scene-linear 16-bit half or 32-bit float, linear Rec. 2020 or ACEScg), DNG, or the original file with an XMP sidecar. +- Formats: JPEG, PNG, TIFF (8/16/32-bit, LZW/ZIP), WebP (lossy at a quality, or lossless; lossless only on web and Android), AVIF, OpenEXR (scene-linear 16-bit half or 32-bit float, linear Rec. 2020 or ACEScg), DNG, or the original file with an XMP sidecar. HDR edits can also export as gain-map JPEGs, PQ AVIF, PNG and JPEG XL, as float TIFFs, and (AVIF and JPEG XL with HDR mode Gain map) as an SDR image with a gain map. - Size by long/short edge, width/height, megapixels or percent; resolution in ppi; JPEG quality or a file size limit. - Colour space sRGB, Display P3, Adobe RGB, ProPhoto RGB or Rec. 2020. diff --git a/docs/whats-new/2026-11-27-lossy-webp-export.md b/docs/whats-new/2026-11-27-lossy-webp-export.md new file mode 100644 index 0000000000..191e54145b --- /dev/null +++ b/docs/whats-new/2026-11-27-lossy-webp-export.md @@ -0,0 +1,4 @@ +### Lossy WebP export + +- WebP export is now lossy at the **Quality** you set, so files are much smaller; tick **Lossless** for an exact copy. Desktop builds only; the web and Android apps still export lossless WebP. +- Export presets made before this change now export lossy WebP; tick **Lossless** in them to keep the old output. From 610533a7b2f4f9082c4363d8babefeb3ca1fed1f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 12:34:35 +0000 Subject: [PATCH 2/3] #1482: exact-colour alpha export tests ask for lossless WebP; lossy WebP keeps alpha Manual: none, no user-visible change Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011VFDriGXJwNRKfVqKuo1hk --- NOTICE | 3 ++- crates/codecs/src/lib.rs | 6 +++--- crates/codecs/tests/it/roundtrip.rs | 4 ++-- crates/engine/src/tests_export.rs | 15 +++++++++++++-- crates/ui-egui/src/panels/dialogs.rs | 9 +++++++-- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/NOTICE b/NOTICE index ab1cccefbc..26817e6886 100644 --- a/NOTICE +++ b/NOTICE @@ -228,7 +228,8 @@ attribution: "GeoNames, geonames.org". The lookup code (crates/geocode) is our o Lossy WebP export (native builds) --------------------------------- -Desktop builds encode lossy WebP with libwebp 1.3.1 (https://chromium.googlesource.com/webm/libwebp), +Desktop builds encode lossy WebP with libwebp 1.3.1 with the CVE-2023-4863 fix +(https://chromium.googlesource.com/webm/libwebp), Copyright (c) 2010, Google Inc., licensed under the BSD 3-Clause License with Google's additional patent grant (crates/codecs/LICENSE-libwebp.txt). It is compiled from the C sources vendored in the libwebp-sys crate 0.9.6 (MIT License, https://github.com/NoXF/libwebp-sys) and called through the diff --git a/crates/codecs/src/lib.rs b/crates/codecs/src/lib.rs index bcf970928b..9d131b5b35 100644 --- a/crates/codecs/src/lib.rs +++ b/crates/codecs/src/lib.rs @@ -48,9 +48,9 @@ mod webp; pub use avif_gainmap::encode_avif_gain_map; pub use encode::{ - ChromaSubsampling, EncodeImage, EncodeMeta, HDR_REFERENCE_WHITE_NITS, HLG_REFERENCE_PEAK_NITS, HdrTransfer, Samples, TiffCompression, - encode_avif, encode_avif_hdr, encode_avif_pq, encode_jpeg, encode_png, encode_png_pq, encode_psd, encode_tiff, encode_tiff_associated, - WEBP_LOSSY, WEBP_MAX_SIDE, encode_webp_lossless, encode_webp_lossy, hlg_signal, + ChromaSubsampling, EncodeImage, EncodeMeta, HDR_REFERENCE_WHITE_NITS, HLG_REFERENCE_PEAK_NITS, HdrTransfer, Samples, TiffCompression, WEBP_LOSSY, + WEBP_MAX_SIDE, encode_avif, encode_avif_hdr, encode_avif_pq, encode_jpeg, encode_png, encode_png_pq, encode_psd, encode_tiff, + encode_tiff_associated, encode_webp_lossless, encode_webp_lossy, hlg_signal, }; pub use exr_encode::{ACESCG, ExrOptions, encode_exr}; pub use jxl_encode::{JxlColour, JxlEffort, JxlOptions, encode_jxl, encode_jxl_gain_map}; diff --git a/crates/codecs/tests/it/roundtrip.rs b/crates/codecs/tests/it/roundtrip.rs index 64c3bf2e60..667c41d485 100644 --- a/crates/codecs/tests/it/roundtrip.rs +++ b/crates/codecs/tests/it/roundtrip.rs @@ -503,8 +503,8 @@ fn webp_lossy_close_with_metadata() { assert_eq!(d.icc.as_deref(), Some(&icc[..])); assert_eq!(d.xmp.as_deref(), Some("")); let got = d.to_srgb8(); - let err: f64 = got.data.iter().zip(&img.data).flat_map(|(a, b)| (0..3).map(move |k| (a[k] as f64 - b[k] as f64).abs())).sum::() - / (64.0 * 48.0 * 3.0); + let err: f64 = + got.data.iter().zip(&img.data).flat_map(|(a, b)| (0..3).map(move |k| (a[k] as f64 - b[k] as f64).abs())).sum::() / (64.0 * 48.0 * 3.0); assert!(err < 6.0, "mean error {err}"); // no metadata: the encoder's own file let plain = encode_webp_lossy(&e, 90, &EncodeMeta::default()).unwrap(); diff --git a/crates/engine/src/tests_export.rs b/crates/engine/src/tests_export.rs index df3054cc76..2d3797c5bc 100644 --- a/crates/engine/src/tests_export.rs +++ b/crates/engine/src/tests_export.rs @@ -1712,7 +1712,8 @@ fn transparent_sources_keep_their_alpha_in_png_tiff_and_webp() { { let (mut s, id, dir) = library_with_transparent_png("export-alpha"); for (format, depth) in [("png", 8), ("png", 16), ("tiff", 8), ("tiff", 16), ("tiff", 32), ("webp", 8)] { - let o = ExportOptions::from_json(&json!({"format": format, "bitDepth": depth})); + // (exact colours: WebP lossless here; the lossy WebP default is checked below) + let o = ExportOptions::from_json(&json!({"format": format, "bitDepth": depth, "webpLossless": true})); let e = export_photo(&mut s, id, &o, 1).unwrap(); let d = lcc_codecs::decode(&e.bytes, Default::default()).unwrap(); assert!(d.has_alpha, "{format} {depth}-bit keeps alpha"); @@ -1731,6 +1732,14 @@ fn transparent_sources_keep_their_alpha_in_png_tiff_and_webp() { assert!(e.bytes.windows(10).any(|w| w == [0x52, 0x01, 3, 0, 1, 0, 0, 0, 1, 0]), "{depth}-bit TIFF alpha is associated"); } } + // lossy WebP (the default where libwebp is built in) keeps the alpha too, with the colour close + let e = export_photo(&mut s, id, &ExportOptions::from_json(&json!({"format": "webp"})), 1).unwrap(); + let d = lcc_codecs::decode(&e.bytes, Default::default()).unwrap(); + assert!(d.has_alpha, "lossy webp keeps alpha"); + let a = d.alpha.as_ref().unwrap(); + assert!(a.get(2, 2) < 0.02 && a.get(150, 100) > 0.98, "lossy webp: transparent corner, opaque middle"); + let mid = d.to_srgb8().get(150, 100); + assert!(mid[0].abs_diff(200) <= 12 && mid[1].abs_diff(40) <= 12 && mid[2].abs_diff(30) <= 12, "lossy webp colour {mid:?}"); let _ = std::fs::remove_dir_all(&dir); } // JPEG (and the other formats without alpha in this export) composites a transparent source onto @@ -1842,7 +1851,9 @@ fn soft_edges_keep_their_colour_through_crop_straighten_and_exposure() { s.execute("crop.set", &json!({"angle": 10.0})).unwrap(); s.execute("develop.set", &json!({"ids": [id.0], "control": "light.exposure", "value": 0.7})).unwrap(); for format in ["png", "tiff", "webp"] { - let e = export_photo(&mut s, id, &ExportOptions::from_json(&json!({"format": format})), 1).unwrap(); + // (exact colours: WebP lossless; lossy WebP subsamples the colour of a soft edge) + let o = ExportOptions::from_json(&json!({"format": format, "webpLossless": true})); + let e = export_photo(&mut s, id, &o, 1).unwrap(); let d = lcc_codecs::decode(&e.bytes, Default::default()).unwrap(); assert!(d.has_alpha, "{format}"); let px = d.to_srgb8(); diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rs index 04db155951..6d67d16f70 100644 --- a/crates/ui-egui/src/panels/dialogs.rs +++ b/crates/ui-egui/src/panels/dialogs.rs @@ -4046,12 +4046,17 @@ pub(crate) fn export_settings(app: &mut LccApp, ui: &mut egui::Ui, f: ExportForm }; let mut on = opts.webp_lossless || !lcc_codecs::WEBP_LOSSY; ui.add_enabled_ui(lcc_codecs::WEBP_LOSSY, |ui| { - if crate::dialog_frame::checkbox(ui, &mut on, crate::i18n::tr("Lossless")).on_hover_text(crate::i18n::tr(tip)).on_disabled_hover_text(crate::i18n::tr(tip)).changed() { + if crate::dialog_frame::checkbox(ui, &mut on, crate::i18n::tr("Lossless")) + .on_hover_text(crate::i18n::tr(tip)) + .on_disabled_hover_text(crate::i18n::tr(tip)) + .changed() + { opts.webp_lossless = on; } }); } - if matches!(opts.format, F::Jpeg | F::Avif) || (opts.format == F::Jxl && !opts.jxl_lossless) || (opts.format == F::Webp && opts.webp_lossy()) { + if matches!(opts.format, F::Jpeg | F::Avif) || (opts.format == F::Jxl && !opts.jxl_lossless) || (opts.format == F::Webp && opts.webp_lossy()) + { let mut q = opts.quality as f64; if num(ui, &QUALITY, &mut q) { opts.quality = q as u8; From de8ff7340f1a5eb1374065d4859c0e7db5bfb12f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 12:54:10 +0000 Subject: [PATCH 3/3] #1482: the export dialog reads lossy WebP support through the engine (the web build has no codecs crate) Manual: none, no user-visible change Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011VFDriGXJwNRKfVqKuo1hk --- crates/engine/src/export.rs | 4 ++++ crates/ui-egui/src/panels/dialogs.rs | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/export.rs b/crates/engine/src/export.rs index 3b8a4a17f5..b69e4aa615 100644 --- a/crates/engine/src/export.rs +++ b/crates/engine/src/export.rs @@ -1055,6 +1055,10 @@ fn watermark_from_json(v: &serde_json::Value) -> serde_json::Result { serde_json::from_value(v) } +/// Whether this build can write lossy WebP ([`lcc_codecs::WEBP_LOSSY`]; never the web or Android build), for the UI, +/// which doesn't link the codecs on every target. +pub const WEBP_LOSSY: bool = lcc_codecs::WEBP_LOSSY; + impl ExportOptions { /// Whether a WebP export is lossy: asked for, and this build has the encoder ([`lcc_codecs::WEBP_LOSSY`]). pub fn webp_lossy(&self) -> bool { diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rs index 6d67d16f70..73c78fff9d 100644 --- a/crates/ui-egui/src/panels/dialogs.rs +++ b/crates/ui-egui/src/panels/dialogs.rs @@ -4039,13 +4039,13 @@ pub(crate) fn export_settings(app: &mut LccApp, ui: &mut egui::Ui, f: ExportForm } if opts.format == F::Webp { // lossy WebP needs libwebp, which the web and Android builds don't carry (#1482) - let tip = if lcc_codecs::WEBP_LOSSY { + let tip = if lcc_engine::export::WEBP_LOSSY { "Every pixel kept exactly (larger files); off: smaller files at the Quality below" } else { "This version writes lossless WebP only: lossy WebP is in the desktop app" }; - let mut on = opts.webp_lossless || !lcc_codecs::WEBP_LOSSY; - ui.add_enabled_ui(lcc_codecs::WEBP_LOSSY, |ui| { + let mut on = opts.webp_lossless || !lcc_engine::export::WEBP_LOSSY; + ui.add_enabled_ui(lcc_engine::export::WEBP_LOSSY, |ui| { if crate::dialog_frame::checkbox(ui, &mut on, crate::i18n::tr("Lossless")) .on_hover_text(crate::i18n::tr(tip)) .on_disabled_hover_text(crate::i18n::tr(tip))