-
-
Notifications
You must be signed in to change notification settings - Fork 994
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Adds generator script 2. This script uses special packer that forces png compression, reducing the resulting .ico file sizes tremendously 3. Also uses optipng to reduce the size around 20% more 4. Since the sizes are reduced, we generate the icons for all non-custom dpi scaling values 5. Renames favicon.ico to sunshine.ico, since it's now used in other places such as tray icon
- Loading branch information
Showing
9 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
if ! [ -x "$(command -v ./go-png2ico)" ]; then | ||
echo "./go-png2ico not found" | ||
echo "download the executable from https://github.com/J-Siu/go-png2ico" | ||
echo "and drop it in this folder" | ||
exit 1 | ||
fi | ||
|
||
if ! [ -x "$(command -v optipng)" ]; then | ||
echo "optipng executable not found" | ||
exit 1 | ||
fi | ||
|
||
if ! [ -x "$(command -v inkscape)" ]; then | ||
echo "inkscape executable not found" | ||
exit 1 | ||
fi | ||
|
||
icon_base_sizes=(16 64) | ||
icon_sizes_keys=() # associative array to prevent duplicates | ||
icon_sizes_keys[256]=1 | ||
|
||
for icon_base_size in ${icon_base_sizes[@]}; do | ||
# increment in 25% till 400% | ||
icon_size_increment=$((icon_base_size / 4)) | ||
for ((i = 0; i <= 12; i++)); do | ||
icon_sizes_keys[$((icon_base_size + i * icon_size_increment))]=1 | ||
done | ||
done | ||
|
||
# convert to normal array | ||
icon_sizes=${!icon_sizes_keys[@]} | ||
|
||
echo "using icon sizes:" | ||
echo ${icon_sizes[@]} | ||
|
||
src_vectors=("../../src_assets/common/assets/web/images/sunshine-locked.svg" | ||
"../../src_assets/common/assets/web/images/sunshine-pausing.svg" | ||
"../../src_assets/common/assets/web/images/sunshine-playing.svg" | ||
"../../sunshine.svg") | ||
|
||
echo "using sources vectors:" | ||
echo ${src_vectors[@]} | ||
|
||
for src_vector in ${src_vectors[@]}; do | ||
file_name=`basename "$src_vector" .svg` | ||
png_files=() | ||
for icon_size in ${icon_sizes[@]}; do | ||
png_file="${file_name}${icon_size}.png" | ||
echo "converting ${png_file}" | ||
inkscape -w $icon_size -h $icon_size "$src_vector" --export-filename "${png_file}" && | ||
optipng -o7 "${png_file}" && | ||
png_files+=("${png_file}") | ||
done | ||
|
||
echo "packing ${file_name}.ico" | ||
./go-png2ico "${png_files[@]}" "${file_name}.ico" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.