2009-06-08 03:05:52
1. The first script below rotates jpg images to the right.
The original images are saved in the rotated_90 directory and the rotated photos have an _r added in the name.
2. The second script rotates jpg images to the left.
The original images are saved in the rotated_270 directory.
3. The last script sends resized jpg images by mail using evolution.
The script resizes the images to 1024x768, then creates a zip file and mail it using evolution.
A mail window will open with a zip file attached where you can write email address, subject and message. You can also check the size of the zip file.
How to use this :
Install :
Copy scripts to ~/.gnome2/nautilus-scripts/
In nautilus :
Select jpg imgages, right click, choose scripts in context menu, then choose script you want to run.
Turn photos right :
-------------------------------------------------------------
import os
import sys
del sys.argv[0]
files = sys.argv
os.popen('mkdir rotated_90')
for i in range(len(files)):
output_name = files[i].split('.')[0] + '_r.jpg'
os.popen('convert "'+files[i]+'" -rotate 90 "'+output_name+'"')
os.popen('mv "'+files[i]+'" rotated_90/')
-------------------------------------------------------------
Turn photos left :
-------------------------------------------------------------
import os
import sys
del sys.argv[0]
files = sys.argv
os.popen('mkdir rotated_270')
for i in range(len(files)):
output_name = files[i].split('.')[0] + '_r.jpg'
os.popen('convert "'+files[i]+'" -rotate 270 "'+output_name+'"')
os.popen('mv "'+files[i]+'" rotated_270/')
-------------------------------------------------------------
Send photos by mail :
-------------------------------------------------------------
import os
import sys
del sys.argv[0]
files = sys.argv
os.popen('rm -f resized.zip')
os.popen('mkdir resized')
for i in range(len(files)):
output_name = files[i].split('.')[0] + '_s.jpg'
os.popen('convert "'+files[i]+'" -resize 1024x768 "resized/'+output_name+'"')
os.popen('zip -r resized.zip resized')
os.popen('rm -rf resized')
os.popen('evolution mailto:?attach="resized.zip"')
-------------------------------------------------------------