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 +4 -4
- data/.github/workflows/verify.yml +32 -0
- data/README.md +3 -1
- data/image_quality_check.gemspec +3 -3
- data/lib/image_quality_check/version.rb +1 -1
- data/lib/image_quality_check.rb +6 -3
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f464a43936793939abade67315eede661024e50014b4aeff0722659d0ea5a56
|
4
|
+
data.tar.gz: ef7ef680f25e0519d93758da9d2c2bf17916b5d2c955727bba43cf7cfb35bc84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 '
|
24
|
+
gem 'image_quality_check'
|
23
25
|
```
|
24
26
|
|
25
27
|
## Usage
|
data/image_quality_check.gemspec
CHANGED
@@ -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/
|
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
|
|
data/lib/image_quality_check.rb
CHANGED
@@ -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
|
-
|
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.
|
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:
|
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:
|
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/
|
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/
|
58
|
-
source_code_uri: https://github.com/pludoni/
|
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
|
-
|
75
|
-
rubygems_version: 2.7.6
|
76
|
+
rubygems_version: 3.2.15
|
76
77
|
signing_key:
|
77
78
|
specification_version: 4
|
78
|
-
summary:
|
79
|
+
summary: Thin gem wrapper that uses imagemagick and python-opencv to help determine
|
80
|
+
image quality.
|
79
81
|
test_files: []
|