Skip to content

Instantly share code, notes, and snippets.

@drezha

drezha/Resize.sh Secret

Created December 28, 2018 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drezha/4be51096646fc06c4dc2cd643ec89729 to your computer and use it in GitHub Desktop.
Save drezha/4be51096646fc06c4dc2cd643ec89729 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Resize JPG files for Zim
# Chris Salter
# 14/05/2018
# Relies on Imagemagick being installed
# Set Random String to rename images to
n=$RANDOM
# Resizes images to 1,228,800 pixels (1280x960, assuming a standard lanscape iPhone image of 4032x3024 pixels)
convert $1 -resize 1228800@ -format jpg /home/chris/Desktop/$n.jpg
# Thumbnail creation - 76,800 pixels (320 x 240) and adds white background to make 320x320
convert $1 -resize 76800@ -format jpg -gravity center -background white -extent 330x330 /home/chris/Desktop/Thumbnail_$n.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment