Skip to main content

Predictor

Type Alias Predictor 

Source
pub type Predictor = Predictor;
Expand description

Type of prediction to prepare the image with.

Image data can be very unpredictable, and thus very hard to compress. Predictors are simple passes ran over the image data to prepare it for compression. This is mostly used for LZW compression, where using Predictor::Horizontal we see a 35% improvement in compression ratio over the unpredicted compression !

Predictor::FloatingPoint is currently not supported.

Aliased Type§

#[repr(u16)]
pub enum Predictor { None = 1, Horizontal = 2, FloatingPoint = 3, }

Variants§

§

None = 1

No changes were made to the data

§

Horizontal = 2

The images’ rows were processed to contain the difference of each pixel from the previous one.

This means that instead of having in order [r1, g1. b1, r2, g2 ...] you will find [r1, g1, b1, r2-r1, g2-g1, b2-b1, r3-r2, g3-g2, ...]

§

FloatingPoint = 3

Not currently supported