imagineer v0.3.1 Imagineer.Image.PNG.Filter.Basic.Sub

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

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

Functions

unfilter(row, bytes_per_pixel)

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>>