pub struct CompressionOptions { /* private fields */ }Expand description
Everything about how an image is to be compressed.
use fits_io::image::compression::{Compression, CompressionOptions, Quantize};
// Rice coding, in tiles of 100 by 100 pixels.
let options = CompressionOptions::new(Compression::Rice).with_tile_size(&[100, 100]);
// A floating point image, quantised to a quarter of its own noise.
let lossy = CompressionOptions::new(Compression::Rice)
.with_quantization(Quantize::NoiseLevel(4.0));
// HCOMPRESS, throwing away the low bits of the transform's coefficients.
let smooth = CompressionOptions::new(Compression::Hcompress { scale: 16 });Implementations§
Source§impl CompressionOptions
impl CompressionOptions
Sourcepub fn new(compression: Compression) -> Self
pub fn new(compression: Compression) -> Self
Compress with compression, in the convention’s default tiles — one row
of the image each — and without quantising.
Sourcepub fn with_tile_size(self, tile: &[u32]) -> Self
pub fn with_tile_size(self, tile: &[u32]) -> Self
Cut the image into tiles of this shape, fastest axis first.
A shape shorter than the image’s axes has the remaining axes tiled one plane at a time. Bigger tiles compress a little better and cost more to read a small part of the image from.
Sourcepub fn with_quantization(self, quantize: Quantize) -> Self
pub fn with_quantization(self, quantize: Quantize) -> Self
Quantise a floating point image before compressing it.
This has no effect on an image that is already integers.
Sourcepub fn with_dithering(self, quantization: Quantization) -> Self
pub fn with_dithering(self, quantization: Quantization) -> Self
Which dithering the quantisation uses.
Quantization::SubtractiveDither1 unless this says otherwise, which is
what a floating point image usually wants.
Sourcepub fn with_dither_seed(self, seed: i64) -> Self
pub fn with_dither_seed(self, seed: i64) -> Self
Where in the dithering sequence the first tile starts, from 1 to 10000.
Two files written from the same data with the same seed come out identical, which is what makes a compressed file reproducible.
Sourcepub fn with_block_size(self, block: usize) -> Self
pub fn with_block_size(self, block: usize) -> Self
How many values Rice coding fits its split point to at a time.
Thirty-two unless this says otherwise, which is what the convention’s reference implementation uses.
Sourcepub fn compression(&self) -> Compression
pub fn compression(&self) -> Compression
The algorithm the tiles are compressed with.
Trait Implementations§
Source§impl Clone for CompressionOptions
impl Clone for CompressionOptions
Source§fn clone(&self) -> CompressionOptions
fn clone(&self) -> CompressionOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompressionOptions
impl Debug for CompressionOptions
Source§impl Default for CompressionOptions
impl Default for CompressionOptions
Source§impl PartialEq for CompressionOptions
impl PartialEq for CompressionOptions
impl StructuralPartialEq for CompressionOptions
Auto Trait Implementations§
impl Freeze for CompressionOptions
impl RefUnwindSafe for CompressionOptions
impl Send for CompressionOptions
impl Sync for CompressionOptions
impl Unpin for CompressionOptions
impl UnsafeUnpin for CompressionOptions
impl UnwindSafe for CompressionOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more