# `BB.Message.Sensor.Image`
[🔗](https://github.com/beam-bots/bb/blob/main/lib/bb/message/sensor/image.ex#L5)

Raw image data from a camera sensor.

## Fields

- `height` - Image height in pixels
- `width` - Image width in pixels
- `encoding` - Pixel encoding format
- `is_bigendian` - Whether data is big-endian
- `step` - Full row length in bytes
- `data` - Actual image data as binary

## Encodings

Common encodings include:
- `:rgb8` - RGB 8-bit per channel
- `:rgba8` - RGBA 8-bit per channel
- `:bgr8` - BGR 8-bit per channel
- `:bgra8` - BGRA 8-bit per channel
- `:mono8` - Grayscale 8-bit
- `:mono16` - Grayscale 16-bit

## Examples

    alias BB.Message.Sensor.Image

    {:ok, msg} = Image.new(:camera,
      height: 480,
      width: 640,
      encoding: :rgb8,
      is_bigendian: false,
      step: 1920,
      data: <<0, 0, 0, ...>>
    )

# `encoding`

```elixir
@type encoding() ::
  :rgb8
  | :rgba8
  | :rgb16
  | :rgba16
  | :bgr8
  | :bgra8
  | :bgr16
  | :bgra16
  | :mono8
  | :mono16
  | :bayer_rggb8
  | :bayer_bggr8
  | :bayer_gbrg8
  | :bayer_grbg8
```

# `t`

```elixir
@type t() :: %BB.Message.Sensor.Image{
  data: binary(),
  encoding: encoding(),
  height: non_neg_integer(),
  is_bigendian: boolean(),
  step: non_neg_integer(),
  width: non_neg_integer()
}
```

# `new`

```elixir
@spec new(
  atom(),
  keyword()
) :: {:ok, BB.Message.t()} | {:error, term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
