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