image_play 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 908d1220779814937b275e2f264ef678aa239d83eac6ed48408b51cb307b33ae
4
+ data.tar.gz: dc5539268c62e68caaa7abf20e02aec8f7d424905ef0a03b95022ec03ba4d5aa
5
+ SHA512:
6
+ metadata.gz: c84ff76ef533b3904b025c12a97d8263f045b486c9a3dc4d6315472e21a13acb137c3c998ceb857b903f5411e542576168f2c505b27c83768a3ade4b0d54048d
7
+ data.tar.gz: 1add8e914b67e136cc9a4d9e405fc455b1a1b67faf9331294a7908af340af933478d6aca848c49c0c0a81791dd21c7586dd459cc760d09c1c75a8c1fa5a26d49
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in image_play.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ image_play (0.1.0)
5
+ mini_magick
6
+ open3
7
+ rtesseract
8
+ thor
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ aruba (1.0.0)
14
+ childprocess (~> 3.0)
15
+ contracts (~> 0.16.0)
16
+ cucumber (>= 2.4, < 4.0)
17
+ ffi (~> 1.9)
18
+ rspec-expectations (~> 3.4)
19
+ thor (~> 1.0)
20
+ backports (3.17.1)
21
+ builder (3.2.4)
22
+ childprocess (3.0.0)
23
+ contracts (0.16.0)
24
+ coveralls (0.8.23)
25
+ json (>= 1.8, < 3)
26
+ simplecov (~> 0.16.1)
27
+ term-ansicolor (~> 1.3)
28
+ thor (>= 0.19.4, < 2.0)
29
+ tins (~> 1.6)
30
+ cucumber (3.1.2)
31
+ builder (>= 2.1.2)
32
+ cucumber-core (~> 3.2.0)
33
+ cucumber-expressions (~> 6.0.1)
34
+ cucumber-wire (~> 0.0.1)
35
+ diff-lcs (~> 1.3)
36
+ gherkin (~> 5.1.0)
37
+ multi_json (>= 1.7.5, < 2.0)
38
+ multi_test (>= 0.1.2)
39
+ cucumber-core (3.2.1)
40
+ backports (>= 3.8.0)
41
+ cucumber-tag_expressions (~> 1.1.0)
42
+ gherkin (~> 5.0)
43
+ cucumber-expressions (6.0.1)
44
+ cucumber-tag_expressions (1.1.1)
45
+ cucumber-wire (0.0.1)
46
+ diff-lcs (1.3)
47
+ docile (1.3.2)
48
+ ffi (1.12.2)
49
+ gherkin (5.1.0)
50
+ json (2.3.0)
51
+ mini_magick (4.10.1)
52
+ minitest (5.14.1)
53
+ multi_json (1.14.1)
54
+ multi_test (0.1.2)
55
+ open3 (0.1.0)
56
+ rake (12.3.3)
57
+ rspec (3.9.0)
58
+ rspec-core (~> 3.9.0)
59
+ rspec-expectations (~> 3.9.0)
60
+ rspec-mocks (~> 3.9.0)
61
+ rspec-core (3.9.2)
62
+ rspec-support (~> 3.9.3)
63
+ rspec-expectations (3.9.2)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.9.0)
66
+ rspec-mocks (3.9.1)
67
+ diff-lcs (>= 1.2.0, < 2.0)
68
+ rspec-support (~> 3.9.0)
69
+ rspec-support (3.9.3)
70
+ rtesseract (3.1.1)
71
+ simplecov (0.16.1)
72
+ docile (~> 1.1)
73
+ json (>= 1.8, < 3)
74
+ simplecov-html (~> 0.10.0)
75
+ simplecov-html (0.10.2)
76
+ sync (0.5.0)
77
+ term-ansicolor (1.7.1)
78
+ tins (~> 1.0)
79
+ thor (1.0.1)
80
+ tins (1.25.0)
81
+ sync
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ aruba
88
+ coveralls
89
+ cucumber
90
+ image_play!
91
+ minitest
92
+ rake (~> 12.0)
93
+ rspec (~> 3.0)
94
+
95
+ BUNDLED WITH
96
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Bijoy Sijo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # ImagePlay
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/image_play`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'image_play'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install image_play
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/image_play.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "image_play"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,37 @@
1
+ require_relative 'lib/image_play/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "image_play"
5
+ spec.version = ImagePlay::VERSION
6
+ spec.authors = ["Bijoy Sijo"]
7
+ spec.email = ["bijoysijo21@gmail.com"]
8
+
9
+ spec.summary = %q{gem to extract text from images}
10
+ spec.description = %q{uses rtesseract, mini-magick to extract text from images.}
11
+ spec.requirements << 'you must have Imagemagick installed.'
12
+ spec.homepage = "https://github.com/bijoysijo/image-play"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/bijoysijo/image-play"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "rspec"
29
+ spec.add_development_dependency "coveralls"
30
+ spec.add_development_dependency "cucumber"
31
+ spec.add_development_dependency "aruba"
32
+ spec.add_dependency "thor"
33
+ spec.add_dependency "open3"
34
+ spec.add_dependency "mini_magick"
35
+ spec.add_dependency "rtesseract"
36
+ spec.add_development_dependency "minitest"
37
+ end
@@ -0,0 +1,33 @@
1
+ require "open3"
2
+ require "mini_magick"
3
+ require "rtesseract"
4
+
5
+ module ImagePlay
6
+ class Image
7
+ def initialize(input_path)
8
+ @input_path = input_path
9
+ end
10
+
11
+ def read
12
+ img = MiniMagick::Image.new(@input_path)
13
+ img.path
14
+ img.colorspace("Gray")
15
+ img.write(@input_path)
16
+ end
17
+
18
+ def process
19
+ MiniMagick::Tool::Magick.new do |magick|
20
+ magick << @input_path
21
+ magick.negate
22
+ magick.threshold("007%")
23
+ magick.negate
24
+ magick << @input_path
25
+ end
26
+ end
27
+
28
+ def text
29
+ image = RTesseract.new(@input_path)
30
+ image.to_s.downcase.gsub(/[[:punct:]]/, ' ').split.join('-') # Getting the value
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module ImagePlay
2
+ VERSION = "0.1.0"
3
+ end
data/lib/image_play.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "image_play/version"
2
+ require "image_play/image"
3
+
4
+ module ImagePlay
5
+ class Error < StandardError; end
6
+ # Your code goes here...
7
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: image_play
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bijoy Sijo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
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: coveralls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cucumber
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: aruba
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: open3
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: mini_magick
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rtesseract
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: minitest
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: uses rtesseract, mini-magick to extract text from images.
140
+ email:
141
+ - bijoysijo21@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".coveralls.yml"
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".travis.yml"
150
+ - Gemfile
151
+ - Gemfile.lock
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - bin/console
156
+ - bin/setup
157
+ - image_play.gemspec
158
+ - lib/image_play.rb
159
+ - lib/image_play/image.rb
160
+ - lib/image_play/version.rb
161
+ homepage: https://github.com/bijoysijo/image-play
162
+ licenses:
163
+ - MIT
164
+ metadata:
165
+ homepage_uri: https://github.com/bijoysijo/image-play
166
+ source_code_uri: https://github.com/bijoysijo/image-play
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: 2.3.0
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements:
182
+ - you must have Imagemagick installed.
183
+ rubygems_version: 3.1.3
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: gem to extract text from images
187
+ test_files: []