Expand description
Reverse-engineer the resampling filter used by any image resizer.
Port of ResampleScope by Jason Summers (~1400 lines of C, GPL-3.0-or-later). The original tool generates test PNG images, has the resizer process them externally, then reconstructs the filter kernel shape from the output.
This port replaces that file-based workflow with a callback API: you provide a resize closure, and the crate handles everything in-memory. It adds scoring against reference filters, SSIM comparison against perfect reference weight tables, and edge handling detection.
§License
AGPL-3.0-or-later. See LICENSE.
§Original work
- Author: Jason Summers
- Website: http://entropymine.com/resamplescope/
- License: GPL-3.0-or-later
This crate is a derivative work. The test pattern generation and filter reconstruction algorithms are ported from the original C source.
§Filter implementations
The reference filter math in filters and the separable 2D resize in
[reference] use standard mathematical definitions (sinc, Mitchell-Netravali,
etc.) and standard resampling algorithms. The authoritative, optimized
implementations of these filters live in
imageflow by Imazen.
Re-exports§
pub use analyze::FilterCurve;pub use edge::EdgeMode;pub use filters::KnownFilter;pub use reference::PixelWeights;pub use reference::WeightEntry;pub use score::FilterScore;pub use pattern::generate_dot_pattern;pub use pattern::generate_line_pattern;pub use reference::compute_weights;pub use reference::perfect_resize;pub use score::ssim;
Modules§
Structs§
- Analysis
Config - Configuration for analysis.
- Analysis
Result - Complete analysis result from probing a resizer.
Enums§
- Error
- Error type for analysis operations.
Functions§
- analyze
- Run both downscale and upscale analysis, score against known filters, and optionally detect edge handling.
- analyze_
downscale - Run only the downscale analysis (dot pattern, 557->555).
- analyze_
upscale - Run only the upscale analysis (line pattern, 15->555).
Type Aliases§
- Resize
Fn - The resize callback type: takes a grayscale source image and target dimensions, returns the resized grayscale image.