• Tech

    Batch Resize Images in Mac OS X [Terminal]

    You can batch resize images in Mac OS X using the terminal command sips, the Scriptable Image Processing System.

    For making quick 300px previews of the images, you can use this command:

    sips -Z 300 *.jpg --out destination/directory/

    *Read man sips for more info.

    If you’d also like to batch rename the files and you’re using bash, then you can use regular expressions:

    cd destination/directory
    
    for f in *.jpg; do echo mv "$f" "${f/.jpg/_thumbs.jpg}"; done

    The {f/.jpg/_thumbs.jpg} looks for the string “.jpg” and replaces it with “_thumbs.jpg”.

    The code above will run a TEST RUN to stdout. If the resulting mv commands look good, remove echo from the code and run it again.