
Image resize (batch)
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
sadi
8 years ago
There is also a typo concerning "resized" folder which results in original files being overwritten.
So here is my suggestion:
===============================
if hash zenity 2>/dev/null; then
if hash mogrify 2>/dev/null; then
loc=$(${ZENITY} --file-selection --title="Select a Folder" --directory)
cd $loc
pwd
mkdir $loc/resized/
cp $loc/* $loc/resized/
cd resized
size=$(zenity --title "New Size" --entry --text "Please enter the new size as WxH")
type=$(zenity --title "File Type" --entry --text "Please enter type of files to resize")
mogrify -resize $size! *.$type | ( zenity --width=400 --height=100 --progress --title="Please wait until OK..." --percentage=1)
else
echo "Please install the dependencies imagemagick and zenity"
exit 0;
fi
fi
Report
cdar07
11 years ago
Report
hemanth
11 years ago
Report
hemanth
11 years ago
and the user is advice to run the script as a root, but as you have mentioned they might not have permissions.
Report
kramp
11 years ago
echo "Installing the dependcies"
sudo apt-get install imagemagick
sudo apt-get install zenity
You should change these lines, and just display an error, for the following reasons:
- the user may not have the sudoers rights
- your script might work on other packages systems
Or at least ask the user to confirm the dependencies install
Report