Adding support for png images

This commit is contained in:
2019-05-23 13:52:24 +02:00
parent a7b92ad795
commit 580bac4e0f

View File

@@ -22,7 +22,7 @@ STARTTIME=$(date +%s)
# drop CIFS cache in case target files existed before
#sync; echo 3 > /proc/sys/vm/drop_caches;
for file in "$sourceDir"/**/*.{jpg,JPG,jpeg,JPEG}
for file in "$sourceDir"/**/*.{jpg,JPG,jpeg,JPEG,png,PNG}
do
if [[ ! -f "$file" ]]
then
@@ -52,11 +52,15 @@ do
mkdir -p "${destDir}${fnPath}"
#Error checking
result=$(jpeginfo -c "$file")
if [[ $result != *"[OK]"* ]]
then
echo $result
# image format specific checks to display warnings
exp='\.(png|PNG)$'
if [[ ! "$file" =~ $exp ]] ; then
#Error checking
result=$(jpeginfo -c "$file")
if [[ $result != *"[OK]"* ]]
then
echo $result
fi
fi
#auto rotate source image according to exif orientation information
@@ -66,6 +70,7 @@ do
if [ "$quali" -le "0" ]; then
quali=94
fi
echo "rotate with quality $quali preserving timestamp: $file"
TIMESTAMP="$( ls -l --time-style='+%Y%m%d%H%M.%S' "${file}" | cut --delimiter=' ' --fields=6 )"
mogrify -auto-orient -quality ${quali} "${file}"