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

The Up filter transmits the difference between each byte and the value of the corresponding byte of the same pixel in the row above it.

Link to this section Summary

Functions

Takes in the uncompressed binary for an up-filtered row of pixels and the unfiltered binary of the preceding row. It returns the a binary of the row as unfiltered pixel data

Link to this section Functions

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

Takes in the uncompressed binary for an up-filtered row of pixels and the unfiltered binary of the preceding row. It returns the a binary of the row as unfiltered pixel data.

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

Example

iex> filtered_row = <<127, 138, 255, 20, 21, 107>>
iex> prior_unfiltered_row = <<1, 77, 16, 235, 55, 170>>
iex> Imagineer.Image.PNG.Filter.Basic.Up.unfilter(filtered_row, prior_unfiltered_row)
<<128, 215, 15, 255, 76, 21>>

When the row being unfiltered is the first row, we pass in a binary of equal length that is all null bytes (<<0>>.)

iex> filtered = <<1, 77, 16, 234, 234, 154>>
iex> prior_unfiltered_row = <<0, 0, 0, 0, 0, 0>>
iex> Imagineer.Image.PNG.Filter.Basic.Up.unfilter(filtered, prior_unfiltered_row)
<<1, 77, 16, 234, 234, 154>>