imagineer v0.3.1 Imagineer.Image.PNG.Filter.Basic.Average
The Average filter computes value for a pixel based on the average between the pixel to its left and the pixel directly above it.
Summary
Functions
Takes in the uncompressed binary for an average-filtered row of pixels, the unfiltered binary of the preceding row, and the number of bytes per pixel. It returns the a binary of the row as unfiltered pixel data
Functions
Takes in the uncompressed binary for an average-filtered row of pixels, the unfiltered binary of the preceding row, and the number of bytes per pixel. It returns the a binary of the row as unfiltered pixel data.
For more information, see the PNG Filter documentation for the Average filter type .
Example
iex> filtered = <<13, 191, 74, 228, 149, 158>>
iex> prior_unfiltered_row = <<8, 215, 35, 113, 28, 112>>
iex> Imagineer.Image.PNG.Filter.Basic.Average.unfilter(filtered, prior_unfiltered_row, 3)
<<17, 42, 91, 37, 184, 3>>
iex> filtered = <<13, 191, 74, 228, 149, 158>>
iex> prior_unfiltered_row = <<8, 215, 35, 113, 28, 112>>
iex> Imagineer.Image.PNG.Filter.Basic.Average.unfilter(filtered, prior_unfiltered_row, 2)
<<17, 42, 100, 49, 213, 238>>