Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Distribution: Debian 4.0, Ubuntu 6.10, Ubuntu Server 6.06
Resizing images quickly?
Is there any batch image resizing program out there for Linux? I've got a ton of high res photos from my digital camera I want to send via email, but don't really want to go in and do it all by hand for each one.
Wow, I was wondering the same thing. Thanks for the tip, Dave!
One question though.. is there a way to specify a height and have the width adjusted based on the aspect ratio of the pictures? I would basically like images of various sizes to end up with a height of 50 pixels and a width of whatever it takes to keep the aspect ratio constant.
I don't have an answer to your question because I have never ask myself that question. I remember that HTML code will allow you to use only one dimension and auto-size the other.
Have you tested yet to see if what you ask will work?
If one has a lot of images to process they should learn ImageMagick and its many applications. Then learn enough 'bash scripting' ( for i in *.jpg; do echo $i; ???whatever???; done ) to step through a list of images.
To deal with those pesky spaces in the filenames (and to get that 50-pixel-height limitation you want), try this:
for i in *.jpg; do echo "$i"; convert "$i" -resize x50 "$i"; done
Note the quotation marks around the $i - that groups the filename into one piece so your shell doesn't think it's several separate arguments. AFAIK, you don't need the "-size" option for most images; only those in some kind of raw format that the program is unable to figure out a size for. The use of x50 tells convert to resize to 50 pixels in height, and scale the width accordingly.
Another question you ask was what to do about the spaces in the file name. In the tutoral on bash scripting is an illustration of changing the spaces to under-scores.
Also the following script renames files with spaces in the title.
##take a command line parameter for a new file name.
##all images will have the same name and be numbered.
for filename in *.jpg
let "number += 1"
mv "$filename" "$pname-$number.jpg"
if [ "$number" -eq "$ONE" ] # For correct grammar.
echo "$number file renamed."
echo "$number files renamed."
To create file names with spaces use this: # changename 1stword" "2ndword
To create file names without space use this: #changename filename