summaryrefslogtreecommitdiff
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
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.
-rw-r--r--.gitignore1
-rw-r--r--README6
-rwxr-xr-xprepare22
-rwxr-xr-xprepare-docker8
4 files changed, 24 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index de54eb5..54885f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.DS_Store
adelie-wallpapers-*.tar.xz
+adelie-wallpapers-*/
build/
output/
diff --git a/README b/README
index 669925c..d28d8bc 100644
--- a/README
+++ b/README
@@ -17,6 +17,7 @@ The only choices a contributor has are '<slug>' and
/image.<ext> <-- image file
/MANIFEST <-- metadata file
/prepare <-- generator script
+ /prepare-docker <-- for production only*
building
@@ -27,7 +28,10 @@ building
(2) ensure that you are checked out at a tag that has
been pushed to origin
-(3) run the 'prepare' script with no arguments
+(3) run the 'prepare'* script with no arguments, or run
+ the 'prepare-docker' script to do this in a container
+ with a known version of imagemagick or graphicsmagick
+ if you are preparing for a release
(4) upload the resulting tarball, in 'output/', to the
distfiles mirror, directly under 'source/'
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;
}
diff --git a/prepare-docker b/prepare-docker
new file mode 100755
index 0000000..4bf519f
--- /dev/null
+++ b/prepare-docker
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+docker run -e UIDGID=$(id -u):$(id -g) -v"$(dirname $(readlink -f "${0}"))":/x -w/x --rm -i alpine:3.18 <<'EOF'
+apk add curl git graphicsmagick xz;
+git config --global --add safe.directory /x;
+/x/prepare;
+chown "${UIDGID}" $(find . -mindepth 1 -maxdepth 1 -type f -name 'adelie-wallpapers-*.tar.xz');
+EOF