imagineer v0.3.3 Imagineer.Image.PNG.Filter.Basic.Sub View Source

The Sub filter transmits the difference between each byte and the value of the corresponding byte of the prior pixel.

Link to this section Summary

Functions

Takes in the uncompressed binary for a sub-filtered row of pixels plus the number of bytes per pixel and returns the a binary of the row as unfiltered pixel data

Link to this section Functions

Link to this function unfilter(row, bytes_per_pixel) View Source

Takes in the uncompressed binary for a sub-filtered row of pixels plus the number of bytes per pixel and returns the a binary of the row as unfiltered pixel data.

For more information, see the PNG Filter documentation for the Sub filter type .

Example

iex> filtered = <<127, 138, 255, 20, 21, 107>>
iex> Imagineer.Image.PNG.Filter.Basic.Sub.unfilter(filtered, 3)
<<127, 138, 255, 147, 159, 106>>

iex> filtered = <<1, 77, 16, 234, 234, 154>>
iex> Imagineer.Image.PNG.Filter.Basic.Sub.unfilter(filtered, 3)
<<1, 77, 16, 235, 55, 170>>

iex> filtered = <<1, 77, 16, 234, 234, 154>>
iex> Imagineer.Image.PNG.Filter.Basic.Sub.unfilter(filtered, 2)
<<1, 77, 17, 55, 251, 209>>