imagineer v0.3.3 Imagineer.Image.PNG.Interlace.None View Source

Link to this section Summary

Functions

Takes in a PNG whose decompressed data is not interlaced and splits up the individual scanlines, returning scanlines. A scanline is 1 byte containing the filter followed by the binary representation of that row of pixels (as filtered through the filter indicated by the first byte.)

Link to this section Functions

Link to this function extract_scanlines(image) View Source

Takes in a PNG whose decompressed data is not interlaced and splits up the individual scanlines, returning scanlines. A scanline is 1 byte containing the filter followed by the binary representation of that row of pixels (as filtered through the filter indicated by the first byte.)

Example

  iex> alias Imagineer.Image.PNG
  iex> decompressed_data = <<1, 127, 138, 255, 20, 21, 107, 0, 233, 1, 77,
  ...> 78, 191, 144, 2, 1, 77, 16, 234, 234, 154, 3, 67, 123, 98, 142,
  ...> 117, 3, 4, 104, 44, 87, 33, 91, 188>>
  iex> %PNG{
  ...>   decompressed_data: decompressed_data,
  ...>   color_format: :rgb,
  ...>   bit_depth: 8,
  ...>   width: 2,
  ...>   height: 5,
  ...>   interlace_method: 0
  ...> } |>
  ...> PNG.Interlace.None.extract_scanlines()
  [
    <<1, 127, 138, 255, 20, 21, 107>>,
    <<0, 233, 1, 77, 78, 191, 144>>,
    <<2, 1, 77, 16, 234, 234, 154>>,
    <<3, 67, 123, 98, 142, 117, 3>>,
    <<4, 104, 44, 87, 33, 91, 188>>
  ]