Skip to content

Instantly share code, notes, and snippets.

@talhasyed
Created May 21, 2010 16:23
Show Gist options
  • Save talhasyed/409047 to your computer and use it in GitHub Desktop.
Save talhasyed/409047 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'RMagick'
require 'pp'
include Magick
CURRENT_DIR = File.dirname(File.expand_path(__FILE__)) + "/"
country_names = [
"Algeria",
"Argentina",
"Australia",
"Brazil",
"Cameroon",
"Chile",
"Cote d' Ivoire",
"Denmark",
"England",
"France",
"Germany",
"Ghana",
"Greece",
"Honduras",
"Italy",
"Japan",
"Korea DPR",
"Korea Republic",
"Mexico",
"Netherlands",
"New Zealand",
"Nigeria",
"Paraguay",
"Portugal",
"Serbia",
"Slovakia",
"Slovenia",
"South Africa",
"Spain",
"Switzerland",
"United States",
"Uruguay"
]
ImageSide = 15
height = country_names.size * ImageSide
width = ImageSide
country_filenames = country_names.map {|country| "#{CURRENT_DIR}/worldcuplogos/#{country}.png"}.sort
composition = ImageList.new
country_filenames.each do |country_filename|
image = Image.read(country_filename).first
composition.push(image)
end
sprites = composition.append(true)
sprites_resized = sprites.resize_to_fit(width, height)
sprites_resized.write("#{CURRENT_DIR}/sprites.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment