fix: optimize CHRNX editorial media
This commit is contained in:
14 files changed
+252
-46
No files matched your search
@@ -54,26 +54,32 @@ done
|
||||
|
||||
mkdir -p -- "$chrnx_image_output"
|
||||
|
||||
chrnx_build_portrait() {
|
||||
chrnx_build_responsive_image() {
|
||||
chrnx_image_basename=$1
|
||||
chrnx_image_source="$chrnx_image_root/assets/images/$chrnx_image_basename.png"
|
||||
chrnx_image_source_name=$2
|
||||
chrnx_image_webp_quality=${3:-78}
|
||||
chrnx_image_source="$chrnx_image_root/assets/images/$chrnx_image_source_name"
|
||||
chrnx_image_source_extension=${chrnx_image_source_name##*.}
|
||||
if [ ! -f "$chrnx_image_source" ]; then
|
||||
echo "Source portrait is missing: $chrnx_image_source" >&2
|
||||
echo "Source image is missing: $chrnx_image_source" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for chrnx_image_width in 384 768; do
|
||||
chrnx_image_resized="$chrnx_image_tmp/$chrnx_image_basename-$chrnx_image_width.png"
|
||||
chrnx_image_resized="$chrnx_image_tmp/$chrnx_image_basename-$chrnx_image_width.$chrnx_image_source_extension"
|
||||
sips --resampleWidth "$chrnx_image_width" "$chrnx_image_source" --out "$chrnx_image_resized" >/dev/null
|
||||
cwebp -quiet -preset picture -q 78 -alpha_q 90 -m 6 -metadata none "$chrnx_image_resized" -o "$chrnx_image_output/$chrnx_image_basename-$chrnx_image_width.webp"
|
||||
cwebp -quiet -preset picture -q "$chrnx_image_webp_quality" -alpha_q 90 -m 6 -metadata none "$chrnx_image_resized" -o "$chrnx_image_output/$chrnx_image_basename-$chrnx_image_width.webp"
|
||||
avifenc --ignore-exif --ignore-xmp --ignore-icc --qcolor 58 --qalpha 85 --speed 6 "$chrnx_image_resized" "$chrnx_image_output/$chrnx_image_basename-$chrnx_image_width.avif" >/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
for chrnx_image_topic in code gaming life literature podcasts research; do
|
||||
chrnx_build_portrait "alter-ego-$chrnx_image_topic"
|
||||
chrnx_build_responsive_image "alter-ego-$chrnx_image_topic" "alter-ego-$chrnx_image_topic.png"
|
||||
printf '{\n\t"source": "alter-ego-%s.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' "$chrnx_image_topic" > "$chrnx_image_output/alter-ego-$chrnx_image_topic.json"
|
||||
done
|
||||
|
||||
chrnx_build_portrait "the-no-names-musician-cutout"
|
||||
chrnx_build_responsive_image "the-no-names-musician-cutout" "the-no-names-musician-cutout.png"
|
||||
printf '{\n\t"source": "the-no-names-musician-cutout.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_output/the-no-names-musician-cutout.json"
|
||||
|
||||
chrnx_build_responsive_image "the-no-names-collage" "the-no-names-collage.jpeg" 58
|
||||
printf '{\n\t"source": "the-no-names-collage.jpeg",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_output/the-no-names-collage.json"
|
||||
Reference in new issue
Block a user