[Android] hansmoon:
I converted thousands of .qmg images USING shell script.

I made script that extraxt only .qmg ( using 7z binary)

and then send intent QuickPic CropActivity

for...

am start -W -a android.intent.action.VIEW -n com.alensw.PicFolder/.CropActivity -d "file://..........png"

And touch event...

done

like this...

And I converted .qmg to .png ONLY.

There is no .9.qmg in My S3 Firm and Note4 Firm.

(All Nine Patch images are .9.png format filename)

Sorry~

this is my script

(7za zipalign binary needed)

sh - /sdcard/Download/modding

input

app - /sdcard/Download/modding/app

priv-app - /sdcard/Download/modding/priv-app

output

conv_app - /sdcard/Download/modding/app

conv_priv-app - /sdcard/Download/modding/priv-app

(output apk contains only res folder, converted .png images from .qmg)

#!/system/bin/sh

dir=/sdcard/Download/modding

cd $dir

N='\e[0m'

black='\e[0;30m'

green='\e[1;32m'

yellow='\e[1;33m'

purple='\e[1;35m'

cyan='\e[1;36m'

white='\e[1;37m'

bins="busybox 7za zipalign"

for binary in $bins ; do

bin=`which $binary`

if [ -z $bin ]

then

echo

echo ${yellow}"No $binary Binary."

echo "Needs : "$bins${N}

exit

fi

done

clear

echo

ltup="┌" ; rtup="┐"

ltlo="└" ; rtlo="┘"

hori="─" ; vert="│"

box() {

isko=

msg=$1

isko=$2

msglen=${#msg}

if [ "$isko" = "k" ] ; then

msglen=$(( msglen * 2 / 3 ))

elif [ "$isko" -gt 0 ] ; then

msglen=$isko

fi

boxwidth=$((msglen+2))

echo -n $ltup

for i in `seq 1 $boxwidth` ; do

echo -n $hori

done

echo $rtup

echo $vert" "$msg" "$vert

echo -n $ltlo

for i in `seq 1 $boxwidth` ; do

echo -n $hori

done

echo $rtlo

}

echo ${cyan}"╔══════════════════════════════╗"

echo "║ QMG Image Converter. - MELFY ║"

echo "╚══════════════════════════════╝"${N}

echo

conv_qmg() {

echo ${yellow}"APK : "$apkname${N}

echo

isqmg=$( 7za l -tzip $apkname | grep ".qmg" )

if [ -z "$isqmg" ] ; then

echo ${purple}"No qmg image in APK."${N}

echo

return 1

fi

rm -rf res

7za x -tzip $apkname res/*.qmg -r -y > /dev/null 2>&1

qmgs=$( find ./res -iname "*.qmg" )

qcnt=$( echo $qmgs | wc -w )

tqcnt=0

for j in $qmgs ; do

echo ${green}${j##*/}${N}

echo

(( tqcnt += 1 ))

echo ${cyan}$tqcnt" / "$qcnt${N}

pngname=${j/.qmg/.png}

tmpname=${pngname/.png/~01.png}

fpath=${j%/*}

fname=${j##*/}

onlyname=${fname%.*}

mv $j $fpath"/"$onlyname".png"

fullpath=$( echo $fpath | sed "s/^.//" )

fullpath=$dir"/"$fullpath

am start -W -a android.intent.action.VIEW -n com.alensw.PicFolder/.CropActivity -d "file://"$fullpath"/"$onlyname".png" > /dev/null 2>&1

input tap 700 100

#pid_jobs=`jobs -p`

#pid_jobs=$!

#sleep 3

#rm -f $pngname

wait #$pid_jobs

if [[ $tqcnt -le 3 ]] ;

then

sleep 2

fi

mv $tmpname $pngname

rm -f $tmpname

echo $tmpname

echo

done

#7za d -tzip $apkname res/*.qmg -r -y > /dev/null 2>&1

7za a -tzip $apkname".tmp" res -y > /dev/null 2>&1

mv $apkname".tmp" $apkname

zipalign -f 4 $apkname aligned_$apkname

mv aligned_$apkname $apkname

touch $apkname

(( cnt += 1 ))

echo ${yellow}" $cnt / $tcnt"

rm -rf res

cp $apkname $fol

#rm -f $apk

}

count_qmg() {

echo

echo $1

cnt_qmg=$( 7za l -tzip $1 | grep ".qmg" | wc -l )

total_qmg=$((total_qmg+cnt_qmg))

#echo $cnt_qmg

#echo $total_qmg

}

out="/dev/null"

quickpic="/data/app/com.alensw.PicFolder*.apk"

isapp=$( ls $quickpic )

if [ -z "$isapp" ] ; then

echo

echo ${purple}"Quickpic app Must Be Installed."${N}

exit

fi

rm -rf res

mkdir -p conv_app

mkdir -p conv_priv-app

applist=$( find $dir/app -type f -iname "*.apk" | sort )

papplist=$( find $dir/priv-app -type f -iname "*.apk" | sort )

tapplist=$applist" "$papplist

acnt=$( echo $applist | wc -w )

pacnt=$( echo $papplist | wc -w )

tcnt=$((acnt+pacnt))

total_qmg=0

cnt_qmg=0

for cqmg in $tapplist ; do

count_qmg $cqmg

echo -n " Total : "$total_qmg" : "$cnt_qmg" "\\r

done

echo

echo

echo ${green}"APK LIST"${N}

echo

echo "APK in app folder : "$acnt

echo "APK in priv-app folder : "$pacnt

echo "Total APKs COUNT : "$tcnt

echo

echo "Total qmg images : "$total_qmg

echo

echo -n "OK? (y/n)" ; read ok

if [ "$ok" != "y" ] ; then

echo

echo ${purple}"Canceled..."${N}

echo

exit

fi

cnt=0

for sa in $applist; do

fol="./conv_app/"

apk=$sa

apkname=${apk##*/}

cp $apk .

conv_qmg $apkname

rm -f $apkname

done

echo

for spa in $papplist; do

fol="./conv_priv-app/"

apk=$spa

apkname=${apk##*/}

cp $apk .

conv_qmg $apkname

rm -f $apkname

done

echo

echo

echo ${cyan}"Finished."${N}

echo

echo ${cyan}"════════════════════════════════"${N}

exit