Files
assistant-android/scripts/convert_size.sh
2017-07-19 10:25:17 +08:00

42 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# *****************************************************************************
# @author CsHeng
# @2016.2.25
#
# 【未完成】根据比例使用ImageMagick convert命令对图片进行分辨率压缩
#
# 选项:
# -s src dir of images, default ../res
#
# *****************************************************************************
#find ~/Downloads/Desktop/0/ -name '*.png' -exec bash -c `file $0 | awk '{print $0}'` {} \;
# get all png file height dimension
#find . -name '*.png' | xargs file | awk '{ print $7}' | sed 's/,//g'
#find . -name '*.png' | xargs file | awk '{ print $7}' | sed 's/,//g'
#for entry in `ls ${CWD} | grep '.*apk$'`
inputs=$(find ./0 -name '*.png')
outputs=$(find ./1 -name '*.png')
for f in $inputs
do
src=$f
src_w=`file $src | awk '{print $5}'`
src_h=`file $src | awk '{print $7}' | sed 's/,//g'`
dst=`echo $src | sed 's/\.\/0/\.\/1/g'`
dst_w=`file $dst | awk '{print $5}'`
dst_h=`file $dst | awk '{print $7}' | sed 's/,//g'`
echo "Src " $src $src_w $src_h
echo "Dst " $dst $dst_w $dst_h
# find $f | xargs echo
# file $f | sed 's/\.\/0/\.\/1/g' | xargs echo
# find $f | xargs echo
# s=$(find $f)
# echo $s
done