Adding support for png images
This commit is contained in:
@@ -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,12 +52,16 @@ do
|
|||||||
|
|
||||||
mkdir -p "${destDir}${fnPath}"
|
mkdir -p "${destDir}${fnPath}"
|
||||||
|
|
||||||
|
# image format specific checks to display warnings
|
||||||
|
exp='\.(png|PNG)$'
|
||||||
|
if [[ ! "$file" =~ $exp ]] ; then
|
||||||
#Error checking
|
#Error checking
|
||||||
result=$(jpeginfo -c "$file")
|
result=$(jpeginfo -c "$file")
|
||||||
if [[ $result != *"[OK]"* ]]
|
if [[ $result != *"[OK]"* ]]
|
||||||
then
|
then
|
||||||
echo $result
|
echo $result
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#auto rotate source image according to exif orientation information
|
#auto rotate source image according to exif orientation information
|
||||||
orient=$(exiftool -Orientation "${file}")
|
orient=$(exiftool -Orientation "${file}")
|
||||||
@@ -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}"
|
||||||
|
Reference in New Issue
Block a user