Created
April 27, 2016 02:01
-
-
Save Moligaloo/8b46c7866ba7d061fda5a74bc69de49d to your computer and use it in GitHub Desktop.
Generate iOS launch screen images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rmagick' | |
if ARGV.length < 2 | |
puts "Usage: #{$PROGRAM_NAME} <logo path> <background color>" | |
exit | |
end | |
logopath = ARGV[0] | |
background_color = ARGV[1] | |
logo = Magick::Image::read(logopath).first | |
{ | |
"iphone4" => [640, 960], | |
"iphone5" => [640, 1136], | |
"iphone6" => [750, 1334], | |
"iphone6plus" => [1242, 2208], | |
}.each {|key, size| | |
Magick::Image.new(size[0], size[1]) { | |
self.background_color = background_color | |
} | |
.composite!(logo, Magick::CenterGravity, Magick::OverCompositeOp) | |
.write "#{key}@2x.png" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment