Prefer AVIF to WebP encoding
@ -18,7 +18,7 @@ Otherwise, you might have to manually install the following components:
|
||||
- link:https://git.sr.ht/~sircmpwn/openring[openring] for generating a webring which is used on the site homepage.
|
||||
- link:https://imagemagick.org/[ImageMagick] for processing the image files.
|
||||
|
||||
With the things installed, you can just clone the Git repo of this project, run `make serve`, and voila!
|
||||
With the things installed, you can just clone the Git repo of this project, run `rake serve`, and voila!
|
||||
You're now a content creator!
|
||||
|
||||
Most of the usual tasks done with this project should be handled by this project already which is listed in its link:./Rakefile[Rakefile].
|
||||
@ -162,12 +162,13 @@ Once it is done, a rebase should be done with a squashed commit publishing the c
|
||||
- The link:./assets/svg/avatars[avatar images] are processed with ImageMagick.
|
||||
Furthermore, they should be optimized.
|
||||
The simple avatar designs such as link:./assets/svg/avatars/ezran/default.svg[./assets/svg/avatars/ezran/default.svg] can be reduced and optimized up to 90% of its quality.
|
||||
Though, this depends on the encoding of the format (e.g., WebP, AVIF).
|
||||
The following command should show how it is done.
|
||||
+
|
||||
--
|
||||
[source, shell]
|
||||
----
|
||||
magick convert $AVATAR -quality 10 $AVATAR_OUTPUT
|
||||
magick convert $AVATAR -quality 30 $AVATAR_OUTPUT
|
||||
----
|
||||
--
|
||||
|
||||
|
4
Rakefile
@ -24,10 +24,10 @@ end
|
||||
|
||||
desc 'Export the avatar images'
|
||||
task :export_avatars, [:base_dir, :output_dir, :output_extension] do |_, args|
|
||||
args.with_defaults(base_dir: './assets/svg/', output_dir: './static/icons/', output_extension: 'webp')
|
||||
args.with_defaults(base_dir: './assets/svg/', output_dir: './static/icons/', output_extension: 'avif')
|
||||
Dir.glob('avatars/**/*.svg', base: args.base_dir) do |f|
|
||||
output_file = "#{File.dirname(f)}/#{File.basename(f, '.svg')}.#{args.output_extension}"
|
||||
sh "magick #{args.base_dir}#{f} -quality 10 #{args.output_dir}#{output_file}"
|
||||
sh "magick #{args.base_dir}#{f} -quality 30 #{args.output_dir}#{output_file}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ reproducible = true
|
||||
stem = "latexmath"
|
||||
|
||||
avatarsdir = "/icons/avatars"
|
||||
avatarstype = "webp"
|
||||
avatarstype = "avif"
|
||||
|
||||
icons = "image"
|
||||
iconsdir = "/icons/asciidoctor"
|
||||
|
@ -6,7 +6,7 @@ class ChatBlock < Asciidoctor::Extensions::BlockProcessor
|
||||
named :chat
|
||||
on_context :example
|
||||
name_positional_attributes 'avatar', 'state'
|
||||
default_attributes 'state' => 'default', 'avatarstype' => 'webp'
|
||||
default_attributes 'state' => 'default', 'avatarstype' => 'avif'
|
||||
|
||||
def process(parent, reader, attrs)
|
||||
block = create_block parent, :pass, nil, attrs, content_model: :compound
|
||||
|
BIN
static/icons/avatars/ezran/angry.avif
Normal file
BIN
static/icons/avatars/ezran/curious.avif
Normal file
Before Width: | Height: | Size: 5.1 KiB |
BIN
static/icons/avatars/ezran/default.avif
Normal file
Before Width: | Height: | Size: 4.3 KiB |
BIN
static/icons/avatars/ezran/disappointed.avif
Normal file
BIN
static/icons/avatars/ezran/proud.avif
Normal file
Before Width: | Height: | Size: 5.5 KiB |
BIN
static/icons/avatars/ezran/skeptical.avif
Normal file
Before Width: | Height: | Size: 5.2 KiB |
BIN
static/icons/avatars/foodogsquared/curious.avif
Normal file
Before Width: | Height: | Size: 4.1 KiB |
BIN
static/icons/avatars/foodogsquared/default.avif
Normal file
Before Width: | Height: | Size: 3.4 KiB |
BIN
static/icons/avatars/foodogsquared/despair.avif
Normal file
Before Width: | Height: | Size: 4.4 KiB |
BIN
static/icons/avatars/foodogsquared/disappointed.avif
Normal file
Before Width: | Height: | Size: 3.6 KiB |
BIN
static/icons/avatars/foodogsquared/nervous.avif
Normal file
Before Width: | Height: | Size: 4.2 KiB |