Fix #4442: Autotag image metadata.

Autotag `greyscale`, `non-repeating_animation`, and `exif_rotation`.

Note that this does not detect all (or even most) greyscale images.
Artists often save greyscale images as RGB instead of as greyscale.
This commit is contained in:
evazion
2021-09-21 10:58:51 -05:00
parent d5981754c4
commit c69ba54b5a
6 changed files with 82 additions and 2 deletions

View File

@@ -498,7 +498,7 @@ class Post < ApplicationRecord
end
def add_automatic_tags(tags)
tags -= %w[incredibly_absurdres absurdres highres lowres huge_filesize flash video ugoira animated_gif animated_png]
tags -= %w[incredibly_absurdres absurdres highres lowres huge_filesize flash video ugoira animated_gif animated_png exif_rotation non-repeating_animation]
if image_width >= 10_000 || image_height >= 10_000
tags << "incredibly_absurdres"
@@ -543,6 +543,10 @@ class Post < ApplicationRecord
tags << "animated_gif" if media_asset.is_animated_gif?
tags << "animated_png" if media_asset.is_animated_png?
tags << "greyscale" if media_asset.is_greyscale?
tags << "exif_rotation" if media_asset.is_rotated?
tags << "non-repeating_animation" if media_asset.is_non_repeating_animation?
tags
end