image_quality_check 0.1.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5fbfb17831bb894d3890c10197aff1573ca1f6fbdcf0308f5ec1975cfd35cc6
4
- data.tar.gz: d5f5fdf1a2cb61f92566b26cc5954582a94116c056004a24323b93984307507d
3
+ metadata.gz: 3f464a43936793939abade67315eede661024e50014b4aeff0722659d0ea5a56
4
+ data.tar.gz: ef7ef680f25e0519d93758da9d2c2bf17916b5d2c955727bba43cf7cfb35bc84
5
5
  SHA512:
6
- metadata.gz: 594ca886f91f517ef6b71fda2cbf350cb4c41991434c3071aaad6f9e63d0d48a71fb1acc08a01835f2e927dd9774cb19655a9d63c63b5829b82796f22e6f6304
7
- data.tar.gz: 2b20142b04050a37d1b2655f6188ec69ac534f175acdf4234c4c07edc4760f3ec0b675f255afda053f080e836c852f93f69aa8c972441f80a58cabcff254bba4
6
+ metadata.gz: 19a03ee429e6abd1047ec6e48caead939eb306da1806b00adcd4e6f7e073f80bb89dc6d9862ab55945237af9fe88e7c96aa18a48b91cb7c82e4c0ec71bf30aff
7
+ data.tar.gz: 519449db3f4fb2f9731843913d69a9dcc238b5c994b6491963fe1f45f717248ee7b3eccd378c9b4385270ecd242bf53977e696799e59de7e6b7f1c40e72689e1
@@ -0,0 +1,32 @@
1
+ name: Verify
2
+ on: [push]
3
+
4
+ jobs:
5
+ tests:
6
+ name: Tests
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ # ruby: [ '2.5', '2.6', '2.7' ]
11
+ ruby: [ '2.6' ]
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: Dovyski/setup-opencv-action@v1
15
+ - uses: actions/setup-python@v2
16
+ with:
17
+ python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
18
+ architecture: 'x64' # o
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ - name: Install gems
23
+ run: |
24
+ bundle config path vendor/bundle
25
+ bundle install --jobs 4 --retry 3
26
+ - name: Install python dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install opencv-python PyWavelets
30
+ - name: Run tests
31
+ run: bundle exec rspec
32
+
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # ImageQuality
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/image_quality_check.svg)](https://badge.fury.io/rb/image_quality_check)
4
+
3
5
  Thin gem wrapper that uses ``imagemagick`` and ``python-opencv`` to help determine image quality.
4
6
 
5
7
 
@@ -19,7 +21,7 @@ apt-get install python3-pywt python3-opencv
19
21
  Add this line to your application's Gemfile:
20
22
 
21
23
  ```ruby
22
- gem 'image_quality'
24
+ gem 'image_quality_check'
23
25
  ```
24
26
 
25
27
  ## Usage
@@ -6,9 +6,9 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Stefan Wienert"]
7
7
  spec.email = ["info@stefanwienert.de"]
8
8
 
9
- spec.summary = %q{image quality}
10
- spec.description = %q{image quality}
11
- spec.homepage = "https://github.com/pludoni/image_quality_check"
9
+ spec.summary = %q{Thin gem wrapper that uses imagemagick and python-opencv to help determine image quality.}
10
+ spec.description = %q{Thin gem wrapper that uses imagemagick and python-opencv to help determine image quality of e.g. user portraits.}
11
+ spec.homepage = "https://github.com/pludoni/ruby-image-quality-check"
12
12
  spec.license = "MIT"
13
13
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
14
 
@@ -1,3 +1,3 @@
1
1
  module ImageQualityCheck
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -17,7 +17,10 @@ module ImageQualityCheck
17
17
  # image magick gif delay bug invalid json
18
18
  # https://github.com/ImageMagick/ImageMagick/issues/1624
19
19
  out.gsub!(/("delay": "[^"]+")\n/m, "\\1,\n")
20
- json = JSON.parse(out)['image']
20
+ return {} if out.empty?
21
+
22
+ raw_json = JSON.parse(out)
23
+ json = raw_json.is_a?(Array) ? raw_json.first['image'] : raw_json['image']
21
24
  background_is_transparent =
22
25
  json.dig('channelDepth', 'alpha') &&
23
26
  json['channelStatistics']['alpha']['min'] != json['channelStatistics']['alpha']['max']
@@ -25,8 +28,8 @@ module ImageQualityCheck
25
28
  format: json['format'].downcase,
26
29
  mime_type: json['mimeType'],
27
30
  background_is_transparent: background_is_transparent,
28
- width: json.dig('geometry', 'width'),
29
- height: json.dig('geometry', 'height'),
31
+ width: json.dig('geometry', 'width').to_i,
32
+ height: json.dig('geometry', 'height').to_i,
30
33
  quality: json['quality'],
31
34
  blur: blur_detect(path_to_image).map { |k, v| [ k.to_sym, v ] }.to_h
32
35
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_quality_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Wienert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-09 00:00:00.000000000 Z
11
+ date: 2021-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -24,7 +24,8 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: image quality
27
+ description: Thin gem wrapper that uses imagemagick and python-opencv to help determine
28
+ image quality of e.g. user portraits.
28
29
  email:
29
30
  - info@stefanwienert.de
30
31
  executables:
@@ -32,6 +33,7 @@ executables:
32
33
  extensions: []
33
34
  extra_rdoc_files: []
34
35
  files:
36
+ - ".github/workflows/verify.yml"
35
37
  - ".gitignore"
36
38
  - ".rspec"
37
39
  - Gemfile
@@ -50,12 +52,12 @@ files:
50
52
  - lib/image_quality_check/dsl.rb
51
53
  - lib/image_quality_check/model.rb
52
54
  - lib/image_quality_check/version.rb
53
- homepage: https://github.com/pludoni/image_quality_check
55
+ homepage: https://github.com/pludoni/ruby-image-quality-check
54
56
  licenses:
55
57
  - MIT
56
58
  metadata:
57
- homepage_uri: https://github.com/pludoni/image_quality_check
58
- source_code_uri: https://github.com/pludoni/image_quality_check
59
+ homepage_uri: https://github.com/pludoni/ruby-image-quality-check
60
+ source_code_uri: https://github.com/pludoni/ruby-image-quality-check
59
61
  post_install_message:
60
62
  rdoc_options: []
61
63
  require_paths:
@@ -71,9 +73,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
73
  - !ruby/object:Gem::Version
72
74
  version: '0'
73
75
  requirements: []
74
- rubyforge_project:
75
- rubygems_version: 2.7.6
76
+ rubygems_version: 3.2.15
76
77
  signing_key:
77
78
  specification_version: 4
78
- summary: image quality
79
+ summary: Thin gem wrapper that uses imagemagick and python-opencv to help determine
80
+ image quality.
79
81
  test_files: []