image_sizes 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea2c7624f6392389eaa6c6bd1affa4322f85e244
4
+ data.tar.gz: 282df20427471efd83c26b965bf825381b64a6b1
5
+ SHA512:
6
+ metadata.gz: 4271c28cadd9cec17f7dadffe6c80ca770f0a4fd1b73e6e727bcaba16517a0e6df2fef5c08562fc1245a064bee639af4b19953458aa76f7573cba0ebf0f39de8
7
+ data.tar.gz: 73bbd39552e2c3457ccf2994f990ad66e9680039057dd3e34216b39dabe852628fd2fdf59d2c702b5e524aefc41386b71790ab9b1c254a74d2d8c93a1665db5c
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ pkg/*
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ Image Sizes
2
+ ============
3
+
4
+ A ruby gem that gen multi sizes from one image.
5
+
6
+ * iOS app and watch icon sizes.
7
+
8
+ # usage
9
+
10
+ ```
11
+ gem install image_sizes
12
+ ```
13
+
14
+ ```
15
+ $ image_sizes icon.png
16
+
17
+ # Then will get all sizes icons
18
+ Gen icon-29.png
19
+ Gen icon-40.png
20
+ Gen icon-48.png
21
+ Gen icon-50.png
22
+ Gen icon-55.png
23
+ Gen icon-57.png
24
+ Gen icon-58.png
25
+ Gen icon-60.png
26
+ Gen icon-72.png
27
+ Gen icon-76.png
28
+ Gen icon-80.png
29
+ Gen icon-87.png
30
+ Gen icon-88.png
31
+ Gen icon-100.png
32
+ Gen icon-114.png
33
+ Gen icon-120.png
34
+ Gen icon-152.png
35
+ Gen icon-172.png
36
+ Gen icon-196.png
37
+ ```
38
+
39
+ # TODO
40
+
41
+ * iOS screens sizes.
42
+ * choose which sizes to gen.
43
+ * define sizes array.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/image_sizes ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'image_sizes'
4
+
5
+ path = ARGV[0]
6
+
7
+ ImageSizes.gen path
@@ -0,0 +1,21 @@
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
+ require 'image_sizes/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'image_sizes'
6
+ s.version = ImageSizes::VERSION
7
+ s.licenses = ['MIT']
8
+ s.date = '2015-10-29'
9
+ s.summary = "Gen multi sizes from one image."
10
+ s.description = "A ruby gem that gen multi sizes from one image."
11
+ s.authors = ["Aston Fu"]
12
+ s.email = 'im@fuhao.im'
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.require_paths = ['lib']
16
+ s.executables = %w(image_sizes)
17
+ s.homepage = 'https://github.com/astonfu/image_sizes'
18
+
19
+ s.add_runtime_dependency 'mini_magick'
20
+ s.add_development_dependency 'rspec'
21
+ end
@@ -0,0 +1,2 @@
1
+ require 'image_sizes/image_sizes'
2
+ require 'image_sizes/version'
@@ -0,0 +1,21 @@
1
+ require 'mini_magick'
2
+
3
+ module ImageSizes
4
+ def self.gen(image_path)
5
+ image = MiniMagick::Image.open(image_path)
6
+ puts "Get image at: " + image.path
7
+ image.format "png"
8
+
9
+ ios_icon_sizes = [29, 40, 50, 57, 58, 60, 72, 76, 80, 87, 100, 114, 120, 144, 180, 152, 512, 1024]
10
+ apple_watch_icon_sizes = [196, 172, 88, 87, 80, 58, 55, 48]
11
+
12
+ all_sizes = ios_icon_sizes + apple_watch_icon_sizes
13
+
14
+ all_sizes.uniq.sort.reverse.each do |size|
15
+ image.resize "#{size}x#{size}"
16
+ name = "icon-#{size}.png"
17
+ image.write name
18
+ puts "Gen #{name}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module ImageSizes
2
+ VERSION = '0.0.4'
3
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: image_sizes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Aston Fu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mini_magick
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A ruby gem that gen multi sizes from one image.
42
+ email: im@fuhao.im
43
+ executables:
44
+ - image_sizes
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - README.md
50
+ - Rakefile
51
+ - bin/image_sizes
52
+ - image_sizes.gemspec
53
+ - lib/image_sizes.rb
54
+ - lib/image_sizes/image_sizes.rb
55
+ - lib/image_sizes/version.rb
56
+ homepage: https://github.com/astonfu/image_sizes
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.2.2
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Gen multi sizes from one image.
80
+ test_files: []
81
+ has_rdoc: