Batch Resize Image

Tagged with: , , , , , , ,

Resize all JPG Files to 800×600


convert -sample 800x600 *.jpg output_file_name

5 Responses to “Batch Resize Image

  • 1
    Amit Agarwal
    November 11th, 2008 08:24

    Whst should be the value of “name” here. How will the original files be named?

  • 2
    Binny V A
    November 11th, 2008 08:49

    Name is the output file name. The original files can be named however you want them.

  • 3
    Amit Agarwal
    November 11th, 2008 09:22

    Thats a good info but I like this better (for obvious reasons that it does not change the filename):
    for i in * do; convert -sample 800×600 $i ak_$i; done

    BTW, do you have any idea, wheather resize is better or sample is better option in covert for resizing the image. I did not see any difference in both approaches other then technical difference.

  • 4
    Binny V A
    November 11th, 2008 13:18

    Yeah – I like that too – as a matter of fact, I have a shell script that does this…

    #!/bin/sh
    # An Easy command to use the convert command. Makes sure that the rename problem don't happen
    
    if [ ! -d "Out" ]; then
            mkdir Out
    fi
    
    sel="*.*"
    if [ $# -eq 2 ] ; then
            sel=$2
    fi
    
    for i in $sel; do
            echo -n "Converting $i ... "
            convert $1 $i Out/$i
            echo "Done"
    done
    

    About the Resample/Resize issue – I am not sure either.

  • 5
    Shell Script for Batch Convertion of Images | txt
    November 15th, 2008 23:23

    […] An easier way to batch convert images using the ‘convert’ command… […]

Leave a Reply