Skip to content

Conversation

@CarlosGtrz
Copy link

Summary

Fixes Windows clipboard to properly fallback to DIB format when DIBv5 validation fails. Previously returned errUnsupported when DIBv5 had unsupported BitCount instead of trying DIB fallback.

Previously, the clipboard reader would return errUnsupported when DIBv5
data existed but had an unsupported BitCount. This change validates the
DIBv5 format (BitCount == 32) before processing, and falls back to
readImageDib() for any DIBv5 validation failures or when DIBv5 data is
unavailable, ensuring more reliable clipboard image reading.
@CarlosGtrz CarlosGtrz mentioned this pull request Oct 22, 2025
@itsrainingmani
Copy link
Contributor

I'm testing this out on a few different windows based terminals. Can I ask where specifically you find improvements in providing the DIB fallback?

@CarlosGtrz
Copy link
Author

Can I ask where specifically you find improvements in providing the DIB fallback?

I found the problem when trying to paste a screenshot created using Snagit, a tool for taking and annotating screenshots.

The DIB fallback is already there, but it fails when OC detects DIBv5 but can't decode the image (probably due to different bpp).

With this change, OC detects DIBv5 and tries to read it. If it fails, it falls back to DIB. It worked great with Snagit.

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.

2 participants