ExPng.Chunks.ImageData (ExPng v0.2.0)

Stores the raw data of an IDAT image data chunk from a PNG image.

Since PNG images can be encoded with the image data split between multiple IDAT chunks to allow generating an image in a streaming manner, merge/1 provides support for merging multiple chunks into one before being fully decoded by ExPng.

Link to this section Summary

Functions

Takes an image, a header, and optionally, a filter type and palette, and returns an ImageData struct containing the image data translated into a bytestring.

Merges a list of ImageData chunks into one

Returns a new ImageData struct with the provided data.

Link to this section Types

Specs

t() :: %ExPng.Chunks.ImageData{data: binary(), type: :IDAT}

Link to this section Functions

Link to this function

from_pixels(image, header, filter_type \\ 0, palette \\ nil)

Specs

Takes an image, a header, and optionally, a filter type and palette, and returns an ImageData struct containing the image data translated into a bytestring.

Link to this function

merge(data_chunks)

Specs

merge([t(), ...]) :: t()

Merges a list of ImageData chunks into one

Link to this function

new(atom, data)

Specs

new(:IDAT, binary()) :: {:ok, t()}

Returns a new ImageData struct with the provided data.