First post of the blog and today’s issue.
I had to rotate, resize and upload over 20 images, the problem was that some images was getting some weird height and width values, that was due to some EXIF information about the orientation.
To solve that the bash command convert offer a pretty handy option: -auto-orient.
Therefore to bulk resize and rotate here a small snippet:
for i in *.jpg; do convert $i -auto-orient -resize 710 $(basename $i .jpg)_resized.jpg done
This will do the following:
- Read all the image names with the extension specified (*.jpg).
- Take each image, automatically rotate them according to the EXIF information then resize them to a width of 710px.
- After this, the image is stored with the original name followed by “_resized”.
There are of course many other way to do the same things, but that was the quicker I’ve found.