Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
frodriguez-hu opened this issue Jul 1, 2024 · 1 comment

Comments

@frodriguez-hu
Copy link

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

@mrousavy
Copy link
Owner

mrousavy commented Jul 2, 2024

I think RN Skia should throw useful errors (with messages) instead of swallowing it and returning null. Would be great if that can be changed.

But yea I guess you can only debug this via Skia logs, check the native adb logcat/Xcode logs to see what kind of error Skia throws.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants