Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 28 Jul 2014, 16:57
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How-to: Batch-resize a group of images.
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
Fossil

Joined: 13 Dec 2005
Posts: 554
Location: Gloucestershire, UK.

PostPosted: Tue 24 Jun 2008, 12:13    Post subject:  How-to: Batch-resize a group of images.
Subject description: Using, aaphoto image-resizer.
 

Most people who own a computer also have a digital camera. The increasing size of digital memory cards means there's no constraint on the number of images that can be taken at any one time. In consequence, after a day out at an interesting venue, there's usually a large number of pictures to be looked through and resized for easier viewing or emailing off to friends and relatives. A few minutes work on just one image, can now escalate into a couple of hours of manually resizing lots more. How best to automate the slow repetitive routine?

Before anything else. When working with digital photos it always pays to manipulate a copy rather than the original picture. Copy the memory card's contents to a folder on the hard drive. It is also a lot easier to use a simple multicard reader, than attempting to copy a lot of pictures from the camera via a lead plugged directly into the computer. There's always the possibility the camera's batteries might fail half-way through the operation. Images can sometimes become corrupted. Knowing 'Murphy's Law', it's always the irreplaceable ones!

First. Download the resizing and image enhancing program, aaphoto.
http://puppylover.netsons.org/dokupuppy/programs:image_editor
Or, the home website:
http://log69.com/index_en.html

Copy aaphoto to /usr/bin.

Use a text editor to write a simple bash script.
Quote:
#!/bin/bash

aaphoto "$@" -a -r640 -q75

The meaning: auto-adjust image tones, resize to 640 pixels, using 75% quality.

Save the script in /usr/bin with an easily identifiable name, 'Photo-resize_x640'. Right-click on the script. Properties. Under 'Permissions' tick the box, 'Exec'. 'Refresh', then Close. It's easy to make up several, with different resize options. For convenience, simply drag the script('s) out onto the desktop.

To resize pictures. Select the ones required, drag and drop the images onto the bash script. The selected images will be resized and placed within the same folder as the originals, with 'new' added to the resized image.

***

Alternatively, method 2.
Having already made up your resize scripts.
Right-click on an image. When the menu appears, go to, 'Open With'.... 'Customise'. Then, Control-Shift-Drag one or more of the resizing bash scripts from /usr/bin into the open menu selection.
The next time any pictures need to be resized, hilight the images required, right-click, 'Open-With', select the preferred script from the menu. Automatic resizing will then commence.

***

Alternatively, method 3.
In GQview it's even easier.
Go into, Edit, Options, Editors. Type a name for the program in the Menu, such as, "Aaphoto - Resize-x640", etc. Then add this line of code for the Command line. aaphoto %f -a -r640 -q75

It's also a simple matter to change the -r640 to a larger size, such as, -r800, or -r1024. The same for the quality setting. -q85, etc.
Finish by clicking on, 'Apply', 'OK'.
Using GQview, go into the folder in which you have stored the copied photos. Hilight all (Control-A) or whatever individual ones you want (Control, left mouse-click).Go back up to Edit, select the menu for Aaphoto - Resize-x640, etc. And that's it. Aaphoto will now begin resizing all the selected images, adding the suffix 'new' to the resized pictures.

***

Renaming.

If there's a need to add a more meaningful description to the pictures, use Rox. Hilight all (Control-A), then right-click, Rename.
Use the left-hand upper box, Replace. Tip: Hover the cursor over the space, which reveals some hints. To add a name at the start of the image, use ^ then type a short name/outline detail in the right hand box, 'With'. Click on, 'Apply'. Look at the effect, if it's suitable, click on 'Rename'. That's it!
Far easier than renaming one-by-one.

Have fun! Wink

Last edited by Fossil on Tue 24 Jun 2008, 12:24; edited 2 times in total
Back to top
View user's profile Send private message 
Dingo


Joined: 11 Dec 2007
Posts: 1415
Location: somewhere at the end of rainbow...

PostPosted: Tue 24 Jun 2008, 12:15    Post subject:  

very interesting and useful, a post you must sticky!
_________________
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
Back to top
View user's profile Send private message Visit poster's website 
Fossil

