Skip to content

ImageGrab.grabclipboard() for RGBA images on Windows? #4611

@teamclouday

Description

@teamclouday

What did you do?

I'm trying to read RGBA image from Windows clipboard, and convert the image to RGB format with a white background. The RGBA image was copyed from chrome browser.

What did you expect to happen?

The returned image from ImageGrab.grabclipboard() should be in RGBA mode.

What actually happened?

The returned image from ImageGrab.grabclipboard() is already in RGB mode, with black background.

What are your OS, Python and Pillow versions?

  • OS: Windows 10
  • Python: 3.6.8
  • Pillow: 7.0.0
new_image = ImageGrab.grabclipboard()
new_image_converted = Image.new("RGB", new_image.size, (255, 255, 255))
new_image_converted.paste(new_image)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions