# fromRawBuffer static method

Image fromRawBuffer(

1. Uint8List? pixels,
2. int width,
3. int height,
4. int stride,
5. PixelFormat srcPixelFormat,
6. PixelFormat dstPixelFormat

)

Creates an Image from the specified raw data buffer.

param pixels A buffer that contains image pixels. param width The width, in pixels, of the image. param height The height, in pixels, of the image. param stride The stride, in pixels, of the image. param srcPixelFormat The pixel format of the input image. param dstPixelFormat The pixel format into which to convert the input image. return The newly created image. throws FaceException An error has occurred during Face Library execution.

## Implementation

    static Image fromRawBuffer(Uint8List? pixels, int width, int height, int stride, PixelFormat srcPixelFormat, PixelFormat dstPixelFormat) {
      Image image = Image();
      Pointer<UnsignedChar>? pPixels;
      if (pixels != null) {
      	pPixels = calloc.allocate<UnsignedChar>(pixels.length);
      	pPixels.cast<Uint8>().asTypedList(pixels.length).setAll(0, pixels);
      }
      try {
        var err = faceSDK.id3FaceImage_FromRawBuffer(image.handle, pPixels ?? nullptr, pixels?.length ?? 0, width, height, stride, srcPixelFormat.value, dstPixelFormat.value);
        if (err != FaceError.success.value) {
          image.dispose();
          throw FaceException(err);
        }
        return image;
      } finally {
        if (pPixels != null) {
          calloc.free(pPixels);
        }
      }
    }