Ubuntu: How to automatically copy pictures with resizing to some directory?


I'd like to share some pictures with someone using Dropbox. However, I'd prefer to downgrade the resolution of them (they will only be viewed on screen on the other side, so there's no need for big resolutions). I can resize them easily with ImageMagick's convert and sync them to some folder in ~/Dropbox using rsync, but I'd like to combine these features. My dream workflow looks like this: I copy the images to, say, ~/to-share, the new (and only new!) files are automatically converted with downgrading the resolution to ~/Dropbox/to-share. A less ideal solution includes running some script to do the syncing (after copying).

Does there exist anything like that?


Some bash scripts that should be mostly correct, but of course should be verified:

If you want to watch the directory for new files, with an if just in case:

inotifywait -m -e create ~/to-share/ | while read line  do      if [ ! -a ~/Dropbox/to-share/r$line ]; then          convert "$file" "~/Dropbox/to-share/r$line"      fi  done  

If you want to just run the script repeatedly:

while true; do      for filename in ~/to-share/*; do          if [ ! -a ~/Dropbox/to-share/r$filename ]; then              convert "$file" "~/Dropbox/to-share/r$file"          fi      done      sleep 2;  done  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »