appiconset 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +3 -3
- data/README.base.md +11 -8
- data/README.ja.md +6 -5
- data/README.md +5 -3
- data/lib/appiconset/cli.rb +4 -31
- data/lib/appiconset/generator.rb +59 -9
- data/lib/appiconset/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a7767388959af2163784bee32c1a70fc845eef093882f4fb26911fada88ef15
|
4
|
+
data.tar.gz: c2f1a80e9ea7a5d30928b3d157e1964eed726f26b2f7cb49b4c5dfc50637b856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b82c5fe7f7b5d61fadfb49a1126f0a1ab07bc4fb823803c1ce7f2ab513d437512ed97fff395d1b834fed33e493c8e968319bb3e3326e6df732822f7b26fb88a
|
7
|
+
data.tar.gz: 3e2f7a7443b136f3e3d7f5a14d268475c395eb5e7d6590e11ddb66e7c0ffc1ddac85e96d0b4b7e87799cdad4fb0a58674daedbf9e3e61a21fc638ae5167dd735
|
data/.rubocop_todo.yml
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
# Offense count: 3
|
10
10
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
11
11
|
Metrics/AbcSize:
|
12
|
-
Max:
|
12
|
+
Max: 40
|
13
13
|
|
14
14
|
# Offense count: 1
|
15
15
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
@@ -20,7 +20,7 @@ Metrics/BlockLength:
|
|
20
20
|
# Offense count: 1
|
21
21
|
# Configuration parameters: CountComments, CountAsOne.
|
22
22
|
Metrics/ClassLength:
|
23
|
-
Max:
|
23
|
+
Max: 140
|
24
24
|
|
25
25
|
# Offense count: 1
|
26
26
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
@@ -30,4 +30,4 @@ Metrics/CyclomaticComplexity:
|
|
30
30
|
# Offense count: 3
|
31
31
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
32
32
|
Metrics/MethodLength:
|
33
|
-
Max:
|
33
|
+
Max: 64
|
data/README.base.md
CHANGED
@@ -23,15 +23,16 @@
|
|
23
23
|
* watchOS
|
24
24
|
* Android
|
25
25
|
* tvOS
|
26
|
+
* icns.iconset
|
27
|
+
* icns(macOS only)
|
26
28
|
|
27
29
|
# ガイド
|
28
30
|
|
29
31
|
## 正方形アイコン
|
30
|
-
|
31
|
-
1024px x 1024px の画像からアプリアイコンを作成します。
|
32
|
+
正方形アイコンを生成するには、1024px x 1024px の画像からアプリアイコンを作成します。
|
32
33
|
|
33
34
|
```
|
34
|
-
$ appiconset
|
35
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
35
36
|
```
|
36
37
|
|
37
38
|
Contents.jsonと複数のpngファイルが作成されます。
|
@@ -51,7 +52,7 @@ tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画
|
|
51
52
|
| tv-top-shelf-wide | 4640x1440 | |
|
52
53
|
|
53
54
|
```
|
54
|
-
$ appiconset
|
55
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
55
56
|
```
|
56
57
|
|
57
58
|
## 任意のサイズのアイコン
|
@@ -59,7 +60,7 @@ $ appiconset tvos -i='sample.jpg' -o='output'
|
|
59
60
|
任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
|
60
61
|
|
61
62
|
```
|
62
|
-
$ appiconset
|
63
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
63
64
|
```
|
64
65
|
|
65
66
|
<!-- [en] -->
|
@@ -80,6 +81,8 @@ Icon creation is supported for the following platforms.
|
|
80
81
|
* watchOS
|
81
82
|
* Android
|
82
83
|
* tvOS
|
84
|
+
* icns.iconset
|
85
|
+
* icns(macOS only)
|
83
86
|
|
84
87
|
# Guide
|
85
88
|
|
@@ -88,7 +91,7 @@ Icon creation is supported for the following platforms.
|
|
88
91
|
Create an app icon from a 1024px x 1024px image.
|
89
92
|
|
90
93
|
```
|
91
|
-
$ appiconset
|
94
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
92
95
|
```
|
93
96
|
|
94
97
|
A Contents.json and several png files will be created.
|
@@ -108,7 +111,7 @@ The input image is the same as tv-top-shelf-wide, tv-top-shelf is the image from
|
|
108
111
|
| tv-top-shelf-wide | 4640x1440 | |
|
109
112
|
|
110
113
|
```
|
111
|
-
$ appiconset
|
114
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
112
115
|
```
|
113
116
|
|
114
117
|
## Icons of any size
|
@@ -116,5 +119,5 @@ $ appiconset tvos -i='sample.jpg' -o='output'
|
|
116
119
|
Create 1x, 2/3x, and 1/3x icons from any size image.
|
117
120
|
|
118
121
|
```
|
119
|
-
$ appiconset
|
122
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
120
123
|
```
|
data/README.ja.md
CHANGED
@@ -17,15 +17,16 @@
|
|
17
17
|
* watchOS
|
18
18
|
* Android
|
19
19
|
* tvOS
|
20
|
+
* icns.iconset
|
21
|
+
* icns(macOS only)
|
20
22
|
|
21
23
|
# ガイド
|
22
24
|
|
23
25
|
## 正方形アイコン
|
24
|
-
|
25
|
-
1024px x 1024px の画像からアプリアイコンを作成します。
|
26
|
+
正方形アイコンを生成するには、1024px x 1024px の画像からアプリアイコンを作成します。
|
26
27
|
|
27
28
|
```
|
28
|
-
$ appiconset
|
29
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
29
30
|
```
|
30
31
|
|
31
32
|
Contents.jsonと複数のpngファイルが作成されます。
|
@@ -45,7 +46,7 @@ tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画
|
|
45
46
|
| tv-top-shelf-wide | 4640x1440 | |
|
46
47
|
|
47
48
|
```
|
48
|
-
$ appiconset
|
49
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
49
50
|
```
|
50
51
|
|
51
52
|
## 任意のサイズのアイコン
|
@@ -53,5 +54,5 @@ $ appiconset tvos -i='sample.jpg' -o='output'
|
|
53
54
|
任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
|
54
55
|
|
55
56
|
```
|
56
|
-
$ appiconset
|
57
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
57
58
|
```
|
data/README.md
CHANGED
@@ -17,6 +17,8 @@ Icon creation is supported for the following platforms.
|
|
17
17
|
* watchOS
|
18
18
|
* Android
|
19
19
|
* tvOS
|
20
|
+
* icns.iconset
|
21
|
+
* icns(macOS only)
|
20
22
|
|
21
23
|
# Guide
|
22
24
|
|
@@ -25,7 +27,7 @@ Icon creation is supported for the following platforms.
|
|
25
27
|
Create an app icon from a 1024px x 1024px image.
|
26
28
|
|
27
29
|
```
|
28
|
-
$ appiconset
|
30
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
29
31
|
```
|
30
32
|
|
31
33
|
A Contents.json and several png files will be created.
|
@@ -45,7 +47,7 @@ The input image is the same as tv-top-shelf-wide, tv-top-shelf is the image from
|
|
45
47
|
| tv-top-shelf-wide | 4640x1440 | |
|
46
48
|
|
47
49
|
```
|
48
|
-
$ appiconset
|
50
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
49
51
|
```
|
50
52
|
|
51
53
|
## Icons of any size
|
@@ -53,5 +55,5 @@ $ appiconset tvos -i='sample.jpg' -o='output'
|
|
53
55
|
Create 1x, 2/3x, and 1/3x icons from any size image.
|
54
56
|
|
55
57
|
```
|
56
|
-
$ appiconset
|
58
|
+
$ appiconset g -i='sample.jpg' -o='output'
|
57
59
|
```
|
data/lib/appiconset/cli.rb
CHANGED
@@ -17,45 +17,18 @@ module Appiconset
|
|
17
17
|
puts(Appiconset::VERSION)
|
18
18
|
end
|
19
19
|
|
20
|
-
desc '
|
21
|
-
method_option :input, desc: 'Input image
|
20
|
+
desc 'g', 'Create icons from any size image'
|
21
|
+
method_option :input, desc: 'Input image', aliases: '-i'
|
22
22
|
method_option :output, desc: 'Write output to <dir>', aliases: '-o'
|
23
|
-
def
|
23
|
+
def generator
|
24
24
|
generator = Appiconset::Generator.new
|
25
25
|
|
26
26
|
begin
|
27
27
|
generator.config(options[:input].to_s, options[:output].to_s)
|
28
28
|
generator.square_platforms
|
29
|
-
rescue StandardError => e
|
30
|
-
warn e.message
|
31
|
-
exit(1)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
desc 'tvos', 'Create tvOS icons'
|
36
|
-
method_option :input, desc: 'Input image(4640px x 1440px)', aliases: '-i'
|
37
|
-
method_option :output, desc: 'Write output to <dir>', aliases: '-o'
|
38
|
-
def tvos
|
39
|
-
generator = Appiconset::Generator.new
|
40
|
-
|
41
|
-
begin
|
42
|
-
generator.config(options[:input].to_s, options[:output].to_s, 4640, 1440)
|
43
29
|
generator.tvos_platforms
|
44
|
-
rescue StandardError => e
|
45
|
-
warn e.message
|
46
|
-
exit(1)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
desc 'icons', 'Create Universal icons'
|
51
|
-
method_option :input, desc: 'Input any size image', aliases: '-i'
|
52
|
-
method_option :output, desc: 'Write output to <dir>', aliases: '-o'
|
53
|
-
def icons
|
54
|
-
generator = Appiconset::Generator.new
|
55
|
-
|
56
|
-
begin
|
57
|
-
generator.config(options[:input].to_s, options[:output].to_s, 0, 0)
|
58
30
|
generator.universal_platforms
|
31
|
+
generator.icns_platforms
|
59
32
|
rescue StandardError => e
|
60
33
|
warn e.message
|
61
34
|
exit(1)
|
data/lib/appiconset/generator.rb
CHANGED
@@ -9,11 +9,15 @@ module Appiconset
|
|
9
9
|
class Generator
|
10
10
|
def initialize; end
|
11
11
|
|
12
|
-
def config(input, output
|
12
|
+
def config(input, output)
|
13
13
|
raise 'no input file.' unless File.exist?(input)
|
14
|
+
raise 'no output <dir>.' if output == ''
|
14
15
|
|
15
16
|
size = FastImage.size(input)
|
16
|
-
raise '
|
17
|
+
raise 'Unsupported file.' if size.nil?
|
18
|
+
|
19
|
+
@width = size[0]
|
20
|
+
@height = size[1]
|
17
21
|
|
18
22
|
output += '/' unless output.end_with?('/')
|
19
23
|
|
@@ -25,6 +29,10 @@ module Appiconset
|
|
25
29
|
|
26
30
|
# 正方形アイコン
|
27
31
|
def square_platforms
|
32
|
+
return unless @width == 1024 && @height == 1024
|
33
|
+
|
34
|
+
show_info('square')
|
35
|
+
|
28
36
|
json_dir = "#{__dir__}/settings/*.json"
|
29
37
|
|
30
38
|
Dir.glob(json_dir).each do |path|
|
@@ -62,15 +70,15 @@ module Appiconset
|
|
62
70
|
|
63
71
|
# ユニバーサルアイコン
|
64
72
|
def universal_platforms
|
65
|
-
|
73
|
+
show_info('universal')
|
74
|
+
|
66
75
|
platforms = [
|
67
76
|
{
|
68
77
|
name: 'universal',
|
69
78
|
contents: [
|
70
|
-
{ width:
|
71
|
-
{ width:
|
72
|
-
{ width:
|
73
|
-
|
79
|
+
{ width: @width, height: @height, scale: 3 },
|
80
|
+
{ width: @width / 3 * 2, height: @height / 3 * 2, scale: 2 },
|
81
|
+
{ width: @width / 3, height: @height / 3, scale: 1 }
|
74
82
|
]
|
75
83
|
}
|
76
84
|
]
|
@@ -95,9 +103,13 @@ module Appiconset
|
|
95
103
|
end
|
96
104
|
|
97
105
|
# tvOSアイコン
|
106
|
+
# Input 4640x1440
|
107
|
+
# Output 2400x1440, 3840x1440, 4640x1440
|
98
108
|
def tvos_platforms
|
99
|
-
|
100
|
-
|
109
|
+
return unless @width == 4640 && @height == 1440
|
110
|
+
|
111
|
+
show_info('tvOS')
|
112
|
+
|
101
113
|
platforms = [
|
102
114
|
{
|
103
115
|
name: 'tv',
|
@@ -141,5 +153,43 @@ module Appiconset
|
|
141
153
|
end
|
142
154
|
end
|
143
155
|
end
|
156
|
+
|
157
|
+
# icnsアイコン
|
158
|
+
def icns_platforms
|
159
|
+
return unless @width == 1024 && @height == 1024
|
160
|
+
|
161
|
+
show_info('icns.iconset')
|
162
|
+
|
163
|
+
output_dir = "#{@output}icns.iconset/"
|
164
|
+
FileUtils.mkdir_p(output_dir)
|
165
|
+
|
166
|
+
sizes = [512, 256, 128, 64, 32, 16]
|
167
|
+
sizes.each do |size|
|
168
|
+
[2, 1].each do |scale|
|
169
|
+
if scale == 2
|
170
|
+
name = "icon_#{size}x#{size}@2x.png"
|
171
|
+
new_size = size * scale
|
172
|
+
else
|
173
|
+
name = "icon_#{size}x#{size}.png"
|
174
|
+
new_size = size
|
175
|
+
end
|
176
|
+
|
177
|
+
image = Magick::ImageList.new(@input)
|
178
|
+
new_image = image.resize_to_fit(new_size, new_size)
|
179
|
+
new_image.format = 'PNG'
|
180
|
+
new_image.write(output_dir + name)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
return unless RUBY_PLATFORM.match(/darwin/)
|
185
|
+
|
186
|
+
# macOSで実行可能
|
187
|
+
show_info('icns')
|
188
|
+
system("iconutil -c icns #{output_dir}")
|
189
|
+
end
|
190
|
+
|
191
|
+
def show_info(platform_name)
|
192
|
+
puts "Created #{platform_name} icon(s) from #{@width} x #{@height} image."
|
193
|
+
end
|
144
194
|
end
|
145
195
|
end
|
data/lib/appiconset/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appiconset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arthur87
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|