summaryrefslogtreecommitdiff
path: root/prepare
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2023-12-06 09:39:18 -0600
committerZach van Rijn <me@zv.io>2023-12-06 10:17:47 -0600
commita656ccfe9382edc96b35f716b8ccd1694c2ab4ee (patch)
tree71078894e99ae6457a3e0e3d50773ff3f564ff6c /prepare
parent082074c60c5a585977df1143db74db95f4d081c0 (diff)
downloadwallpapers-a656ccfe9382edc96b35f716b8ccd1694c2ab4ee.tar.gz
wallpapers-a656ccfe9382edc96b35f716b8ccd1694c2ab4ee.tar.bz2
wallpapers-a656ccfe9382edc96b35f716b8ccd1694c2ab4ee.tar.xz
wallpapers-a656ccfe9382edc96b35f716b8ccd1694c2ab4ee.zip
Switch from Imagemagick to Graphicsmagick.
Note that GM doesn't support gradient:angle so we have to use a direction. It's radial, not linear, but is completely acceptable. Imagemagick silently introduces artifacts and fails to composite images when the underlying gradient is of the form { #AAAAAA --> #BBBBBB }, where R=G=B. Note that { #AAAAAA --> #BBBBBC } works fine. This is a real bug but isn't a wallpapers problem. Add a 'prepare-docker' wrapper script, which simply builds the tarball using a known Graphicsmagick and not whichever happens to be on the generating system.
Diffstat (limited to 'prepare')
-rwxr-xr-xprepare22
1 files changed, 10 insertions, 12 deletions
diff --git a/prepare b/prepare
index 16d000a..b1c3aa1 100755
--- a/prepare
+++ b/prepare
@@ -124,7 +124,7 @@ cd "${HERE}";
##
# Check for required tools.
#
-for k in curl composite convert; do
+for k in curl gm; do
if ! command -v ${k} 2>&1 >/dev/null; then
printf "E: required utility '%s' not found!\n" "${k}";
exit 1;
@@ -239,12 +239,12 @@ size_only ()
# resized
- convert "${image}/${from_x}x${from_y}.png" -resize ${x}x${y}^ "${KEEP}"/${name}/${x}x${y}.${type};
+ gm convert "${image}/${from_x}x${from_y}.png" -resize ${x}x${y}^ "${KEEP}"/${name}/${x}x${y}.${type} 2>/dev/null;
done
# screenshot
printf " - Generating screenshot\n";
- convert "${image}/${from_x}x${from_y}.png" -resize 400x250^ "${KEEP}"/${name}/screenshot.jpg;
+ gm convert "${image}/${from_x}x${from_y}.png" -resize 400x250^ "${KEEP}"/${name}/screenshot.jpg 2>/dev/null;
done
}
@@ -293,27 +293,25 @@ make_fake ()
args="${@}"; # all remaining arguments
printf "Generating %5s ('%s')...\n" "${size}" "${name}";
- convert \
- -define gradient:angle=65 \
+ gm convert \
+ -define gradient:direction=NorthEast \
-size ${size} \
gradient:"${hexa}"-"${hexb}" \
"${name}" \
;
# FIXME: this is literal magic?
- composite \
- \( \
+ gm composite \
-compose atop \
-gravity southwest \
-background none \
-resize ${size%x*}x$((${size#*x}*80/100)) \
"${TEMP}"/polyguin.svg \
-geometry +0+100 \
- \) \
"${name}" \
"${name}" \
;
- composite \
+ gm composite \
-compose atop \
-gravity southeast \
-background none \
@@ -322,7 +320,7 @@ make_fake ()
"${name}" \
"${name}" \
;
- convert \
+ gm convert \
${args} \
"${name}" \
"${name}" \
@@ -345,7 +343,7 @@ printf "%s\n" "${MAKE}" | while read ratio scale _; do
"#bbbbbb" "#eeeeee" \
black_x200 \
"${TEMP}"/generated/background/${x}x${y}.png \
- -colorspace Gray -separate -average \
+ -colorspace Gray \
;
# lockscreen (full color)
@@ -375,7 +373,7 @@ make_real ()
# TODO: add filename extension checker?
printf "Generating %5s ('%s')...\n" "${size}" "${name}";
- convert "${file}" -resize ${size}^ "${name}";
+ gm convert "${file}" -resize ${size}^ "${name}" 2>/dev/null;
}