-
Notifications
You must be signed in to change notification settings - Fork 150
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
base: master
Are you sure you want to change the base?
Conversation
…y formats undermine the effect of certain ImageMagick filters, such as those that reduce the image to a specific color palette
… safe 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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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".
The png vs jpg issue aside, what exactly is the goal here, I'm kinda missing the wider context for when this websafe filter will be used? |
The "web safe filter" will be one of the "Effects" listed in the Wallpaper tab of the preferences. The existing "effects" include grayscale and pointillism. The new "effect" is added to (By the way, if there are lots of "effects" defined in |
I was asking more why would anyone care if their wallpaper is rendered in full color or in websafe colors? The point of the other filters is to provide some "artistic" change to the image. I'm not sure I see this as a good fit for a default filter. |
A dithering effect to the "web safe" palette gives the wallpaper image a pixelly and grainy appearance, especially if the original image was photographic, and especially now that displays are generally 24-bit or 32-bit color LCDs. (The "web safe" palette has 216 colors.) Due to the further limited color palette, a dithering effect with 16 colors, say (for example, the VGA palette), would achieve this effect even more strongly. |
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 tovariety.conf
, it appears, would have required quoting if the filter were to contain,
and#
characters.