Skip to content

Question - How to render vision-camera-resize-plugin with useSkiaFrameProcessor #68

@frodriguez-hu

Description

@frodriguez-hu

Hey, I have been playing around and trying to render the output of resizing the frame but unfortunately my implementation is returning null and I am not completely sure why.

I have this:

const resized = resize(frame, {
      scale: {
        width: 256,
        height: 256
      },
      crop: {
        y: 0,
        x: 0,
        width: frame.width,
        height: frame.width
      },
      pixelFormat: 'rgb',
      dataType: 'uint8'
    });

    const data = Skia.Data.fromBytes(resized);
    const img = Skia.Image.MakeImage(
      {
        width: 256,
        height: 256,
        alphaType: AlphaType.Opaque,
        colorType: ColorType.RGBA_8888,
      },
      data,
      4 * resized.length
    )

I can't figure out what should be the right 3rd parameter of MakeImage. And I guess that is why it is returning an error

This is the Skia Doc about that: https://shopify.github.io/react-native-skia/docs/images/#makeimage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions