Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Create a single JPG gallery from an image archive (See related posts)

The following comes from Jason Scott and is posted here with permission under the Creative Commons Attribution-ShareAlike License.

The script expands a zip or rar archive of images, makes thumbnails, and compiles the thumbnails into a single JPG to represent what's in the archive. Requires ImageMagick.

Code:
#!/bin/sh
# GALLERATE: Turn a zip of images into a gallery.
# From Jason Scott. http://ascii.textfiles.com/archives/000137.html
if [ -f "$1" ]
   then
   rm -rf .galleryworld
   echo "[%] Preparting to squat out $1...."
   mkdir .galleryworld
   cd .galleryworld
   unzip -j "../$1"
   unrar e -ep "../$1"
   echo "[%] WHY DOES IT HURT!!!!"
   montage +frame +shadow +label -tile 7 *.JPG *.GIF *.gif *.jpg *.bmp *.png *.PNG *.BMP "../$1.jpg"
   cd ..
   rm -rf .galleryworld
   ls -l "$1.jpg"
  else
  echo "No such file, assmaster."
fi


Usage:
GALLERATE [file]

where [file] is the zip or rar archive of images to be processed.

You need to create an account or log in to post comments to this site.


Click here to browse all 4857 code snippets

Related Posts