Posts Tagged ‘linux’

Batch reduce resolution of images in Ubuntu Linux

Posted in bash, linux on February 22nd, 2009 by David – 1 Comment

Open a terminal window or shell (who needs a GUI!?)
sudo apt-get install imagemagick
cd image_folder
mkdir resized
for f in *jpg
do
convert -resize 30% $f resized/$f
done

Easier than Photoshop, I reckon!

I needed this today for some photos I was uploading. Photos from recent cameras are huge and Australian bandwidth doesn’t cut it. So this really helps.

Obviously you only need to do the first line once. I found this in the Ubuntu forums but it took me a while to find the right combination of keywords in Google. View the original thread.

I needed to change jpg to JPG, because the camera used uppercase and Linux is case-sensitive. 30% was good for me but you may need to change that.

If you don’t understand this, ask me, I’m happy to help!

Fixing Windows File Permissions in Linux

Posted in bash on February 20th, 2009 by David – Be the first to comment

Find all files (not directories) and remove the eXecutable bit. I don’t know what the characters on the end do:
find . -type f -exec chmod a-x {} \;

Make all directories executable to user, read/writable to groups others (good for when the web server is in ‘others’):
find . -type d -exec chmod 755 {} \;

Make all files read/write/executable for user, readable for the group and others:
find . -type f -exec chmod 644 {} \;