Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Image Resizing

  • 14-07-2004 2:18pm
    #1
    Registered Users, Registered Users 2 Posts: 7,496 ✭✭✭


    Is there a way to resize a load of images similar to the way Win XP can do it? I want to take 20 or so of my digital images from Oxegen and change the resolution to 800x600 instead of 1600x1200.

    The only way i can see is to open up each image in The Gimp and do it manually but its taking ages.

    Any ideas? i'm using RedHat I think.


Comments

  • Closed Accounts Posts: 7,563 ✭✭✭leeroybrown


    ImageMagick:

    man convert

    If it's not installed then there will definitely be RPM's for it on your distro CD's.

    It can take a size or a percentage and I think there is an option to make sure it mantains aspect ration but I can't remember it. A small shell script calling it would batch convert a directory of images.
    #!/bin/sh
    
    for file in *.jpg
    do
        #convert -geometry 60%x60% $file outdir/$file
        convert -geometry 800x600 $file outdir/$file
    
    done
    


  • Registered Users, Registered Users 2 Posts: 7,496 ✭✭✭quarryman


    that's exactly what i need.

    can you just explain that batch file to me?

    do i save the following to a file called resize.bat maybe and run it?

    #!/bin/sh

    for file in *.jpg
    do

    convert -geometry 800x600 $file outdir/$file

    done

    if all my images are in a folder called pics how would the batch program read?


  • Closed Accounts Posts: 7,563 ✭✭✭leeroybrown


    It's a shell script.

    Just save it to a file called resize.sh in the directory of images (pics in your case)
    create an outdir subdirectory in that directory (so pics/outdir/)
    chmod u+x resize.sh
    Then just type ./resize.sh and it should run through them all resizing them to 800x600
    The resized files will appear in 'outdir'.

    The script loops through all the files ending with .jpg and resizes them one at a time. It'll take a few minutes if you've got a lot of images.


  • Registered Users, Registered Users 2 Posts: 7,496 ✭✭✭quarryman


    well i ran the script and it gave me the errors below but all the files appeared in the output directory as expected. i don't think the errors make a difference. i have a pic called "kev decided to stay sober.jpg" and it looks like convert tried to resize each separate word as an image. no big deal if it works i guess.

    thanks for that :)


    convert: Unable to open file (kev) [No such file or directory].
    convert: Unable to open file (decided) [No such file or directory].
    convert: Unable to open file (to) [No such file or directory].
    convert: Unable to open file (stay) [No such file or directory].
    convert: Unable to open file (sober.jpg) [No such file or directory].
    convert: Unable to open file (outdir/kev) [No such file or directory]


  • Closed Accounts Posts: 7,563 ✭✭✭leeroybrown


    I was assuming that the images were all in the digital camera name format which would have no spaces. The error was due to the spaces making it appear as multiple filenames. They'd need to be either escaped with backslashes or the full filename enclosed in quotes.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,496 ✭✭✭quarryman


    actually i discovered all those files with more than one word didn't go thru. added underscores instead of spaces and it seems grand now.

    thanks again.


  • Registered Users, Registered Users 2 Posts: 2,077 ✭✭✭parasite


    i use batchgimp, a collection of perl scripts


Advertisement