touchy 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,8 +6,18 @@ Command line tool to find and modify illigal images
6
6
 
7
7
  ## Installation
8
8
 
9
- 1. install ruby(>= 1.8.7)
10
- 2. execute the following command
9
+ 1 . install ruby(>= 1.8.7)
10
+
11
+ 2 . install imagemagick
12
+
13
+ ```bash
14
+ # MacOS
15
+ $ brew install imagemagick
16
+ # Debian/Ubuntu
17
+ $ sudo apt-get install libmagickwand-dev imagemagick
18
+ ```
19
+
20
+ 3 . execute the following command
11
21
 
12
22
  ```bash
13
23
  $ gem install touchy
@@ -1,19 +1,34 @@
1
1
  # Touchy
2
2
 
3
- 奇数サイズ等の画像を探し出すためのコマンドラインツールです。
3
+ 奇数サイズ等の画像を探し、修正するためのコマンドラインツールです。
4
4
 
5
5
  ## インストール
6
6
 
7
7
  1. Ruby 1.8.7以上をインストールする
8
- 2. コンソールで以下のコマンドを実行する
9
8
 
10
- ```bash
11
- $ gem install touchy
12
- ```
9
+ 2. ImageMagickをインストールする
10
+
11
+ ##### Macの場合
12
+ ```bash
13
+ $ brew install imagemagick
14
+ ```
15
+
16
+ ##### Debian/Ubuntuの場合
17
+ ```bash
18
+ $ sudo apt-get install imagemagick libmagickwand-dev
19
+ ```
20
+
21
+ 3. コンソールで以下のコマンドを実行する
22
+
23
+ ```bash
24
+ $ gem install touchy
25
+ ```
26
+
27
+ rbenvを使っている場合は、続けて`rbenv rehash`を行って下さい。
13
28
 
14
29
  ## 使い方
15
30
 
16
- ### 奇数サイズの画像を探し出す
31
+ #### 奇数サイズの画像を探し出す
17
32
 
18
33
  ```bash
19
34
  $ touchy odd ./hoge/*.png
@@ -22,13 +37,19 @@ $ touchy odd ./hoge/*.png
22
37
  もしくは、[Rubyのglob](http://docs.ruby-lang.org/ja/1.9.3/method/Dir/s/glob.html)に基づいたパスを指定することもできます。
23
38
 
24
39
  ```bash
40
+ # ./hoge以下の全ての階層のディレクトリにある.pngファイルを対象にする。
25
41
  $ touchy odd --path='./hoge/**/*.png'
26
42
  ```
27
43
 
28
- ### 奇数サイズの画像を探し出し、偶数サイズに修正した上で、生じた隙間を透明なピクセルで埋める
44
+ #### 奇数サイズの画像を探し出し、右もしくは下に1pxを加えて偶数サイズに拡張した上で、生じた隙間を透明なピクセルで埋める
29
45
 
30
46
  ```bash
31
47
  $ touchy fix ./hoge/*.png
32
48
  ```
33
49
 
34
50
  引数についてはoddメソッドと同じです。
51
+
52
+ ## 将来の予定
53
+
54
+ - 画像を拡張する方向をカスタマイズ可能にする。
55
+ - 左、右、中央寄せなどを可能にする。
@@ -6,8 +6,8 @@ include Magick
6
6
  module Touchy
7
7
  def self.find_odd_size_images(image_paths)
8
8
  image_paths.map do |image_path|
9
- size = FastImage.size(image_path)
10
- image_path if !size.nil? && (size[0].odd? || size[1].odd?)
9
+ image = Magick::Image.read(image_path).first
10
+ image_path if (image.columns && image.rows) && (image.columns.odd? || image.rows.odd?)
11
11
  end.reject(&:nil?)
12
12
  end
13
13
 
@@ -1,3 +1,3 @@
1
1
  module Touchy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "thor", "~> 0.19"
22
- spec.add_dependency "fastimage"
23
22
  spec.add_dependency "rmagick"
24
23
 
25
24
  spec.add_development_dependency "bundler", "~> 1.5"
metadata CHANGED
@@ -1,83 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: touchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Masami Yonehara
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
12
+ date: 2015-02-25 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: thor
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0.19'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.19'
27
- - !ruby/object:Gem::Dependency
28
- name: fastimage
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
30
  - !ruby/object:Gem::Dependency
42
31
  name: rmagick
43
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
44
34
  requirements:
45
- - - ">="
35
+ - - ! '>='
46
36
  - !ruby/object:Gem::Version
47
37
  version: '0'
48
38
  type: :runtime
49
39
  prerelease: false
50
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
51
42
  requirements:
52
- - - ">="
43
+ - - ! '>='
53
44
  - !ruby/object:Gem::Version
54
45
  version: '0'
55
46
  - !ruby/object:Gem::Dependency
56
47
  name: bundler
57
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
58
50
  requirements:
59
- - - "~>"
51
+ - - ~>
60
52
  - !ruby/object:Gem::Version
61
53
  version: '1.5'
62
54
  type: :development
63
55
  prerelease: false
64
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
65
58
  requirements:
66
- - - "~>"
59
+ - - ~>
67
60
  - !ruby/object:Gem::Version
68
61
  version: '1.5'
69
62
  - !ruby/object:Gem::Dependency
70
63
  name: rake
71
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
72
66
  requirements:
73
- - - ">="
67
+ - - ! '>='
74
68
  - !ruby/object:Gem::Version
75
69
  version: '0'
76
70
  type: :development
77
71
  prerelease: false
78
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
79
74
  requirements:
80
- - - ">="
75
+ - - ! '>='
81
76
  - !ruby/object:Gem::Version
82
77
  version: '0'
83
78
  description: the tool that find odd images
@@ -88,7 +83,7 @@ executables:
88
83
  extensions: []
89
84
  extra_rdoc_files: []
90
85
  files:
91
- - ".gitignore"
86
+ - .gitignore
92
87
  - Gemfile
93
88
  - LICENSE.txt
94
89
  - README.md
@@ -101,25 +96,26 @@ files:
101
96
  homepage: ''
102
97
  licenses:
103
98
  - MIT
104
- metadata: {}
105
99
  post_install_message:
106
100
  rdoc_options: []
107
101
  require_paths:
108
102
  - lib
109
103
  required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
110
105
  requirements:
111
- - - ">="
106
+ - - ! '>='
112
107
  - !ruby/object:Gem::Version
113
108
  version: '0'
114
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
+ none: false
115
111
  requirements:
116
- - - ">="
112
+ - - ! '>='
117
113
  - !ruby/object:Gem::Version
118
114
  version: '0'
119
115
  requirements: []
120
116
  rubyforge_project:
121
- rubygems_version: 2.2.2
117
+ rubygems_version: 1.8.23
122
118
  signing_key:
123
- specification_version: 4
119
+ specification_version: 3
124
120
  summary: the tool that find odd images
125
121
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 689042d13ea63dd0b0be7643934530a93937513d
4
- data.tar.gz: ff5e3c5c76119d55a04b237fbc03426dd41c8aed
5
- SHA512:
6
- metadata.gz: 7bcd706a7f93728ab898abc82c9dcb37133e38857feebabe6458deb21de770170bdd572fd29d35e2e5bdaca43c21e2d2c3759762654b3767eac40d3b035f209f
7
- data.tar.gz: 5d2dfe577a88d43e651653456256b890950d2ab54fa94290603318bd9c2d0812e1eb52a44173a3448e5140f04b21f929b1c1f2cc0fcb2412f10ebab8edbedff0