blob: d1be94f0be1792f7ef25d929f3e9a2b4d29e1542 [file] [log] [blame]
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -02001#!/bin/sh
2#
3# Copyright (C) 2015 OmniROM Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
Jesus Partida (PartimusPrime)f71a9222015-12-17 23:54:15 +010017# original is 1080x608
18#
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -020019# cleanup screen
20clear;
21
22# resolutions
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -020023RESOLUTIONS="\
Jesus Partida (PartimusPrime)f71a9222015-12-17 23:54:15 +010024 640x362 \
25 720x407 \
26 1440x814 \
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -020027 ";
28
29# resize image and set quality
30convert_image() {
Jesus Partida (PartimusPrime)f71a9222015-12-17 23:54:15 +010031 convert "${1}" -resize "${2}" -quality ${3} tmp.png;
32 mv tmp.png "${1}";
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -020033}
34
35# rewrite desc.txt
36rewrite_desc() {
37res=$(echo "${1}" | sed s/x/\ /)
38cat > desc.txt << EOF
Jesus Partida (PartimusPrime)f71a9222015-12-17 23:54:15 +010039${res} 60
40c 0 0 Part0
41c 1 60 Part1
42c 1 0 Part2
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -020043EOF
44}
45
Humberto Borbaed550692015-03-27 11:06:36 -030046# image quality
Jesus Partida (PartimusPrime)f71a9222015-12-17 23:54:15 +010047quality=95;
Humberto Borbaed550692015-03-27 11:06:36 -030048
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -020049# reading images
50for i in ${RESOLUTIONS}; do
51
52# cleanup environment
53 rm -rf "${i}";
54 rm -rf "${i}.zip";
55
56# create a temporary folder
57 mkdir -p "${i}";
58 cd ${i};
59
60 echo "============================================================";
61 echo "Resolution: ${i}"
62 echo "============================================================";
63 echo "Uncompressing bootanimation...";
64 unzip ../../bootanimation.zip > /dev/zero;
65
66 echo "Rewriting desc.txt...";
67 rewrite_desc "${i}"
68
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -020069 echo "Resizing images...";
Jesus Partida (PartimusPrime)f71a9222015-12-17 23:54:15 +010070 for j in Part*/*.png; do
Humberto Borbaa5dfd9f2015-01-31 16:50:25 -020071 convert_image "${j}" "${i}" $quality;
72 echo -ne " ==> please wait...\r";
73 done
74
75 echo "";
76 echo "Compressing bootanimation...";
77 echo "";
78 zip -r0 ../${i}.zip . > /dev/zero;
79
80 sleep 1;
81 echo "Done";
82
83# remove temporary folder
84 cd ..
85 rm -rf ${i}
86done