SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I gotta learn bash scripting. Got a book or two but never read them.
That's a nice script -- real clean and efficient. I'm going to add
my videos from my Sony camera to it. Thanks!
Which is the output of the date function. Look at man date and you can change the format as needed. Warning, don't use a time which has a colon in the output.
This is what I am trying to do to reduce the size of the images after downloading them:
Yes, I issued "man date" just after posting that. And I made me a little script to do my videos, also. I can probably put it in the same script, but haven't yet. When I get some time I'll check out "convert" or something in the Imagemagick app and give you a line to replace that one.
If you get there before me, in a Slackware system we have:
file:///usr/share/doc/ImageMagick-6.2.6/www/convert.html
#!/bin/bash
newdir="$(date +%a-%b%d-%Y-%H-%M-%S)"
mkdir $HOME/images/$newdir
cd $HOME/images/$newdir
mount /mnt/usbdrive # this works
mv /mnt/usbdrive/dcim/100_fuji/* ./ # The "./" is NOT a typo
for file in *.jpg # go through every file...
do
convert -size 800x600 $file # ...and resize it
done
umount /mnt/usbdisk # only if you want to
this allows you to type cd instead of /bin/cd on the command line or in scripts.
the $(...) on line 2 is equivalent to `...`, but can be quoted safely.
See man strftime for how to format date.
All characters are safe for file or directory names. You just need to escape special ones with a backslash (\).
finally, you can get ImageMajick from imagemajick.org.
#!/bin/bash
mount /mnt/usbdrive # mounts usb device which is defined in fstab:
# /dev/sda1 /mnt/usbdrive vfat noauto,user,rw 0 0
#
newdir="$(date +%a-%b%d-%Y-%H-%M-%S)" # creates date string with format: Mon-Apr17-2006-17-36-29
mkdir $HOME/images/$newdir # makes directory with name = date string
cd $HOME/images/$newdir # change to new directory
mv /mnt/usbdrive/dcim/100_fuji/* ./ # move photo images to new directory, using camera specific path, empties camera
mkdir ./web # create a new directory to put web optimized images
#
for filename in *.jpg # go through every file
do
convert $filename -sample 800x600 -quality 75 web/$filename #resize, compress, save to web directory
done
#
umount /mnt/usbdrive #unmount usb device
It removes images from the camera, puts them in a date/timestamped directory, makes a web directory underneath it, then reduces the size and compresses the images, saving them in the web directory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.