appiconset 2.2.0 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ef0d21daa468cb3bca61be5786766824f2c4ec9c553e9c3df5cf6dec06fd635
4
- data.tar.gz: 514769fbdbfa9bbcc9de26ee59ecab63f89062695d158a1f54d87af76afa6c89
3
+ metadata.gz: 31edc704c52144a5eefe2339052935d3d2e8ad7c4dc062c6f09c162a963e7c43
4
+ data.tar.gz: 2d17094adebf34d345320a4144677a6bbb4c482b3c4e41f97f79c2f042008b04
5
5
  SHA512:
6
- metadata.gz: 314eac0eab5dea83e8785067433d781f52ecdf769a46a06b2a678a868c30c03a73fbb6b1bf6025cd304ac66600c787251da2c17f5f5280beef16892518982534
7
- data.tar.gz: 7a76a7819eaf2dfef44a2b9fad945b3cbedb578b04c84374eed3b41464f7c6da4667a26258a77683ff83424d3aa312b464d663c3bb8fd30e5a174c81a22a68d6
6
+ metadata.gz: 5d0fdd192a4fa0a39eb6b0394801193c370332f945d532b0ada368f6761ae87a6749902b91cd71b39a3a28334f66cf351d5cd9646976172a3f0d257b1f87c69c
7
+ data.tar.gz: e7392ae02c798e4f7a7f96d5891601db597e7a8ba1970a3f21d8402b5bce0fd6ed089928500057a6cd4c7e89f9da118f9bee37f23a4deb79f79f6ff7890dac2b
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: 32
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: 102
23
+ Max: 120
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: 38
33
+ Max: 64
data/README.base.md ADDED
@@ -0,0 +1,118 @@
1
+ <!---------------------------->
2
+ <!-- multilingual suffix: en, ja -->
3
+ <!-- no suffix: en -->
4
+ <!---------------------------->
5
+
6
+ <!-- $ mmg README.base.md -->
7
+
8
+ <!-- [ja] -->
9
+
10
+ # Appiconset
11
+
12
+ [![Gem Version](https://badge.fury.io/rb/appiconset.svg)](https://badge.fury.io/rb/appiconset)
13
+
14
+ 1024px x 1024pxの画像からmacOSアプリやiOSアプリで必要になるアプリアイコンを書き出すRubyスクリプトです。
15
+
16
+ 以下の環境で動作確認をしています。
17
+ * macOS 15.1
18
+
19
+ 以下のプラットフォームのアイコン作成をサポートしています。
20
+ * iOS/iPadOS
21
+ * macOS
22
+ * Universal
23
+ * watchOS
24
+ * Android
25
+ * tvOS
26
+
27
+ # ガイド
28
+
29
+ 正方形アイコンを生成するには、1024px x 1024px の画像からアプリアイコンを作成します。
30
+
31
+ ```
32
+ $ appiconset g -i='sample.jpg' -o='output'
33
+ ```
34
+
35
+ Contents.jsonと複数のpngファイルが作成されます。
36
+ これらのファイルをXcodeプロジェクトの AppIcon.appiconset にコピーします。
37
+
38
+
39
+ ## tvOSのアイコン
40
+
41
+ tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画像を用意します。
42
+ 入力画像から以下の画像を生成します。
43
+ 入力画像は tv-top-shelf-wide と同じ、tv-top-shelf は tv-top-shelf-wide から赤の領域が削除された画像、tvはtv-top-shelfから緑の領域が削除された画像になります。
44
+
45
+ | ディレクトリの名前 | サイズ | 画像 |
46
+ |--|--|--|
47
+ | tv | 400x1440 | ![tv](sample/tv/Icon@2x.png) |
48
+ | tv-top-shelf | 3840x1440 | ![tv-top-shelf](sample/tv-top-shelf/Icon@2x.png)|
49
+ | tv-top-shelf-wide | 4640x1440 |![tv-top-shelf-wide](sample/tv-top-shelf-wide/Icon@2x.png) |
50
+
51
+ ```
52
+ $ appiconset g -i='sample.jpg' -o='output'
53
+ ```
54
+
55
+ ## 任意のサイズのアイコン
56
+
57
+ 任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
58
+
59
+ ```
60
+ $ appiconset g -i='sample.jpg' -o='output'
61
+ ```
62
+
63
+ <!-- [en] -->
64
+
65
+ # Appiconset
66
+
67
+ [![Gem Version](https://badge.fury.io/rb/appiconset.svg)](https://badge.fury.io/rb/appiconset)
68
+
69
+ Ruby script to write app icons required for macOS and iOS apps from 1024px x 1024px images.
70
+
71
+ We have confirmed the operation in the following environments.
72
+ * macOS 15.1
73
+
74
+ Icon creation is supported for the following platforms.
75
+ * iOS/iPadOS
76
+ * macOS
77
+ * Universal
78
+ * watchOS
79
+ * Android
80
+ * tvOS
81
+
82
+ # Guide
83
+
84
+ ## Square icons
85
+
86
+ Create an app icon from a 1024px x 1024px image.
87
+
88
+ ```
89
+ $ appiconset g -i='sample.jpg' -o='output'
90
+ ```
91
+
92
+ A Contents.json and several png files will be created.
93
+ Copy these files to AppIcon.appiconset in the Xcode project.
94
+
95
+
96
+ ## tvOS icons
97
+
98
+ To create an icon for a tvOS app, prepare a 4640px x 1440px image.
99
+ Generate the following image from the input image.
100
+ The input image is the same as tv-top-shelf-wide, tv-top-shelf is the image from tv-top-shelf-wide with the red area removed, and tv is the image from tv-top-shelf with the green area removed.
101
+
102
+ | Directory name | Size | Image |
103
+ |--|--|--|
104
+ | tv | 400x1440 | ![tv](sample/tv/Icon@2x.png) |
105
+ | tv-top-shelf | 3840x1440 | ![tv-top-shelf](sample/tv-top-shelf/Icon@2x.png)|
106
+ | tv-top-shelf-wide | 4640x1440 |![tv-top-shelf-wide](sample/tv-top-shelf-wide/Icon@2x.png) |
107
+
108
+ ```
109
+ $ appiconset g -i='sample.jpg' -o='output'
110
+ ```
111
+
112
+ ## Icons of any size
113
+
114
+ 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 ADDED
@@ -0,0 +1,55 @@
1
+
2
+
3
+
4
+ # Appiconset
5
+
6
+ [![Gem Version](https://badge.fury.io/rb/appiconset.svg)](https://badge.fury.io/rb/appiconset)
7
+
8
+ 1024px x 1024pxの画像からmacOSアプリやiOSアプリで必要になるアプリアイコンを書き出すRubyスクリプトです。
9
+
10
+ 以下の環境で動作確認をしています。
11
+ * macOS 15.1
12
+
13
+ 以下のプラットフォームのアイコン作成をサポートしています。
14
+ * iOS/iPadOS
15
+ * macOS
16
+ * Universal
17
+ * watchOS
18
+ * Android
19
+ * tvOS
20
+
21
+ # ガイド
22
+
23
+ 正方形アイコンを生成するには、1024px x 1024px の画像からアプリアイコンを作成します。
24
+
25
+ ```
26
+ $ appiconset g -i='sample.jpg' -o='output'
27
+ ```
28
+
29
+ Contents.jsonと複数のpngファイルが作成されます。
30
+ これらのファイルをXcodeプロジェクトの AppIcon.appiconset にコピーします。
31
+
32
+
33
+ ## tvOSのアイコン
34
+
35
+ tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画像を用意します。
36
+ 入力画像から以下の画像を生成します。
37
+ 入力画像は tv-top-shelf-wide と同じ、tv-top-shelf は tv-top-shelf-wide から赤の領域が削除された画像、tvはtv-top-shelfから緑の領域が削除された画像になります。
38
+
39
+ | ディレクトリの名前 | サイズ | 画像 |
40
+ |--|--|--|
41
+ | tv | 400x1440 | ![tv](sample/tv/Icon@2x.png) |
42
+ | tv-top-shelf | 3840x1440 | ![tv-top-shelf](sample/tv-top-shelf/Icon@2x.png)|
43
+ | tv-top-shelf-wide | 4640x1440 |![tv-top-shelf-wide](sample/tv-top-shelf-wide/Icon@2x.png) |
44
+
45
+ ```
46
+ $ appiconset g -i='sample.jpg' -o='output'
47
+ ```
48
+
49
+ ## 任意のサイズのアイコン
50
+
51
+ 任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
52
+
53
+ ```
54
+ $ appiconset g -i='sample.jpg' -o='output'
55
+ ```
data/README.md CHANGED
@@ -1,11 +1,16 @@
1
+
2
+
3
+
1
4
  # Appiconset
2
5
 
3
- 1024px x 1024pxの画像からmacOSアプリやiOSアプリで必要になるアプリアイコンを書き出すRubyスクリプトです。
6
+ [![Gem Version](https://badge.fury.io/rb/appiconset.svg)](https://badge.fury.io/rb/appiconset)
4
7
 
5
- 以下の環境で動作確認をしています。
8
+ Ruby script to write app icons required for macOS and iOS apps from 1024px x 1024px images.
9
+
10
+ We have confirmed the operation in the following environments.
6
11
  * macOS 15.1
7
12
 
8
- 以下のプラットフォームのアイコン作成をサポートしています。
13
+ Icon creation is supported for the following platforms.
9
14
  * iOS/iPadOS
10
15
  * macOS
11
16
  * Universal
@@ -13,33 +18,40 @@
13
18
  * Android
14
19
  * tvOS
15
20
 
16
- # 使い方
21
+ # Guide
17
22
 
18
- ## 正方形アイコン
23
+ ## Square icons
19
24
 
20
- 1024px x 1024px の画像からアプリアイコンを作成します。
25
+ Create an app icon from a 1024px x 1024px image.
21
26
 
22
27
  ```
23
- $ appiconset square -i='sample.jpg' -o='output'
28
+ $ appiconset g -i='sample.jpg' -o='output'
24
29
  ```
25
30
 
26
- Contents.jsonと複数のpngファイルが作成されます。
27
- これらのファイルをXcodeプロジェクトの AppIcon.appiconset にコピーします。
31
+ A Contents.json and several png files will be created.
32
+ Copy these files to AppIcon.appiconset in the Xcode project.
33
+
28
34
 
35
+ ## tvOS icons
29
36
 
30
- ## tvOSのアイコン
37
+ To create an icon for a tvOS app, prepare a 4640px x 1440px image.
38
+ Generate the following image from the input image.
39
+ The input image is the same as tv-top-shelf-wide, tv-top-shelf is the image from tv-top-shelf-wide with the red area removed, and tv is the image from tv-top-shelf with the green area removed.
31
40
 
32
- tvOSアプリ向けのアイコンを作成するには。4640px x 1440px の画像を用意します。
33
- この画像からApp Icon.imagestack、Top Shelf Image.imageset、Top Shelf Image Wide.imagesetのアイコンを作成します。
41
+ | Directory name | Size | Image |
42
+ |--|--|--|
43
+ | tv | 400x1440 | ![tv](sample/tv/Icon@2x.png) |
44
+ | tv-top-shelf | 3840x1440 | ![tv-top-shelf](sample/tv-top-shelf/Icon@2x.png)|
45
+ | tv-top-shelf-wide | 4640x1440 |![tv-top-shelf-wide](sample/tv-top-shelf-wide/Icon@2x.png) |
34
46
 
35
47
  ```
36
- $ appiconset tvos -i='sample.jpg' -o='output'
48
+ $ appiconset g -i='sample.jpg' -o='output'
37
49
  ```
38
50
 
39
- ## 任意のサイズのアイコン
51
+ ## Icons of any size
40
52
 
41
- 任意のサイズの画像から、1倍、2/3倍、1/3倍のアイコンを作成します。
53
+ Create 1x, 2/3x, and 1/3x icons from any size image.
42
54
 
43
55
  ```
44
- $ appiconset universal -i='sample.jpg' -o='output'
56
+ $ appiconset g -i='sample.jpg' -o='output'
45
57
  ```
@@ -17,44 +17,16 @@ module Appiconset
17
17
  puts(Appiconset::VERSION)
18
18
  end
19
19
 
20
- desc 'square', 'Create icons from a square image'
21
- method_option :input, desc: 'Input image(1024px x 1024px)', aliases: '-i'
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 square
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
59
31
  rescue StandardError => e
60
32
  warn e.message
@@ -9,11 +9,15 @@ module Appiconset
9
9
  class Generator
10
10
  def initialize; end
11
11
 
12
- def config(input, output, width = 1024, height = 1024)
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 'unsupported size.' if width != 0 && height != 0 && (size[0].to_i != width || size[1].to_i != height)
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
- size = FastImage.size(@input)
73
+ show_info('universal')
74
+
66
75
  platforms = [
67
76
  {
68
77
  name: 'universal',
69
78
  contents: [
70
- { width: size[0], height: size[1], scale: 3 },
71
- { width: size[0] / 3 * 2, height: size[1] / 3 * 2, scale: 2 },
72
- { width: size[0] / 3, height: size[1] / 3, scale: 1 }
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,7 +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
109
+ return unless @width == 4640 && @height == 1440
110
+
111
+ show_info('tvOS')
112
+
99
113
  platforms = [
100
114
  {
101
115
  name: 'tv',
@@ -139,5 +153,9 @@ module Appiconset
139
153
  end
140
154
  end
141
155
  end
156
+
157
+ def show_info(platform_name)
158
+ puts "Created #{platform_name} icons from #{@width} x #{@height} image."
159
+ end
142
160
  end
143
161
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appiconset
4
- VERSION = '2.2.0'
4
+ VERSION = '2.4.0'
5
5
  end
Binary file
Binary file
Binary file
Binary file
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.2.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - arthur87
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-09 00:00:00.000000000 Z
11
+ date: 2025-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -81,6 +81,8 @@ files:
81
81
  - ".rubocop_todo.yml"
82
82
  - ".travis.yml"
83
83
  - CHANGELOG.md
84
+ - README.base.md
85
+ - README.ja.md
84
86
  - README.md
85
87
  - Rakefile
86
88
  - exe/appiconset
@@ -97,9 +99,16 @@ files:
97
99
  - lib/appiconset/settings/universal-xcode9.1-Contents.json
98
100
  - lib/appiconset/settings/watch-xcode10.0-Contents.json
99
101
  - lib/appiconset/version.rb
102
+ - sample/tv-top-shelf-wide/Icon@1x.png
103
+ - sample/tv-top-shelf-wide/Icon@2x.png
104
+ - sample/tv-top-shelf/Icon@1x.png
105
+ - sample/tv-top-shelf/Icon@2x.png
106
+ - sample/tv/Icon@1x.png
107
+ - sample/tv/Icon@2x.png
100
108
  - sig/appiconset.rbs
101
109
  homepage: https://github.com/arthur87/appiconset
102
- licenses: []
110
+ licenses:
111
+ - MIT
103
112
  metadata:
104
113
  homepage_uri: https://github.com/arthur87/appiconset
105
114
  source_code_uri: https://github.com/arthur87/appiconset