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

Repeated change in color causes current wallpaper degradation #66

Open
AjaxLeVallee opened this issue Sep 30, 2022 · 4 comments
Open

Repeated change in color causes current wallpaper degradation #66

AjaxLeVallee opened this issue Sep 30, 2022 · 4 comments

Comments

@AjaxLeVallee
Copy link

This is what the wallpaper looks like after 200 executions

Screen Shot 2022-09-30 at 11 30 00 AM

@igorkulman
Copy link
Owner

Good point, some problem with image quality when resizing or saving. I never noticed because I always call it with the wallpaper path to my "vanilla" file.

@AjaxLeVallee
Copy link
Author

The tool being able to echo the current state might be helpful as we'd be able to capture that in a script and go back to the previous state. Maybe I need to just hunker down and learn some applescript or figure out how to do it in python or bash.

If I wrote Swift I'd contribute more than just feedback 😂 I'm a backend eng though

@Waitsnake
Copy link

Waitsnake commented Nov 1, 2022

I also do not run ChangeMenuBarColor on the vanilla image, but on the wallpaper set in system preferences. I just flip between dark mode and normal mode (I have a bash script that reads the dark mode option of macOS and then colors the menu bar different) on this wallpaper.
I also saw a degradation effect. Sharp pictures tend to get more and more blurry over time. I also saw this effect in the file size that a image gets smaller and smaller with each run.

I think it is mainly caused by the resizedWallpaper() method that creates a fresh image from the old image then rescale it and crop it. While this procedure is needed to do on the 1st run on the original image that not fits the screen size it is not needed to do on a 2nd, 3rd and 4th run since from the 2nd run onwards the image size already fits the screen size.

So I added some if else cases to SolidColor.swift and Gradient.swift to run resizedWallpaper() only when the image size differs from the screen size. See this commit here: de2c7dc

For my wallpaper this helped that the image stays scarper and also the file size no longer gets smaller each run. On contrary the file size now increases over time. While this fix surely can not completely fixes any degradation of the image since we still change it on each run it seams at least to mitigate the degradation effect.

@igorkulman
Copy link
Owner

igorkulman commented Nov 1, 2022

I think the problem is the image operations reduce the quality, but I am not sure which ones exactly, the export is set to no compression, etc.

This is a good improvement, reducing the number of image operations when they are not needed.

I pushed the changes.

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

No branches or pull requests

3 participants