smartcropper 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/Gemfile.lock +1 -1
- data/lib/smartcropper.rb +1 -0
- data/smartcropper.gemspec +1 -1
- data/test/fixtures/small1.png +0 -0
- data/test/fixtures/small2.png +0 -0
- data/test/helper.rb +7 -0
- data/test/test_croptoelie.rb +19 -0
- metadata +18 -15
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
YmViZmU3NTY4YzVmNmQ5YjJmYmM3ZTkzZTM3YzRmZGVmNzE2YWFkODRhODNj
|
10
|
-
YjE5Y2E4MTQzMmM5MzFlMjcwYmE3ZDI2YWM1MmY5NDRhMTI3Njc5YjJkNjNk
|
11
|
-
ZWZmMDZhM2JlMDM2Nzg1NTQzZGJkNGQ3YjNjOGE3OWViYWFkMTQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MGZiZDMyNGI5NTJkODY2ZWQ0ZWY0MTM2ZDMyZjY3ZjUxMGE5ZmZiZmYzNWRj
|
14
|
-
NjBkOTg4ZTEwODg2MWJiNzE2NzVhMTYyNzcwODk2Njk3OWFiNjdiMzUyMTAy
|
15
|
-
MzgyMjFhZjNmYmEzNjc0NjJjMDU4NjJmNDliZDgyYjlkMzA5ZWM=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ea6a76a907883164223b646b79369d558139e10a
|
4
|
+
data.tar.gz: 941ffc1c47deffed291e0ebe63e249f335069565
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bcd600935696a33b4e69519639fa1f7756bc27b63be5274ad6352e861a77289dadc034b4f8decf85c87b632c8c32432cc8544df2f1c6de0fa7758d5c90f25468
|
7
|
+
data.tar.gz: b4e6fd87e3abb6bd2a7737a14a4e5389882ddbc644a01e7c94b35f6362fe27653a60a89019778f0d0cef9010880a8cf9e1650d44e281345bf56c6f0f23dff534
|
data/Gemfile.lock
CHANGED
data/lib/smartcropper.rb
CHANGED
data/smartcropper.gemspec
CHANGED
Binary file
|
Binary file
|
data/test/helper.rb
CHANGED
@@ -13,5 +13,12 @@ require 'shoulda'
|
|
13
13
|
|
14
14
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
15
15
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
def fixture_path
|
19
|
+
Pathname.new(File.join(File.expand_path(File.dirname(__FILE__)), "fixtures"))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
16
23
|
require 'smartcropper'
|
17
24
|
|
data/test/test_croptoelie.rb
CHANGED
@@ -14,6 +14,7 @@ class TestSmartcropper < Test::Unit::TestCase
|
|
14
14
|
img = SmartCropper.new(@image)
|
15
15
|
assert_equal(img.class, SmartCropper)
|
16
16
|
end
|
17
|
+
|
17
18
|
should "create a smartcropper from an imagefile" do
|
18
19
|
img = SmartCropper.from_file(@filename)
|
19
20
|
assert_equal(img.class, SmartCropper)
|
@@ -64,6 +65,24 @@ class TestSmartcropper < Test::Unit::TestCase
|
|
64
65
|
assert_equal(img.image, @image)
|
65
66
|
end
|
66
67
|
|
68
|
+
###########################################################################
|
69
|
+
# Stuck in a loop when image is too small to slice #
|
70
|
+
###########################################################################
|
71
|
+
should "handle 1px wide images" do
|
72
|
+
@filename = fixture_path.join("small1.png")
|
73
|
+
@image = Magick::ImageList.new(@filename).last
|
74
|
+
img = SmartCropper.new(@image).smart_crop_and_scale(1, 50)
|
75
|
+
size = [img.rows, img.columns]
|
76
|
+
assert_equal([50, 1], size)
|
77
|
+
end
|
78
|
+
|
79
|
+
should "handle 5px wide images" do
|
80
|
+
@filename = fixture_path.join("small2.png")
|
81
|
+
@image = Magick::ImageList.new(@filename).last
|
82
|
+
img = SmartCropper.new(@image).smart_crop_and_scale(1, 50)
|
83
|
+
size = [img.rows, img.columns]
|
84
|
+
assert_equal([50, 1], size)
|
85
|
+
end
|
67
86
|
|
68
87
|
###########################################################################
|
69
88
|
# Images reported to fail by issue #5 #
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartcropper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bèr Kessels
|
@@ -14,59 +14,59 @@ dependencies:
|
|
14
14
|
name: rmagick
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.11.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.11.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: shoulda
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description: 'Crops images based on entropy: leaving the most interesting part intact.
|
70
70
|
Usefull for automatic cropping or resizing of images. '
|
71
71
|
email: ber@webschuur.com
|
72
72
|
executables: []
|
@@ -81,8 +81,8 @@ files:
|
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
83
|
- VERSION
|
84
|
-
- smartcropper.gemspec
|
85
84
|
- lib/smartcropper.rb
|
85
|
+
- smartcropper.gemspec
|
86
86
|
- test/fixtures/20x20.png
|
87
87
|
- test/fixtures/entropyish.png
|
88
88
|
- test/fixtures/entropyish.txt
|
@@ -90,6 +90,8 @@ files:
|
|
90
90
|
- test/fixtures/errors/hollywood-undead.jpg
|
91
91
|
- test/fixtures/errors/maroon-5.jpg
|
92
92
|
- test/fixtures/errors/yo-gotti.jpg
|
93
|
+
- test/fixtures/small1.png
|
94
|
+
- test/fixtures/small2.png
|
93
95
|
- test/helper.rb
|
94
96
|
- test/profiler.rb
|
95
97
|
- test/test_croptoelie.rb
|
@@ -103,17 +105,17 @@ require_paths:
|
|
103
105
|
- lib
|
104
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
107
|
requirements:
|
106
|
-
- -
|
108
|
+
- - ">="
|
107
109
|
- !ruby/object:Gem::Version
|
108
110
|
version: '0'
|
109
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
112
|
requirements:
|
111
|
-
- -
|
113
|
+
- - ">="
|
112
114
|
- !ruby/object:Gem::Version
|
113
115
|
version: '0'
|
114
116
|
requirements: []
|
115
117
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.2.2
|
117
119
|
signing_key:
|
118
120
|
specification_version: 4
|
119
121
|
summary: Content aware image cropping in Ruby and Carrierwave
|
@@ -125,7 +127,8 @@ test_files:
|
|
125
127
|
- test/fixtures/errors/hollywood-undead.jpg
|
126
128
|
- test/fixtures/errors/maroon-5.jpg
|
127
129
|
- test/fixtures/errors/yo-gotti.jpg
|
130
|
+
- test/fixtures/small1.png
|
131
|
+
- test/fixtures/small2.png
|
128
132
|
- test/helper.rb
|
129
133
|
- test/profiler.rb
|
130
134
|
- test/test_croptoelie.rb
|
131
|
-
has_rdoc:
|