0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Create a set of images for a blog gallery.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.0
>= 0

Runtime

>= 0
>= 0
 Project Readme

MakeGallery

I like to show several pictures in some of my blog posts as a gallery of sorts, with square thumbnails that link to the web-sized images.

I found a nifty one-line bash command that uses ImageMagick to automate part of this process:

#!/bin/bash

set -xv

: ${THUMBSIZE:=200}
: ${THUMBNAIL:=${THUMBSIZE}x${THUMBSIZE}}

mkdir -p thumbs
mogrify -format gif -path thumbs -thumbnail ${THUMBNAIL}^ -gravity center -extent ${THUMBNAIL} *.jpg

which creates small-ish .gif thumbnails in a thumbs/ subdirectory.

In addition, I want to create web-scale .jpgs in a web/ subdirectory (mid-quality 1024 pixels wide).

Installation

$ gem install make_gallery

Usage

For up-to-the-minute usage information, you should run make_gallery help.

$ make_gallery (thumbs | web) [--source DIR] [--target DIR] [--size SIZE] [--format FORMAT] [--force] [--verbose] [--debug] [--dry-run]
  • thumbs: create (square) thumbnails
  • web: create web-sized images (maintains aspect ratio)
  • source: the directory to take starting images from (default is current directory)
  • target: the directory to write to (default is ./thumbs/ or ./web/)
  • size: horizontal size for web images, side size for thumbs
  • format: JPG for web images, GIF for thumbs
  • force: overwrite (default is abort if directory already exists)
  • dry-run: don't actually create the images or directory, just show what would happen
  • verbose: be chatty
  • debug: be SUPER chatty about a lot of things

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment. Run bundle exec make_gallery to use the code located in this directory, ignoring other installed copies of this gem.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Review the Guidelines for any information on how to contribute to this tool.

Make sure to also read the Code of Conduct if you wish to contribute.

  1. Fork it ( https://github.com/tamouse/make_gallery/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

"fork in, branch it, commit it, push it." -- daft punking our way through open source!