Profile picture for user admin_romcom

What is this about?

 Have photos from your camera and want to share them online, but in a way that leaves you some webspace and those people who want to see them some bandwith? This linux script batch converts all images in the current directory to 640 times 480 (or 480x640, as appropriate), but you can of course easily modify this target size. Everything very basic, though I could not find a ready script online.
 If you don't have an automatic slideshow script yet you might want to use this one.

The batch conversion script

 The script should work on all standard Linux distributions. Simply copy the following text, put into a new text file. Save that file, ideally in some directory that is searched for commands (one of your $PATH dirs) and give it the "executable" flag.#!/bin/bash
echo "This will resize all jpg images in the current directory to 640x480 (or 480x640, as appropriate), an optional paramter will be prefixed to result files."
for i in *.jpg ;
SIZEX=$(identify $i | egrep -o '[0-9]+x' | egrep -o '[0-9]+')
SIZEY=$(identify $i | egrep -o 'x[0-9]+' | egrep -o '[0-9]+')
if(test $SIZEX -ge $SIZEY;)then
  convert -size 640x480 $i -resize 640x480 $1_$i;
  convert -size 480x640 $i -resize 480x640 $1_$i;
echo "resized image $1_$i created." ;


Добавить комментарий

The content of this field is kept private and will not be shown publicly.
  • No HTML tags allowed.
 o   o  o---o   o-o   o-O-o  o-o   
| | / | | | \
| | -O- o-o | | O
| | / | | | /
o-o o---o o--o o o-o

Enter the code depicted in ASCII art style.