Compress Images for Status Screen and Add Image Compression Script (#21300)

This commit is contained in:
Parvesh Monu 2024-09-23 16:44:24 +05:30 committed by GitHub
parent 0f20f07363
commit 4bf8aaf2e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 36 additions and 3 deletions

View File

@ -33,7 +33,7 @@
## Misc
- [Importing icons from Figma into project](export-icons.md)
- [Importing assets from Figma into project](import-assets.md)
- [Updating Status APK builds for the F-Droid Android application catalogue](fdroid.md)
- [Troubleshooting for known errors](troubleshooting.md)

View File

@ -1,6 +1,6 @@
# new icons
# Importing assets from Figma into project
## Export icons
## Icons
![](images/export-icons/export-icons.gif)
@ -13,3 +13,11 @@
```
2x@2x
4. If you want platform specific icon use `.android` or `.ios` suffixes. Example `icon_name@2x.android.png`.:w
## Images
Make sure to compress images before using into project.
```
make shell
./scrips/compress_image.sh image_path
```

View File

@ -24,6 +24,8 @@ in mkShell {
clojure maven watchman
# other nice to have stuff
yarn nodejs python310 maestro
# Required for /scripts/compress_image.sh script
imagemagick
] # and some special cases
++ lib.optionals stdenv.isDarwin ([ cocoapods clang tcl idb-companion ] ++ appleSDKFrameworks)
++ lib.optionals (!stdenv.isDarwin) [ gcc8 ]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 KiB

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 345 KiB

23
scripts/compress_image.sh Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <input_image.png>"
exit 1
fi
input_file="$1"
backup_file="${input_file%.png}.bak.png"
output_file="$input_file"
cp "$input_file" "$backup_file"
magick "$input_file" -quality 100 -define png:compression-level=9 -strip -colors 256 "$output_file"
if [ $? -eq 0 ]; then
echo "Image compression completed: $input_file"
echo "Backup created: $backup_file"
else
mv "$backup_file" "$input_file"
echo "Error during image compression"
exit 1
fi