Skip to content

Commit 76c0080

Browse files
committed
logo: Switch from Inkscape to rsvg-convert / librsvg
This SVG implementation is more convenient than Inkscape's for several reasons: * It's faster -- the runtime for the whole script goes from about 5.5s down to 1.5s. * It doesn't include a redundant alpha layer (of a constant 0xff) in the output. That makes all the PNG outputs smaller, and better yet lets us cut out the mess of ImageMagick `convert` we'd been using for stripping that layer in the one file where Apple forbids it. * Most concretely: it supports the `transform` CSS property. That will come in very handy in the next commit, to help us stitch together different pieces of the new icon design. For a useful table of which SVG implementations support which features, see this page from resvg: https://linebender.org/resvg-test-suite/svg-support-table.html (At the moment resvg isn't in Debian stable, though -- presumably because Rust packaging is somewhat hard -- so resvg itself was less convenient for me to use.) Just like with the last couple of commits, this produces a visually imperceptible change in the output files. Examining with `sng` shows some pixels did change slightly, and also that some metadata got simpler. Here's from [email protected]: IHDR { width: 40; height: 40; bitdepth: 8; - using color alpha; -} -pHYs {xpixels: 6299; ypixels: 6299; per: meter;} # (160 dpi) -tEXt { - keyword: "Software"; - text: "www.inkscape.org"; + using color; } +bKGD {red: 255; green: 255; blue: 255;} Others are similar but with width, height, xpixels, ypixels, and the DPI figure all scaled up; and in [email protected] the old version had no "alpha" but did have sections cHRM and gAMA. Like with a couple of previous commits in this series, we leave those changes out for now, in order to bundle them with substantive changes coming next.
1 parent 2f8e4fd commit 76c0080

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

tools/generate-logos

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,15 @@ die() {
3535
exit 1
3636
}
3737

38-
inkscape --version >/dev/null 2>&1 \
39-
|| die "Need inkscape -- try 'apt install inkscape'."
38+
rsvg-convert --version >/dev/null 2>&1 \
39+
|| die "Need rsvg-convert -- try 'apt install librsvg2-bin'."
4040

4141
cwebp -version >/dev/null 2>&1 \
4242
|| die "Need cwebp -- try 'apt install webp'."
4343

4444
jq --version >/dev/null 2>&1 \
4545
|| die "Need jq -- try 'apt install jq'."
4646

47-
strip-nondeterminism --version >/dev/null 2>&1 \
48-
|| die "Need strip-nondeterminism -- try 'apt install strip-nondeterminism'."
4947

5048

5149
# Suppose (for comments below) this points to a zulip.git worktree.
@@ -74,7 +72,7 @@ make_one_ios_app_icon() {
7472
local output_basename=Icon-"${size_pt}x${size_pt}@${scale}x".png
7573
local output="${iconset}"/"${output_basename}"
7674
if [ ! -f "${output}" ]; then
77-
inkscape "${src_icon_square_beta}" -w "${size_px}" -o "${output}"
75+
rsvg-convert "${src_icon_square_beta}" -w "${size_px}" -o "${output}"
7876
fi
7977

8078
printf >>"${contents}" \
@@ -102,15 +100,6 @@ make_ios_app_icon() {
102100
make_one_ios_app_icon 76 2 ipad
103101
make_one_ios_app_icon 1024 1 ios-marketing
104102

105-
# For the App Store logo, it's required to not have transparency.
106-
# We already don't have any intentional transparency, so just
107-
# cut out the alpha channel.
108-
mv "${iconset}"/Icon-1024x1024@1x{,.1}.png
109-
convert "${iconset}"/[email protected] \
110-
-alpha deactivate "${iconset}"/[email protected]
111-
strip-nondeterminism "${iconset}"/[email protected]
112-
rm -f "${iconset}"/[email protected]
113-
114103
# From "Spotlight, Settings, and Notification Icons"
115104
# in the same iOS doc
116105
make_one_ios_app_icon 40 3 iphone
@@ -135,7 +124,7 @@ make_ios() {
135124

136125
make_webp() {
137126
local input="$1" size="$2" output="$3"
138-
inkscape "${input}" -w "${size}" -o "${tmpdir}"/tmp.png
127+
rsvg-convert "${input}" -w "${size}" -o "${tmpdir}"/tmp.png
139128
# `cwebp -z 9` means lossless, and max/slowest compression
140129
cwebp -z 9 "${tmpdir}"/tmp.png -o "${output}"
141130
}

0 commit comments

Comments
 (0)