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

Retrieving an image from the clipboard and saving it results in pixel distortion #122

Open
zibo-chen opened this issue Nov 22, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@zibo-chen
Copy link

image

After retrieving the image from the clipboard, I loaded it with the image library and saved it as a PNG, and there are misplaced pixels in the bottom left corner.

@zibo-chen
Copy link
Author

The pixels on the right side of the image have also moved to the left.

@complexspaces
Copy link
Collaborator

Hi, thanks for opening this issue.

Can I ask what OS (and desktop environment, if applicable) you are seeing this issue in?

@zibo-chen
Copy link
Author

This issue can be reproduced on both Windows 10 and Windows 11.

@complexspaces complexspaces added the bug Something isn't working label Feb 13, 2024
@Klavionik
Copy link
Contributor

I think I'm facing the same issue with arboard 3.3.1. This happens on Windows 10 if I place an image into the clipboard using a bit of C#; I believe this doesn't happen if I use, let's say, Copy image in Chrome.

I noticed one curious thing: if a distorted image has 1px height (no matter the width), it will always start as [255, 0, 0, 0, 0, 255, 0, 0, 0, 0, 255, 0]. This very 12 bytes. If, however, the image has a shape of square/rectangle/whatever, the distorted bytes are going to be somewhere in the middle.

This is how bytes look for a 14x1 red line (<byte number>. <pasted byte> -- <original byte> <match_or_not>):

14x1_red_line

And this is how it looks for a 10x10 red square:

10x10_red_square

@zibo-chen
Copy link
Author

I have found a reliable way to reproduce the pixel distortion issue when saving an image from the clipboard.

Steps to reproduce:

Ensure that Hyper-V is enabled on your Windows 10 or Windows 11 system.
Connect to a virtual machine using Hyper-V.
Use the built-in snipping tool of Windows 10 to take a screenshot.
Copy the screenshot to the clipboard.
Following these steps, the bug can be consistently reproduced both on Windows 10 and Windows 11 environments. It seems that the issue might be related to how the snipping tool interacts with the clipboard when Hyper-V is active, or how the clipboard data is being handled by the system in this specific virtualized context.

I hope this information helps in narrowing down the cause of the bug and finding a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants