Big Data/BI Zone is brought to you in partnership with:
DZone 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

Snippets has posted 5883 posts at DZone. View Full User Profile

Create A Single JPG Gallery From An Image Archive

11.09.2005
| 4454 views |
  • submit to reddit
        The following comes from <a href="http://ascii.textfiles.com/archives/000137.html">Jason Scott</a> and is posted here with permission under the <a href="http://creativecommons.org/licenses/by-sa/1.0/">Creative Commons Attribution-ShareAlike License</a>.

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 <a href="http://www.imagemagick.org/">ImageMagick</a>.

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.