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

fix ARGB to RGBA conversion in IOS ResizePlugin.mm #56

Merged
merged 1 commit into from
May 3, 2024

Conversation

Shtruk
Copy link
Contributor

@Shtruk Shtruk commented May 2, 2024

Hi, I think I found a typo in ARGB to RGBA conversion in IOS ResizePlugin.mm.

uint8_t permuteMap[4] = {3, 1, 2, 0}; from ARGB produce BRGA instead of RGBA.

@mrousavy
Copy link
Owner

mrousavy commented May 2, 2024

Can you attach a screenshot of how it looks afterwards if you convert the image to a UIImage?
I feel like the current code is correct, but not sure if I'm a bit too tired already.
cc @rodgomesc

@rodgomesc
Copy link
Contributor

rodgomesc commented May 3, 2024

LGMT, i just tested in the preview of my other PR, and before this change i got a greenish colors, attached a video from before and after below

Note

DIFF from #58

 const handleSkiaImage = Worklets.createRunOnJS((data: SkData) => {
    const img = Skia.Image.MakeImage(
      {
        width: SIZE,
        height: SIZE,
        alphaType: AlphaType.Opaque,
-       colorType: ColorType.BGRA_8888,
+       colorType: ColorType.RGBA_8888,
      },
      data,
      SIZE * 4
    );

    previewImg.value = img;
  });
        const result = plugin.resize(frame, {
        scale: {
          width: SIZE,
          height: SIZE,
        },
-     pixelFormat: 'bgra',
+     pixelFormat: 'rgba',
        dataType: 'uint8',
        rotation: '0deg',
        mirror: false,
      });
before.mp4

Before @Shtruk changes
after.mp4

After @Shtruk changes

@mrousavy mrousavy merged commit a9fadfb into mrousavy:main May 3, 2024
3 of 4 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants