blur_image 0.0.1
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 +7 -0
- data/LICENSE +19 -0
- data/README.md +47 -0
- data/bin/blur_image +39 -0
- data/lib/blur_image.rb +17 -0
- data/lib/blur_image/version.rb +3 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5d961ece4d1e919195849c07e5de2c1fd7856c41
|
4
|
+
data.tar.gz: 3b8548ae48e0b2e24cbbcd1d14b92dbd6c8c8498
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f9073b597309ed4609f6203c7617d2a039410c1bd07e1edccdaa82f2529270cea4fac9019ae8ffd4d74fa7c70ec139303531612b3cd19e4eb86b560b124d4d7e
|
7
|
+
data.tar.gz: c3791b597fb663a7972e919e864edb2b6b36628f8b012189c40841ec71d299469760ca889006b585327bd161708869f9ab3a1e65a0d1c133de06bb94a0d57618
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 Koichi ITO
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# blur_image
|
2
|
+
|
3
|
+
blur image.
|
4
|
+
|
5
|
+
## USAGE
|
6
|
+
|
7
|
+
$ blur_image -s10 path/to/original_file path/to/blur_file
|
8
|
+
|
9
|
+
### A little more in detail
|
10
|
+
|
11
|
+
You can specify sharpness (blur condition) in the `-s` option. that value is default 10.
|
12
|
+
|
13
|
+
## REQUIREMENTS
|
14
|
+
|
15
|
+
* [MiniMagick](https://github.com/minimagick/minimagick)
|
16
|
+
|
17
|
+
## INSTALL
|
18
|
+
|
19
|
+
Add these lines to your application's Gemfile:
|
20
|
+
|
21
|
+
```
|
22
|
+
gem 'blur_image'
|
23
|
+
```
|
24
|
+
|
25
|
+
And then execute:
|
26
|
+
|
27
|
+
```
|
28
|
+
$ bundle
|
29
|
+
```
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
```
|
34
|
+
$ gem install blur_image
|
35
|
+
```
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create new Pull Request
|
44
|
+
|
45
|
+
## License
|
46
|
+
|
47
|
+
blur_image is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
data/bin/blur_image
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# USAGE:
|
4
|
+
#
|
5
|
+
# blur_image -s10 path/to/src_image_path path/to/dest_image_path
|
6
|
+
#
|
7
|
+
lib_path = File.expand_path('../../lib', __FILE__)
|
8
|
+
$:.unshift(lib_path)
|
9
|
+
|
10
|
+
require 'blur_image'
|
11
|
+
require 'blur_image/version'
|
12
|
+
require 'optparse'
|
13
|
+
|
14
|
+
Version = BlurImage::VERSION
|
15
|
+
|
16
|
+
options = {}
|
17
|
+
|
18
|
+
opt = OptionParser.new('usage: blur_image [-s sharpness] source_file target_file')
|
19
|
+
|
20
|
+
opt.on('-s', '--sharpness n (DEFAULT 10)') {|v| options[:sharpness] = v }
|
21
|
+
|
22
|
+
begin
|
23
|
+
opt.permute!(ARGV)
|
24
|
+
|
25
|
+
raise unless ARGV.size == 2
|
26
|
+
|
27
|
+
src_path = ARGV.shift
|
28
|
+
dest_path = ARGV.shift
|
29
|
+
|
30
|
+
sharpness = options[:sharpness] || BlurImage::DEFAULT_SHARPNESS
|
31
|
+
|
32
|
+
image = BlurImage.blur(File.read(src_path), sharpness)
|
33
|
+
|
34
|
+
image.write(dest_path)
|
35
|
+
rescue => e
|
36
|
+
puts opt.help
|
37
|
+
|
38
|
+
exit!
|
39
|
+
end
|
data/lib/blur_image.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'mini_magick'
|
2
|
+
|
3
|
+
module BlurImage
|
4
|
+
DEFAULT_SHARPNESS = 10
|
5
|
+
|
6
|
+
def blur(original_file, sharpness = DEFAULT_SHARPNESS)
|
7
|
+
image = MiniMagick::Image.read(original_file)
|
8
|
+
|
9
|
+
image.combine_options do |c|
|
10
|
+
c.blur "#{sharpness}x#{sharpness}"
|
11
|
+
end
|
12
|
+
|
13
|
+
image
|
14
|
+
end
|
15
|
+
|
16
|
+
module_function :blur
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blur_image
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Koichi ITO
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-13 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: 3.0.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.0.0
|
41
|
+
description: blur image.
|
42
|
+
email: koic.ito@gmail.com
|
43
|
+
executables:
|
44
|
+
- blur_image
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- bin/blur_image
|
51
|
+
- lib/blur_image.rb
|
52
|
+
- lib/blur_image/version.rb
|
53
|
+
homepage: http://github.com/koic/blur_image
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.0.0
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.5.0
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: blur image.
|
77
|
+
test_files: []
|