Results 1 to 4 of 4

Thread: How to rename/resize images in Linux ?

  1. #1
    Join Date
    Feb 2009
    Posts
    32

    How to rename/resize images in Linux ?

    hello everyone....

    I wanted to perform some image-related functions in my Linux operating system. I tried to find about it but didn't work out. Can anyone of you help me in image renaming and resizing in Linux ?
    thanks

  2. #2
    Join Date
    Apr 2008
    Posts
    3,267

    Re: How to rename/resize images in Linux ?

    In Linux, you can rename and resize images with bash script from console
    Linux have simple solution, a simple bash script can do the job.

    Here is the bash script:

    #!/bin/sh
    counter=1
    root=mypict
    resolution=400x300
    for i in `ls -1 $1/*.jpg`; do
    echo "Now working on $i"
    convert -resize $resolution $i ${root}_${counter}.jpg
    counter=`expr $counter + 1`


    Save the script in a file called picturework.sh and make it executable with
    chmod u+x picturework.sh

    and store it somewhere in your path. Now, if you have a bunch of .jpg files in the directory /path/to/dirpic, all you have to do is to execute
    picturework.sh /path/to/dirpic

    and in the current directory you'll find mypict_1.jpg, mypict_2.jpg etc, which are the resized versions of your original ones.
    You can change the script according to your needs.

  3. #3
    Join Date
    Jan 2008
    Posts
    3,388

    Re: How to rename/resize images in Linux ?

    If you want to do a batch rename and resize of a number of pictures in a directory, use this script below. This script requires ImageMagick to be installed.

    Change the root=picture to whatever you would like the beginning of the filename to be (ie: root=wedding, etc.) and what this script will do is create wedding_1.jpg, wedding_2.jpg, etc.. all at 640×480.

    #!/bin/sh
    counter=1
    root=picture
    resolution=640×480
    for i in `ls -1 $1/*.jpg`; do
    echo “Now working on $i”
    convert -resize $resolution $i ${root}_${counter}.jpg
    counter=`expr $counter + 1

    Change the resolution to suit your needs. Enjoy!

  4. #4
    Dr. V Guest

    Re: How to rename/resize images in Linux ?

    You could use the convert utility that comes with imagemagick.

    If you want to set the image size say...640x480

    convert -geometry 640x480 file file_with_new_size

    (you replace 640x480 with whatever you want the new size to be)

    If you want to script this, go for something like

    for x in $(ls)
    do
    convert -geometry 320x240 $x new-$x

Similar Threads

  1. Auto resize images while importing in Microsoft Excel
    By SirName in forum Windows Software
    Replies: 3
    Last Post: 21-01-2012, 01:01 PM
  2. Automatically resize images from an XML
    By AZUL in forum Software Development
    Replies: 4
    Last Post: 22-01-2010, 10:03 PM
  3. resize images with outlook express
    By Abshir in forum Windows Software
    Replies: 3
    Last Post: 15-06-2009, 11:08 PM
  4. Replies: 3
    Last Post: 07-04-2009, 11:39 AM
  5. Resize images using Powertoy in Windows XP
    By AmdUser in forum Windows Software
    Replies: 3
    Last Post: 07-02-2009, 07:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,312,423.62410 seconds with 17 queries