mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 15:26:12 +00:00
Image Trace: presets trace at Paths 50 with new Corners and Noise
Every built-in preset other than Auto Color and Flat Logo now traces at Paths 50. Corners is 100 in Technical Drawing, 75 in Default, Black and White Logo, Line Art and Outline, and 50 in the others. Noise is 1 px in Technical Drawing, 5 in High Fidelity Photo, 10 in Low Fidelity Photo, 15 in 3 Colors, 6 Colors, 16 Colors and Shades of Gray, 20 in Sketched Art, Line Art and Outline, 25 in Default and Black and White Logo, and 90 in Silhouettes. Palettes, color counts and the other options are unchanged. This changes the output of every preset but Default, Auto Color and Flat Logo. The traces take fewer anchors (High Fidelity Photo 5,494 to 3,136 and Black and White Logo 27 to 14 in crates/trace/tests/quality), and outlines on flat art lie further from the true edge (16 Colors 0.100 to 0.123 px off on average). Docs: docs/image-trace-adjustments.md, docs/image-trace-quality.md, docs/target-app-parity.md.
This commit is contained in:
@@ -288,8 +288,9 @@ fn trace_library(c: &str, s: &Session, params: &mut tr::TraceParams) -> Result<V
|
||||
/// The most anchor points an Image Trace may make, a guard for memory: a trace past it is refused
|
||||
/// with advice instead (#525). A trace keeps about 90 bytes an anchor in the document (measured on
|
||||
/// code-drawn photos of 2000 × 2000 to 6000 × 4000 pixels), so 8,000,000 anchors are about
|
||||
/// 0.7 GB, with a peak of about 1 GB while tracing: a 4000 × 3000 photo at High Fidelity Photo
|
||||
/// makes about 1.9 million, and even at Paths 100, Noise 1 and every tone about 7.9 million. On the
|
||||
/// 0.7 GB, with a peak of about 1 GB while tracing: a 4000 × 3000 photo at Limited 64 colors, Paths
|
||||
/// 90, Corners 25 and Noise 4 makes about 1.9 million, and even at Paths 100, Noise 1 and every tone
|
||||
/// about 7.9 million. On the
|
||||
/// web, where a page has at most 4 GB of memory, the limit stays at 2,000,000.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub const MAX_TRACE_ANCHORS: usize = 8_000_000;
|
||||
@@ -1135,7 +1136,7 @@ mod trace_limit_tests {
|
||||
assert_eq!(w, ["Flat Logo traced the image at 946 × 710 pixels, averaged down from 16000 × 12000."]);
|
||||
}
|
||||
|
||||
// A 4000 × 3000 photo at High Fidelity Photo makes about 1.9 million anchors, which must fit;
|
||||
// A 4000 × 3000 photo at Limited 64 colors, Paths 90 and Noise 4 makes about 1.9 million anchors, which must fit;
|
||||
// the limit still guards memory (about 90 bytes an anchor). Checked when the tests build.
|
||||
const _: () = assert!(MAX_TRACE_ANCHORS >= 2_000_000 && MAX_TRACE_ANCHORS <= 16_000_000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user