wraith 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wraith/crop.rb +8 -10
- data/lib/wraith/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36d791b93337c426ab9bc7d78b4c2993f169ced8
|
4
|
+
data.tar.gz: 4bf74d7e73e55bf6822021dbe85e6ad0b461cd16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65aec8546903c5456ef18c3b9b6bc4097aa908b35a2e067a26188fd9055fa39d848a12c40d6e9446d9b09c1b41a209e85a328eec60c961051d0aef37f2783585
|
7
|
+
data.tar.gz: bdd4aa15de02acc699e749e1e6fb4ae4dff36c4d3ac7634cc8bc66eb666953c6c1f7d414a833069baa22c351d17b706628ebb9fd27455121bd008c87e0bc7611
|
data/lib/wraith/crop.rb
CHANGED
@@ -15,8 +15,9 @@ class Wraith::CropImages
|
|
15
15
|
Parallel.each(files.each_slice(2), in_processes: Parallel.processor_count) do |base, compare|
|
16
16
|
puts 'cropping images'
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
width = image_dimensions(base)[0]
|
19
|
+
base_height = image_dimensions(base)[1]
|
20
|
+
compare_height = image_dimensions(compare)[1]
|
20
21
|
|
21
22
|
if base_height > compare_height
|
22
23
|
image_to_crop = compare
|
@@ -26,18 +27,15 @@ class Wraith::CropImages
|
|
26
27
|
height_to_crop_to = compare_height
|
27
28
|
end
|
28
29
|
|
29
|
-
crop_task(image_to_crop, height_to_crop_to)
|
30
|
+
crop_task(image_to_crop, height_to_crop_to, width)
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
33
|
-
def crop_task(crop, height)
|
34
|
-
`convert #{crop} -background none -extent
|
34
|
+
def crop_task(crop, height, width)
|
35
|
+
`convert #{crop} -background none -extent #{width}x#{height} #{crop}`
|
35
36
|
end
|
36
37
|
|
37
|
-
def
|
38
|
-
File.open(image, 'rb')
|
39
|
-
size = ImageSize.new(fh.read).size
|
40
|
-
size[1]
|
41
|
-
end
|
38
|
+
def image_dimensions(image)
|
39
|
+
ImageSize.new(File.open(image, 'rb').read).size
|
42
40
|
end
|
43
41
|
end
|
data/lib/wraith/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wraith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Blooman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|