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

Add a new default filter that dithers a wallpaper image to the web safe color palette #679

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

peteroupc
Copy link

In addition I want to note that, luckily, no quoting had to be done to add this filter to filters.txt. By contrast, adding this filter to variety.conf, it appears, would have required quoting if the filter were to contain , and # characters.

…y formats undermine the effect of certain ImageMagick filters, such as those that reduce the image to a specific color palette
@@ -1357,7 +1357,7 @@ def apply_filters(self, to_set, refresh_level):
):
self.post_filter_filename = to_set
target_file = os.path.join(
self.wallpaper_folder, "wallpaper-filter-%s.jpg" % Util.random_hash()
self.wallpaper_folder, "wallpaper-filter-%s.png" % Util.random_hash()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reluctant to accept this change. JPGs are lossy, yes, but the majority of wallpapers and photos are still served in this format, and converting things to PNG will easily bloat file sizes from ~3MB (for a UHD image) to almost 10x that size. That's a lot of additional I/O if Variety is configured to change the wallpaper often.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my limited testing, at least in the case of the Web safe filter in this pull request, the PNG version of the filtered image does not have a significantly higher file size than the JPG version, and in many cases can have an even smaller file size. For example, a 4160x3120 JPG image of about 3.9 MiB is converted to a 4.5 MiB filtered PNG under the Web safe filter — so not even close to a 10× blowup. I suppose this is because the Web safe filter uses the ImageMagick remap command so that the PNG is saved as an 8-bit per pixel indexed color format, rather than in a 24-bit per pixel format.

However, I see the point that the PNG format might not make sense for all filters, especially for the existing default filters. Thus, I suggest a filter-by-filter option for the output image format (which defaults to .JPG), or to use the PNG format only when the unfiltered image file is "small enough".

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