Skip to content

Instantly share code, notes, and snippets.

Forked from benvium/resizer.txt
Last active Jan 16, 2018
What would you like to do?
#!/bin/bash -e
# Make sure you have installed ImageMagick
# Ensure we're running in location of script.
cd "`dirname $0`"
for f in *; do
if [[ $f == *@3x* ]];
echo "$f -> ${f//@3x/@2x}, ${f//@3x/}"
convert "$f" -resize 66.66666% "${f//@3x/@2x}"
convert "$f" -resize 33.33333% "${f//@3x/}"
echo "Complete"
Copy link

SpikyOrange commented Apr 1, 2016

Thanks for sharing David,

No files converted, when I run it just says 'Complete' - so I added echo $f at between line 8 and 9 and it logs the filenames in /usr/local/bin instead of my current working directory - what did I miss?

Steps for me...

  • Installed Image Magick (I chose the first option so Quartz wasn't required)
  • Download the script
  • Moved from downloads to '/usr/local/bin'
  • Opened terminal
  • cd - Moved to the folder with my image(s) with @3 in the filename (pwd confirms I'm in the right folder)
  • typed '' (also tried ' /Users/Rob/Desktop/test')

Copy link

vinzBad commented Aug 18, 2016

@SpikyOrange You missed:

# Ensure we're running in location of script.
cd "`dirname $0`"

Move the the script to the folder where your images are and run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment