Code Monkey home page Code Monkey logo

flicket's Introduction

Flicket

Build Status

About

Flicket is a ruby command line tool that:

  • accepts a list of search keywords as arguments
  • queries the Flickr API for the top-rated image for each keyword
  • downloads the results
  • crops them rectangularly
  • assembles a collage grid from ten images and
  • writes the result to a user-supplied filename

If given less than ten keywords, or if any keyword fails to result in a match, it retrieves random words from a dictionary source such as /usr/share/dict/words. Repeating as necessary until you have gathered ten images.

Usage

  1. Install ImageMagick. On OS X it can be done with Homebrew brew install imagemagick.
  2. Obtain flickr API key from https://www.flickr.com/services/apps/create/apply
  3. Export them as environment variables
export FLICKR_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Replace with your key
export FLICKR_SECRET=xxxxxxxxxxxxxxxx # Replace with your secret
  1. Install Flicket: gem install flicket
  2. Generate some collages: flicket dog cat doormat

NB! Output filename can be provided with --output or -o e.g. flicket -o mycollage.png tree river bratwurst

Development

Most of the code is covered with tests using RSpec. VCR is used to avoid hitting Flickr api every time and to speed up tests.

  1. Clone the repo git clone https://github.com/madis/flicket
  2. Install dependencies cd flicket && bundle install
  3. Run tests rspec

Layouts

Layouts can be defined in LayoutCalculator. Example layout is defined.

LAYOUT = [
  [0,1,2,3],
  [4,5,6,3],
  [4,7,8,9]
]

10 image layout

The numbers in the matrix are cell names. To mark bigger cell, e.g. cell 4 that is double the height of single cell, use same name in consequtive rows. Layout calculator will crop and resize automatically

NB The LayoutCalculator may not handle more complex layouts correctly in its initial incarnation. It is mainly here as a starting point and a direction for future development.

Example

flicket -o collage.png flower powerlifter programmer snoop snow nature sunset computer guitar woman

example collage

flicket's People

Contributors

madis avatar

Watchers

Tobias Overkamp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.