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

Support for transparent images #169

Merged
merged 6 commits into from
Jan 7, 2023
Merged

Support for transparent images #169

merged 6 commits into from
Jan 7, 2023

Conversation

JManch
Copy link
Contributor

@JManch JManch commented Nov 11, 2022

Currently transparent pixels just show as black:

image

This PR replaces transparent pixels with the terminal background:

image

I've also added an alphathreshold option which I found was useful for refining images with a mix of alpha values. If a pixel's alpha value is below the threshold it won't be visible.

winfetch.ps1 Outdated Show resolved Hide resolved
@rashil2000
Copy link
Member

Hi, this is a great addition!

Are we sure 50 is a good default value?

@JManch
Copy link
Contributor Author

JManch commented Jan 7, 2023

It's tough to find a good default value since it depends on the picture. Logically a default of 1 (only hide completely transparent pixels) or 255 (hide all pixels with any transparency) might give more expected default behaviour. However, I've found that both settings tend to give undesirable results in images with a gradient of alpha values. 1 usually results in artifacts from undesired pixels showing and 255 results in too much of the image getting cut off. I figured that 50 is a good middle ground with a bias towards non-transparent pixels so only pixels with an alpha value less than 20% get hidden. It gives good results in the majority of the pictures I've tested with.

@rashil2000
Copy link
Member

Hmm, I see. Let's merge this then!

@rashil2000 rashil2000 merged commit eb184e6 into lptstr:master Jan 7, 2023
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

2 participants