Skip to content

Unable to get background (255, 255, 255, 0) for Pillow image #178

Open
@woestler

Description

@woestler

Describe the bug
Sir, I need to export a Pillow image with a background (255, 255, 255, 0), I use this code to initialize the Skia to try to set the background as (255, 255, 255, 0)

with self.surface as canvas:
      color = skia.Color(255, 255, 255, 0)
      canvas.clear(color)

After I draw a line on the surface and use this code to export a Pillow image

skia_image = self.surface.makeImageSnapshot()
alphaType=skia.AlphaType.kUnpremul_AlphaType)
res = skia_image.convert(colorType=skia.ColorType.kRGBA_8888_ColorType,
       alphaType=skia.AlphaType.kUnpremul_AlphaType)
return Image.fromarray(
        res
)

But the background is (0, 0, 0, 0) when get the pillow Image

Please help! it will be greatly appreciated.
Thanks.

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