Joined: 13 Dec 2005
Posts: 554
Location: Gloucestershire, UK.

PostPosted: Tue 24 Jun 2008, 12:28    Post subject:  

Thank's Dingo,

If it wasn't for you posting aaphoto, I'd still be trawling through 100+ images by hand Confused
Back to top
View user's profile Send private message 
Dingo


Joined: 11 Dec 2007
Posts: 1415
Location: somewhere at the end of rainbow...

PostPosted: Tue 24 Jun 2008, 12:40    Post subject:  

only a question: since aaphoto create resized images in the same directory, how you separate resized images from original? for the rest, it's true that aaphoto is very powerful as resizing tool
_________________
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
Back to top
View user's profile Send private message Visit poster's website 
Fossil

Joined: 13 Dec 2005
Posts: 554
Location: Gloucestershire, UK.

PostPosted: Tue 24 Jun 2008, 16:33    Post subject:  

Quote:
how you separate resized images from original?

Right-click, Display, Sort-by-Date. The newest ones will be last - separating old originals, and the new resized copies. Draw a bounding box with the cursor around the ones you want; if there's a couple out of reach, use Control, and mouse-click on the stragglers. Copy, or move, to another folder.
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6673
Location: lisbon

PostPosted: Tue 24 Jun 2008, 21:49    Post subject:  

Fossil & Dingo,

running from the commandline this works for me:

Code:

#!/bin/bash
directory=`pwd`                                                               
                                                                               
mkdir original                                                                 
mkdir resized                                                                 
for file in $directory/*.jpg                                                   
do                                                                             
        aaphoto $file -a -r640 -q75                                           
        mv $file original                                                     
done                                                                           
mv *.jpg resized
Back to top
View user's profile Send private message 
davidA


Joined: 15 Jun 2008
Posts: 64
Location: Location: Location:

PostPosted: Tue 24 Jun 2008, 22:22    Post subject:  

muggins wrote:
Fossil & Dingo,

running from the commandline this works for me:

Code:

#!/bin/bash
directory=`pwd`                                                               
                                                                               
mkdir original                                                                 
mkdir resized                                                                 
for file in $directory/*.jpg                                                   
do                                                                             
        aaphoto $file -a -r640 -q75                                           
        mv $file original                                                     
done                                                                           
mv *.jpg resized


So: now I realize I have to hone up on my shell scripting skills (or at least my skills when using the command line) Sad

And that is supposed to be a compliment muggins Cool
Back to top
View user's profile Send private message 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Wed 25 Jun 2008, 00:05    Post subject:  

This is very similar to what I was doing but requires less HDD.

Here is what I was doing:

I installed ImageMagick

and created the following script

Code:
cd "$1"
smallDirName="small$(basename $1)"
mkdir "${smallDirName}"
for picture in *.jpg
  do convert "$picture[640x480]" "${smallDirName}/$picture"
done
cd "$1"
montage -tile 5 -geometry +4+4  -label "$1" -font Verdana -pointsize 10 -quality 30  "*.jpg[160x120]"  __index.jpg
Which does the resize plus creates an index file.

I created a batch file for windows and a script file for linux, both work the same way.

You just drag a folder with jpeg files and it creates a subfolder with "small" prefixed with all the resized images.

_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to

Last edited by rarsa on Wed 25 Jun 2008, 11:46; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Wed 25 Jun 2008, 03:31    Post subject:  

here is a very small and simple to use batch-converter I wrote a month ago:
http://murga-linux.com/puppy/viewtopic.php?t=29184
Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
firak

Joined: 14 Apr 2008
Posts: 174

PostPosted: Tue 23 Sep 2008, 18:11    Post subject:  THAKS FOSSIL
Subject description: this i very inportant
 

I will try it. Question
actuaaly for work with oofice document with immages, beforare insert the immage, this is very inportant, to not oversize the kb of the document.
I did not found yet in the programs of puppy & also in gimpshop, a short way to restrize immages. so thaks, i will try it......
i ALREADY TRY IT IT WORKS. Rolling Eyes
very inportant for eepc, very usefool for office document
It is amazing how easy is life with such friendly open sourece people Idea , instead of MS win.

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0932s ][ Queries: 11 (0.0122s) ][ GZIP on ]