LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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.

Notices


Reply
  Search this Thread
Old 01-02-2005, 08:26 AM   #1
Boffy
Member
 
Registered: Jul 2003
Location: Durham, UK
Distribution: Ubuntu 8.04
Posts: 419

Rep: Reputation: 30
Resize all phots in a folder


Is there anyway I can make all the photos in one folder samller so they can be e-mailed easier they are huge at the moment.

Boffy
 
Old 01-02-2005, 08:33 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

yes. you just need to write a script using the application
Code:
convert
'man convert' is your friend.

regards

slackie1000
 
Old 01-02-2005, 08:50 AM   #3
Boffy
Member
 
Registered: Jul 2003
Location: Durham, UK
Distribution: Ubuntu 8.04
Posts: 419

Original Poster
Rep: Reputation: 30
I can use it but how do you do it for a whole directory?

convert -geometry 25%x25% *.jpg - When i use that the new files end with .1 , .2 etc.

Can anyone tell me how to make it go to .1.jpg or something, or even a mass renaming program.


What a great program.

Boffy

Last edited by Boffy; 01-02-2005 at 08:57 AM.
 
Old 01-02-2005, 11:30 AM   #4
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

no shell guru, but i think this one is not hard.
something like that can help. i suppose that all files are jpg.
Code:
#! /bin/bash
for filename in *.jpg
do
       dummy=$filename
       convert -geometry 25%x25% dummy   
done
i didn't test. the rest you should be able to do by yourself.

regards
slackie1000
 
Old 01-02-2005, 11:46 AM   #5
ttolst
Member
 
Registered: Jan 2005
Location: Århus, Denmark
Distribution: Debian GNU/Linux
Posts: 34

Rep: Reputation: 15
shouldn't it be $dummy in the convert line?

alternative:

mkdir small_images

ls *.jpg | xargs -i convert -geometry 25%x25% {} small_images/{}

not as readable, but i am more into the xargs command than actual shell script.
 
Old 01-02-2005, 11:56 AM   #6
Boffy
Member
 
Registered: Jul 2003
Location: Durham, UK
Distribution: Ubuntu 8.04
Posts: 419

Original Poster
Rep: Reputation: 30
Code:
#! /bin/bash
for filename in *.jpg
do
     convert -geometry 25%x25% $filename new.$filename
done
with that slight alteration shown above it works great thanks a lot.

Boffy

Last edited by Boffy; 01-02-2005 at 12:42 PM.
 
Old 01-02-2005, 01:54 PM   #7
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,

great! this is how it should work:
a small input leading to the solution.
glad to help!!

regards

slackie1000
 
Old 01-02-2005, 02:20 PM   #8
Boffy
Member
 
Registered: Jul 2003
Location: Durham, UK
Distribution: Ubuntu 8.04
Posts: 419

Original Poster
Rep: Reputation: 30
thanks a lot!

Boffy
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder Max Size and Limiting SSH access to home folder. Mefistofeles Linux - General 4 11-26-2005 02:09 PM
permissions difference between /home/..../folder and /root/folder darkleaf Linux - General 3 07-21-2005 05:23 PM
how can i default the max folder file size when it create inside a folder antony_csf Linux - Software 1 06-17-2004 02:26 AM
gnome home folder and trash folder ambelos Linux - Software 2 02-24-2004 06:44 AM
resize hdb1 -root folder!! ngan_yine Linux - Newbie 2 01-15-2004 03:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration