Huge improvement of apk file size thanks to Alayan.
The apk is now 20 MB smaller. It may need some testing to see if there are no artifacts, but as far as I see there is no difference in quality.
This commit is contained in:
parent
4cb6ea4871
commit
b430a0e5bf
@ -32,7 +32,7 @@ after some tweaks, but atm. only linux is supported.
|
||||
Dependencies list (may be incomplete):
|
||||
|
||||
autoconf, automake, make, python, gradle, ant, imagemagick, cmake,
|
||||
vorbis-tools
|
||||
vorbis-tools, pngquant
|
||||
|
||||
Additionally some dependencies for optimize_data script:
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# value greater than 0.
|
||||
# The CONVERT_TO_JPG variable enables converting all images that are safe to
|
||||
# convert and keeps other images untouched.
|
||||
# The script needs imagemagick and ogg utils installed to use DECREASE_QUALITY
|
||||
# feature
|
||||
# The script needs imagemagick, pngquant and ogg utils installed in order to
|
||||
# use DECREASE_QUALITY feature
|
||||
|
||||
################################################################################
|
||||
|
||||
@ -203,7 +203,7 @@ convert_image()
|
||||
fi
|
||||
|
||||
convert $SCALE_CMD $QUALITY_CMD "$FILE" "tmp.$FILE_TYPE"
|
||||
|
||||
|
||||
if [ -s "tmp.$FILE_TYPE" ]; then
|
||||
SIZE_OLD=`du -k "$FILE" | cut -f1`
|
||||
SIZE_NEW=`du -k "tmp.$FILE_TYPE" | cut -f1`
|
||||
@ -259,6 +259,19 @@ convert_sound()
|
||||
rm -f tmp.wav tmp.ogg
|
||||
}
|
||||
|
||||
optimize_png()
|
||||
{
|
||||
FILE="$1"
|
||||
echo "Optimize file: $FILE"
|
||||
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo " File doesn't exist."
|
||||
return
|
||||
fi
|
||||
|
||||
pngquant --force --skip-if-larger --output "$FILE" -- "$FILE"
|
||||
}
|
||||
|
||||
convert_to_jpg()
|
||||
{
|
||||
FILE="$1"
|
||||
@ -347,7 +360,7 @@ convert_to_jpg()
|
||||
convert_to_jpg_extract_b3dz()
|
||||
{
|
||||
FILE="$1"
|
||||
echo "Convert file: $FILE"
|
||||
echo "Convert file to jpg: $FILE"
|
||||
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo " File doesn't exist."
|
||||
@ -368,7 +381,7 @@ convert_to_jpg_extract_b3dz()
|
||||
convert_to_jpg_update_b3d()
|
||||
{
|
||||
FILE="$1"
|
||||
echo "Convert file: $FILE"
|
||||
echo "Update b3d file: $FILE"
|
||||
|
||||
if [ ! -f "$1" ]; then
|
||||
echo " File doesn't exist."
|
||||
@ -448,7 +461,7 @@ convert_to_jpg_update_b3d()
|
||||
convert_to_jpg_update_spm()
|
||||
{
|
||||
FILE="$1"
|
||||
echo "Convert file: $FILE"
|
||||
echo "Update spm file: $FILE"
|
||||
|
||||
if [ ! -f "$1" ]; then
|
||||
echo " File doesn't exist."
|
||||
@ -520,7 +533,7 @@ convert_to_jpg_update_spm()
|
||||
convert_to_jpg_update_xml()
|
||||
{
|
||||
FILE="$1"
|
||||
echo "Convert file: $FILE"
|
||||
echo "Update xml file: $FILE"
|
||||
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo " File doesn't exist."
|
||||
@ -568,6 +581,10 @@ if [ $CONVERT_TO_JPG -gt 0 ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $DECREASE_QUALITY -gt 0 ]; then
|
||||
find assets/data -iname "*.png" | while read f; do optimize_png "$f" "png"; done
|
||||
fi
|
||||
|
||||
|
||||
# Copy data directory
|
||||
echo "Copy data directory"
|
||||
|
Loading…
Reference in New Issue
Block a user