appiconset 2.4.0 → 2.6.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.yml +3 -0
- data/.rubocop_todo.yml +2 -2
- data/README.base.md +16 -19
- data/README.ja.md +8 -9
- data/README.md +9 -11
- data/lib/appiconset/cli.rb +1 -2
- data/lib/appiconset/generator.rb +91 -54
- 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: 04c392fedbb90f46a1a68063f3e355ec5fa8bd81123d250a7799d453ea243dc9
|
4
|
+
data.tar.gz: 5128b965a8349ad8094ce560a5681935b36f652d7590ee624ec2bc87bb3a1573
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34f6a72de126bf51135bf2ad8bc9cf0780e187d37507872e74a24f14324d9c92f8a0c395573c315e25066b79cda73fee98356fc66f7d0b896f66c76add624d56
|
7
|
+
data.tar.gz: f2bf02f8b5663a0153343358f3a669a6f407c108415f26ef0c8de02cbd9aef8e14f5d232684429d183a32492603eb7b810b12e97d8638fa9b74d30cdc2141ae3
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -20,12 +20,12 @@ Metrics/BlockLength:
|
|
20
20
|
# Offense count: 1
|
21
21
|
# Configuration parameters: CountComments, CountAsOne.
|
22
22
|
Metrics/ClassLength:
|
23
|
-
Max:
|
23
|
+
Max: 150
|
24
24
|
|
25
25
|
# Offense count: 1
|
26
26
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
27
27
|
Metrics/CyclomaticComplexity:
|
28
|
-
Max:
|
28
|
+
Max: 10
|
29
29
|
|
30
30
|
# Offense count: 3
|
31
31
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
data/README.base.md
CHANGED
@@ -23,15 +23,22 @@
|
|
23
23
|
* watchOS
|
24
24
|
* Android
|
25
25
|
* tvOS
|
26
|
+
* icns.iconset
|
27
|
+
* icns(macOS only)
|
28
|
+
* favicon
|
26
29
|
|
27
30
|
# ガイド
|
28
31
|
|
29
|
-
|
32
|
+
1つの画像から複数のアプリアイコンを作成します。
|
30
33
|
|
31
34
|
```
|
32
35
|
$ appiconset g -i='sample.jpg' -o='output'
|
33
36
|
```
|
34
37
|
|
38
|
+
|
39
|
+
## 正方形アイコン
|
40
|
+
正方形アイコンを作成するには、1024px x 1024px の画像を用意します。
|
41
|
+
|
35
42
|
Contents.jsonと複数のpngファイルが作成されます。
|
36
43
|
これらのファイルをXcodeプロジェクトの AppIcon.appiconset にコピーします。
|
37
44
|
|
@@ -48,18 +55,10 @@ tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画
|
|
48
55
|
| tv-top-shelf | 3840x1440 | |
|
49
56
|
| tv-top-shelf-wide | 4640x1440 | |
|
50
57
|
|
51
|
-
```
|
52
|
-
$ appiconset g -i='sample.jpg' -o='output'
|
53
|
-
```
|
54
|
-
|
55
58
|
## 任意のサイズのアイコン
|
56
59
|
|
57
60
|
任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
|
58
61
|
|
59
|
-
```
|
60
|
-
$ appiconset g -i='sample.jpg' -o='output'
|
61
|
-
```
|
62
|
-
|
63
62
|
<!-- [en] -->
|
64
63
|
|
65
64
|
# Appiconset
|
@@ -78,17 +77,22 @@ Icon creation is supported for the following platforms.
|
|
78
77
|
* watchOS
|
79
78
|
* Android
|
80
79
|
* tvOS
|
80
|
+
* icns.iconset
|
81
|
+
* icns(macOS only)
|
82
|
+
* favicon
|
81
83
|
|
82
84
|
# Guide
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
-
Create an app icon from a 1024px x 1024px image.
|
86
|
+
Create multiple app icons from one image.
|
87
87
|
|
88
88
|
```
|
89
89
|
$ appiconset g -i='sample.jpg' -o='output'
|
90
90
|
```
|
91
91
|
|
92
|
+
## Square icons
|
93
|
+
|
94
|
+
Create an app icon from a 1024px x 1024px image.
|
95
|
+
|
92
96
|
A Contents.json and several png files will be created.
|
93
97
|
Copy these files to AppIcon.appiconset in the Xcode project.
|
94
98
|
|
@@ -105,14 +109,7 @@ The input image is the same as tv-top-shelf-wide, tv-top-shelf is the image from
|
|
105
109
|
| tv-top-shelf | 3840x1440 | |
|
106
110
|
| tv-top-shelf-wide | 4640x1440 | |
|
107
111
|
|
108
|
-
```
|
109
|
-
$ appiconset g -i='sample.jpg' -o='output'
|
110
|
-
```
|
111
112
|
|
112
113
|
## Icons of any size
|
113
114
|
|
114
115
|
Create 1x, 2/3x, and 1/3x icons from any size image.
|
115
|
-
|
116
|
-
```
|
117
|
-
$ appiconset g -i='sample.jpg' -o='output'
|
118
|
-
```
|
data/README.ja.md
CHANGED
@@ -17,15 +17,22 @@
|
|
17
17
|
* watchOS
|
18
18
|
* Android
|
19
19
|
* tvOS
|
20
|
+
* icns.iconset
|
21
|
+
* icns(macOS only)
|
22
|
+
* favicon
|
20
23
|
|
21
24
|
# ガイド
|
22
25
|
|
23
|
-
|
26
|
+
1つの画像から複数のアプリアイコンを作成します。
|
24
27
|
|
25
28
|
```
|
26
29
|
$ appiconset g -i='sample.jpg' -o='output'
|
27
30
|
```
|
28
31
|
|
32
|
+
|
33
|
+
## 正方形アイコン
|
34
|
+
正方形アイコンを作成するには、1024px x 1024px の画像を用意します。
|
35
|
+
|
29
36
|
Contents.jsonと複数のpngファイルが作成されます。
|
30
37
|
これらのファイルをXcodeプロジェクトの AppIcon.appiconset にコピーします。
|
31
38
|
|
@@ -42,14 +49,6 @@ tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画
|
|
42
49
|
| tv-top-shelf | 3840x1440 | |
|
43
50
|
| tv-top-shelf-wide | 4640x1440 | |
|
44
51
|
|
45
|
-
```
|
46
|
-
$ appiconset g -i='sample.jpg' -o='output'
|
47
|
-
```
|
48
|
-
|
49
52
|
## 任意のサイズのアイコン
|
50
53
|
|
51
54
|
任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
|
52
|
-
|
53
|
-
```
|
54
|
-
$ appiconset g -i='sample.jpg' -o='output'
|
55
|
-
```
|
data/README.md
CHANGED
@@ -17,17 +17,22 @@ Icon creation is supported for the following platforms.
|
|
17
17
|
* watchOS
|
18
18
|
* Android
|
19
19
|
* tvOS
|
20
|
+
* icns.iconset
|
21
|
+
* icns(macOS only)
|
22
|
+
* favicon
|
20
23
|
|
21
24
|
# Guide
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
Create an app icon from a 1024px x 1024px image.
|
26
|
+
Create multiple app icons from one image.
|
26
27
|
|
27
28
|
```
|
28
29
|
$ appiconset g -i='sample.jpg' -o='output'
|
29
30
|
```
|
30
31
|
|
32
|
+
## Square icons
|
33
|
+
|
34
|
+
Create an app icon from a 1024px x 1024px image.
|
35
|
+
|
31
36
|
A Contents.json and several png files will be created.
|
32
37
|
Copy these files to AppIcon.appiconset in the Xcode project.
|
33
38
|
|
@@ -44,14 +49,7 @@ The input image is the same as tv-top-shelf-wide, tv-top-shelf is the image from
|
|
44
49
|
| tv-top-shelf | 3840x1440 | |
|
45
50
|
| tv-top-shelf-wide | 4640x1440 | |
|
46
51
|
|
47
|
-
```
|
48
|
-
$ appiconset g -i='sample.jpg' -o='output'
|
49
|
-
```
|
50
52
|
|
51
53
|
## Icons of any size
|
52
54
|
|
53
|
-
Create 1x, 2/3x, and 1/3x icons from any size image.
|
54
|
-
|
55
|
-
```
|
56
|
-
$ appiconset g -i='sample.jpg' -o='output'
|
57
|
-
```
|
55
|
+
Create 1x, 2/3x, and 1/3x icons from any size image.
|
data/lib/appiconset/cli.rb
CHANGED
@@ -26,8 +26,7 @@ module Appiconset
|
|
26
26
|
begin
|
27
27
|
generator.config(options[:input].to_s, options[:output].to_s)
|
28
28
|
generator.square_platforms
|
29
|
-
generator.
|
30
|
-
generator.universal_platforms
|
29
|
+
generator.any_platforms
|
31
30
|
rescue StandardError => e
|
32
31
|
warn e.message
|
33
32
|
exit(1)
|
data/lib/appiconset/generator.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'appiconset'
|
4
4
|
require 'json'
|
5
|
+
require 'rbconfig'
|
5
6
|
|
6
7
|
# Appiconset
|
7
8
|
module Appiconset
|
@@ -29,7 +30,7 @@ module Appiconset
|
|
29
30
|
|
30
31
|
# 正方形アイコン
|
31
32
|
def square_platforms
|
32
|
-
return unless
|
33
|
+
return unless size_match?([1024, 1024])
|
33
34
|
|
34
35
|
show_info('square')
|
35
36
|
|
@@ -68,94 +69,130 @@ module Appiconset
|
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
|
-
#
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
# rubocop:todo Metrics/PerceivedComplexity
|
73
|
+
# rubocop:todo Metrics/AbcSize
|
74
|
+
def any_platforms # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity
|
75
75
|
platforms = [
|
76
76
|
{
|
77
77
|
name: 'universal',
|
78
|
+
size: [0, 0],
|
78
79
|
contents: [
|
79
|
-
{ width: @width, height: @height,
|
80
|
-
{ width: @width / 3 * 2, height: @height / 3 * 2,
|
81
|
-
{ width: @width / 3, height: @height / 3,
|
80
|
+
{ width: @width, height: @height, name: 'Icon@3x.png' },
|
81
|
+
{ width: @width / 3 * 2, height: @height / 3 * 2, name: 'Icon@2x.png' },
|
82
|
+
{ width: @width / 3, height: @height / 3, name: 'Icon@1x.png' }
|
82
83
|
]
|
83
|
-
}
|
84
|
-
]
|
85
|
-
|
86
|
-
platforms.each do |platform|
|
87
|
-
output_dir = "#{@output}#{platform[:name]}/"
|
88
|
-
FileUtils.mkdir_p(output_dir)
|
89
|
-
|
90
|
-
platform[:contents].each do |content|
|
91
|
-
width = content[:width].to_f
|
92
|
-
height = content[:height].to_f
|
93
|
-
scale = content[:scale].to_i
|
94
|
-
|
95
|
-
name = "Icon@#{scale}x.png"
|
96
|
-
|
97
|
-
image = Magick::ImageList.new(@input)
|
98
|
-
new_image = image.resize_to_fit(width, height)
|
99
|
-
new_image.format = 'PNG'
|
100
|
-
new_image.write(output_dir + name)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
# tvOSアイコン
|
106
|
-
# Input 4640x1440
|
107
|
-
# Output 2400x1440, 3840x1440, 4640x1440
|
108
|
-
def tvos_platforms
|
109
|
-
return unless @width == 4640 && @height == 1440
|
110
|
-
|
111
|
-
show_info('tvOS')
|
112
|
-
|
113
|
-
platforms = [
|
84
|
+
},
|
114
85
|
{
|
115
86
|
name: 'tv',
|
87
|
+
size: [4640, 1440],
|
116
88
|
contents: [
|
117
|
-
{ width: 800, height: 480,
|
118
|
-
{ width: 400, height: 240,
|
89
|
+
{ width: 800, height: 480, name: 'Icon@2x.png' },
|
90
|
+
{ width: 400, height: 240, name: 'Icon@1x.png' }
|
119
91
|
]
|
120
92
|
},
|
121
93
|
{
|
122
94
|
name: 'tv-top-shelf',
|
95
|
+
size: [4640, 1440],
|
123
96
|
contents: [
|
124
|
-
{ width: 3840, height: 1440,
|
125
|
-
{ width: 1920, height: 720,
|
97
|
+
{ width: 3840, height: 1440, name: 'Icon@2x.png' },
|
98
|
+
{ width: 1920, height: 720, name: 'Icon@1x.png' }
|
126
99
|
]
|
127
100
|
},
|
128
101
|
{
|
129
102
|
name: 'tv-top-shelf-wide',
|
103
|
+
size: [4640, 1440],
|
104
|
+
contents: [
|
105
|
+
{ width: 4640, height: 1440, name: 'Icon@2x.png' },
|
106
|
+
{ width: 2320, height: 720, name: 'Icon@1x.png' }
|
107
|
+
]
|
108
|
+
},
|
109
|
+
{
|
110
|
+
name: 'icns.iconset',
|
111
|
+
size: [1024, 1024],
|
112
|
+
contents: [
|
113
|
+
{ width: 1024, height: 1024, name: 'icon_512x512@2x.png' },
|
114
|
+
{ width: 512, height: 512, name: 'icon_512x512.png' },
|
115
|
+
{ width: 512, height: 512, name: 'icon_256x256@2x.png' },
|
116
|
+
{ width: 256, height: 256, name: 'icon_256x256.png' },
|
117
|
+
{ width: 256, height: 256, name: 'icon_128x128@2x.png' },
|
118
|
+
{ width: 128, height: 128, name: 'icon_128x128.png' },
|
119
|
+
{ width: 128, height: 128, name: 'icon_64x64@2x.png' },
|
120
|
+
{ width: 64, height: 64, name: 'icon_64x64.png' },
|
121
|
+
{ width: 64, height: 64, name: 'icon_32x32@2x.png' },
|
122
|
+
{ width: 32, height: 32, name: 'icon_32x32.png' },
|
123
|
+
{ width: 32, height: 32, name: 'icon_16x16@2x.png' },
|
124
|
+
{ width: 16, height: 16, name: 'icon_16x16.png' }
|
125
|
+
]
|
126
|
+
},
|
127
|
+
{
|
128
|
+
name: 'favicon',
|
129
|
+
size: [1024, 1024],
|
130
130
|
contents: [
|
131
|
-
{ width:
|
132
|
-
{ width:
|
131
|
+
{ width: 256, height: 256, name: 'icon_256x256.png' },
|
132
|
+
{ width: 128, height: 128, name: 'icon_128x128.png' },
|
133
|
+
{ width: 64, height: 64, name: 'icon_64x64.png' },
|
134
|
+
{ width: 48, height: 48, name: 'icon_48x48.png' },
|
135
|
+
{ width: 32, height: 32, name: 'icon_32x32.png' },
|
136
|
+
{ width: 24, height: 24, name: 'icon_24x24.png' },
|
137
|
+
{ width: 16, height: 16, name: 'icon_16x16.png' }
|
133
138
|
]
|
134
139
|
}
|
135
140
|
]
|
136
141
|
|
137
142
|
platforms.each do |platform|
|
138
|
-
|
143
|
+
platform_name = platform[:name]
|
144
|
+
next unless size_match?(platform[:size])
|
145
|
+
|
146
|
+
show_info(platform_name)
|
147
|
+
|
148
|
+
output_dir = "#{@output}#{platform_name}/"
|
139
149
|
FileUtils.mkdir_p(output_dir)
|
140
150
|
|
141
151
|
platform[:contents].each do |content|
|
142
152
|
width = content[:width].to_f
|
143
153
|
height = content[:height].to_f
|
144
|
-
|
145
|
-
|
146
|
-
name = "Icon@#{scale}x.png"
|
154
|
+
name = content[:name]
|
147
155
|
|
148
156
|
image = Magick::ImageList.new(@input)
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
157
|
+
if platform_name.start_with?('tv')
|
158
|
+
image = image.scale(height / 1440.0)
|
159
|
+
image = image.crop(Magick::CenterGravity, width, height)
|
160
|
+
else
|
161
|
+
image = image.resize_to_fit(width, height)
|
162
|
+
end
|
163
|
+
image.format = 'PNG'
|
164
|
+
image.write(output_dir + name)
|
165
|
+
end
|
166
|
+
|
167
|
+
if platform_name == 'icns.iconset' && RbConfig::CONFIG['host_os'].match(/darwin|mac os/)
|
168
|
+
# macOSで実行可能
|
169
|
+
show_info('icns')
|
170
|
+
system("iconutil -c icns --output #{@output}Icon.icns #{@output}icns.iconset/")
|
171
|
+
elsif platform_name == 'favicon'
|
172
|
+
images = platforms.find do |x|
|
173
|
+
x[:name] == 'favicon'
|
174
|
+
end[:contents].map do |x| # rubocop:disable Style/MultilineBlockChain
|
175
|
+
"#{output_dir}#{x[:name]}"
|
176
|
+
end
|
177
|
+
|
178
|
+
image = Magick::ImageList.new(*images)
|
179
|
+
image.format = 'ICO'
|
180
|
+
image.write("#{@output}favicon/favicon.ico")
|
153
181
|
end
|
154
182
|
end
|
155
183
|
end
|
184
|
+
# rubocop:enable Metrics/AbcSize
|
185
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
186
|
+
|
187
|
+
private
|
188
|
+
|
189
|
+
# 入力画像のサイズが条件に一致したときtrueを返す
|
190
|
+
def size_match?(size)
|
191
|
+
size == [0, 0] || (@width == size[0] && @height == size[1])
|
192
|
+
end
|
156
193
|
|
157
194
|
def show_info(platform_name)
|
158
|
-
puts "Created #{platform_name}
|
195
|
+
puts "Created #{platform_name} icon(s) from #{@width} x #{@height} image."
|
159
196
|
end
|
160
197
|
end
|
161
198
|
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.6.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-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|