morandi 0.11.3 → 0.12.0

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: 8205b8cb27b5245b443dfa17aa4e33f65f40a7d7f006013da2ccab43cc651fa3
4
- data.tar.gz: d58dc45a2304aaa7eb513e54a6b4adaff390bed0c246346f8872a3da60c4cf68
3
+ metadata.gz: 1d1a30842ccacd85b3680f80c8d4a68c52dd96edcf5136963a73c9049089ab5b
4
+ data.tar.gz: 9b2ee86c53d336481c377834baef371d16bba4886a0272c61211077ab8cb8da6
5
5
  SHA512:
6
- metadata.gz: f323e68d2c6d55c684847a34e71e4e04fa895c97669d6b8c2fcc4ee417fc919bf6a9c15eadb9538485a8875f2989089181b70fa4a04ce750f781671443e98e5b
7
- data.tar.gz: 5a4615e4f5502fa8181e26c2f343b87276433a9e4bcc73720a55d2fd1eddbbfdc2063f7f274085dccada0b5129ed2d187be17f2ebd85a6cc7673b56ef195f1eb
6
+ metadata.gz: cdb7f1ff080d549101e49c030c76dda02f433e9d4e7824e1abb6ebdf149268c0e406334bac8ea6848a7008293ceb8fd43f43d605623b771989fddc6df4faccd5
7
+ data.tar.gz: c7a00a804bb12717fba9c3e613ba813d1213d64934b8c2e3a21b9d1b10367d13f9b33f8fe0677b6b9e626d0bbf65806071286e7c6e3b6a57db6d4cfef68c4295
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --format progress
3
+ --require spec_helper
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## Last updated 26.06.2019
7
+ ## Last updated 10.12.2020
8
+
9
+ ## [0.12.0] 10.12.2020
10
+ ### Fixed
11
+ - Compatability with gdk_pixbuf v3.4.0+ [TECH-14001]
12
+ ### Aded
13
+ - .ruby-version file
14
+
8
15
 
9
16
  ## [0.11.3] 26.06.2019
10
17
  ### Fixed
data/README.md CHANGED
@@ -44,7 +44,7 @@ quality | String '1'..'100' | Set JPG compression value, defaults to 97%
44
44
 
45
45
  ## Contributing
46
46
 
47
- 1. Fork it ( http://github.com/<my-github-username>/morandi/fork )
47
+ 1. Fork it ( http://github.com/livelink/morandi-rb/fork )
48
48
  2. Create your feature branch (`git checkout -b my-new-feature`)
49
49
  3. Commit your changes (`git commit -am 'Add some feature'`)
50
50
  4. Push to the branch (`git push origin my-new-feature`)
@@ -36,7 +36,7 @@ class Crop < ImageOp
36
36
  def call(image, pixbuf)
37
37
  if @area and (not @area.width.zero?) and (not @area.height.zero?)
38
38
  # NB: Cheap - fast & shares memory
39
- Gdk::Pixbuf.new(pixbuf, @area.x, @area.y,
39
+ GdkPixbuf::Pixbuf.new(pixbuf, @area.x, @area.y,
40
40
  @area.width, @area.height)
41
41
  else
42
42
  pixbuf
@@ -223,6 +223,7 @@ class ImageBorder < ImageOp
223
223
 
224
224
  case style
225
225
  when 'retro'
226
+ # WARNING: CairoUtils class is not available in this gem!
226
227
  CairoUtils.rounded_rectangle(cr, x, y,
227
228
  img_width + x - (size*2), img_height+y-(size*2), size)
228
229
  when 'square'
@@ -23,7 +23,7 @@ class Morandi::ImageProcessor
23
23
 
24
24
  if @file.is_a?(String)
25
25
  get_pixbuf
26
- elsif @file.is_a?(Gdk::Pixbuf) or @file.is_a?(Morandi::ProfiledPixbuf)
26
+ elsif @file.is_a?(GdkPixbuf::Pixbuf) or @file.is_a?(Morandi::ProfiledPixbuf)
27
27
  @pb = @file
28
28
  @scale = 1.0
29
29
  end
@@ -78,7 +78,7 @@ class Morandi::ImageProcessor
78
78
 
79
79
  protected
80
80
  def get_pixbuf
81
- _, width, height = Gdk::Pixbuf.get_file_info(@file)
81
+ _, width, height = GdkPixbuf::Pixbuf.get_file_info(@file)
82
82
 
83
83
  if @scale_to
84
84
  @pb = Morandi::ProfiledPixbuf.new(@file, @scale_to, @scale_to, @local_options)
@@ -1,11 +1,11 @@
1
1
  require 'gdk_pixbuf2'
2
2
 
3
- class Morandi::ProfiledPixbuf < Gdk::Pixbuf
3
+ class Morandi::ProfiledPixbuf < GdkPixbuf::Pixbuf
4
4
  def valid_jpeg?(filename)
5
5
  return false unless File.exist?(filename)
6
6
  return false unless File.size(filename) > 0
7
7
 
8
- type, _, _ = Gdk::Pixbuf.get_file_info(filename)
8
+ type, _, _ = GdkPixbuf::Pixbuf.get_file_info(filename)
9
9
 
10
10
  type && type.name.eql?('jpeg')
11
11
  rescue
@@ -13,7 +13,7 @@ class Morandi::ProfiledPixbuf < Gdk::Pixbuf
13
13
  end
14
14
 
15
15
  def self.from_string(string, loader: nil, chunk_size: 4096)
16
- loader ||= Gdk::PixbufLoader.new
16
+ loader ||= GdkPixbuf::PixbufLoader.new
17
17
  ((string.bytesize + chunk_size - 1) / chunk_size).times do |i|
18
18
  loader.write(string.byteslice(i * chunk_size, chunk_size))
19
19
  end
@@ -38,14 +38,29 @@ class Morandi::ProfiledPixbuf < Gdk::Pixbuf
38
38
  end
39
39
  end
40
40
 
41
- super(*args)
42
- rescue Gdk::PixbufError::CorruptImage => e
41
+ # TODO: This is to fix some deprecation warnings. This needs refactoring.
42
+ # All can be implemented without having to hack on the PixBuff gem.
43
+ case args.size
44
+ when 1
45
+ super(file: args.first)
46
+ when 3
47
+ super(path: args[0], width: args[1], height: args[2])
48
+ else
49
+ super(*args)
50
+ end
51
+ rescue GdkPixbuf::PixbufError::CorruptImage => e
43
52
  if args[0].is_a?(String) && defined? Tempfile
44
53
  temp = Tempfile.new
45
54
  pixbuf = self.class.from_string(File.read(args[0]))
46
55
  pixbuf.save(temp.path, 'jpeg')
47
56
  args[0] = temp.path
48
- super(*args)
57
+
58
+ if args.size == 1
59
+ super file: args.first
60
+ else
61
+ super(*args)
62
+ end
63
+
49
64
  temp.close
50
65
  temp.unlink
51
66
  else
@@ -56,7 +71,7 @@ class Morandi::ProfiledPixbuf < Gdk::Pixbuf
56
71
 
57
72
  protected
58
73
  def suitable_for_jpegicc?
59
- type, _, _ = Gdk::Pixbuf.get_file_info(@file)
74
+ type, _, _ = GdkPixbuf::Pixbuf.get_file_info(@file)
60
75
 
61
76
  type && type.name.eql?('jpeg')
62
77
  end
@@ -47,7 +47,13 @@ module Morandi
47
47
  def apply_crop(pixbuf, x, y, w, h, fill_col = 0xffffffff)
48
48
  if (x < 0) or (y < 0) || ((x+w) > pixbuf.width) || ((y+h) > pixbuf.height)
49
49
  #tw, th = [w-x,w].max, [h-y,h].max
50
- base_pixbuf = Gdk::Pixbuf.new(Gdk::Pixbuf::ColorSpace::RGB, false, 8, w, h)
50
+ base_pixbuf = GdkPixbuf::Pixbuf.new(
51
+ colorspace: GdkPixbuf::Colorspace::RGB,
52
+ has_alpha: false,
53
+ bits_per_sample: 8,
54
+ width: w,
55
+ height: h
56
+ )
51
57
  base_pixbuf.fill!(fill_col)
52
58
  dest_x = [x, 0].min
53
59
  dest_y = [y, 0].min
@@ -80,10 +86,18 @@ module Morandi
80
86
  if copy_h + paste_y > base_pixbuf.height
81
87
  copy_h = base_pixbuf.height - paste_y
82
88
  end
83
-
84
- args = [pixbuf, paste_x, paste_y, copy_w, copy_h, paste_x - offset_x, paste_y - offset_y, 1, 1, Gdk::Pixbuf::INTERP_HYPER, 255]
85
- #p args
86
- base_pixbuf.composite!(*args)
89
+ base_pixbuf.composite! pixbuf, {
90
+ dest_x: paste_x,
91
+ dest_y: paste_y,
92
+ dest_width: copy_w,
93
+ dest_height: copy_h,
94
+ offset_x: paste_x - offset_x,
95
+ offset_y: paste_y - offset_y,
96
+ scale_x: 1,
97
+ scale_y: 1,
98
+ interpolation_type: :hyper,
99
+ overall_alpha: 255
100
+ }
87
101
  pixbuf = base_pixbuf
88
102
  else
89
103
  x = constrain(x, 0, pixbuf.width)
@@ -91,19 +105,19 @@ module Morandi
91
105
  w = constrain(w, 1, pixbuf.width - x)
92
106
  h = constrain(h, 1, pixbuf.height - y)
93
107
  #p [pixbuf, x, y, w, h]
94
- pixbuf = Gdk::Pixbuf.new(pixbuf, x, y, w, h)
108
+ pixbuf = pixbuf.subpixbuf(x, y, w, h)
95
109
  end
96
110
  pixbuf
97
111
  end
98
112
  end
99
113
  end
100
114
 
101
- class Gdk::Pixbuf
102
- unless defined?(::Gdk::Pixbuf::InterpType)
115
+ class GdkPixbuf::Pixbuf
116
+ unless defined?(::GdkPixbuf::Pixbuf::InterpType)
103
117
  InterpType = GdkPixbuf::InterpType
104
118
  end
105
119
 
106
- def scale_max(max_size, interp = Gdk::Pixbuf::InterpType::BILINEAR, max_scale = 1.0)
120
+ def scale_max(max_size, interp = GdkPixbuf::Pixbuf::InterpType::BILINEAR, max_scale = 1.0)
107
121
  mul = (max_size / [width,height].max.to_f)
108
122
  mul = [max_scale = 1.0,mul].min
109
123
  scale(width * mul, height * mul, interp)
@@ -112,7 +126,7 @@ end
112
126
 
113
127
  class Cairo::ImageSurface
114
128
  def to_pixbuf
115
- loader = Gdk::PixbufLoader.new
129
+ loader = GdkPixbuf::PixbufLoader.new
116
130
  io = StringIO.new
117
131
  write_to_png(io)
118
132
  io.rewind
@@ -1,3 +1,3 @@
1
1
  module Morandi
2
- VERSION = '0.11.3'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  end
@@ -19,14 +19,15 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "gtk2"
22
- spec.add_dependency "gdk_pixbuf2"
22
+ spec.add_dependency "gdk_pixbuf2", "~> 3.4.0"
23
23
  spec.add_dependency "cairo"
24
24
  spec.add_dependency "pixbufutils"
25
25
  spec.add_dependency "redeye"
26
26
  spec.add_dependency "pango"
27
27
  spec.add_dependency "colorscore"
28
28
 
29
- spec.add_development_dependency "bundler", "~> 1.5"
29
+ spec.add_development_dependency "bundler"
30
+ spec.add_development_dependency "pry"
30
31
  spec.add_development_dependency "rake"
31
32
  spec.add_development_dependency "rspec"
32
33
  end
Binary file
@@ -1,143 +1,206 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
1
4
  require 'morandi'
2
5
 
3
- RSpec.describe Morandi, "#process" do
4
- context "in command mode" do
5
- it "should create ouptut" do
6
- Morandi.process("sample/sample.jpg", {}, out="sample/out_plain.jpg")
6
+ RSpec.describe Morandi, '#process' do
7
+ context 'in command mode' do
8
+ it 'should create ouptut' do
9
+ Morandi.process('sample/sample.jpg', {}, out = 'sample/out_plain.jpg')
7
10
  expect(File.exist?(out))
8
11
  end
9
12
 
10
- it "should do rotation of images" do
11
- original = Gdk::Pixbuf.get_file_info("sample/sample.jpg")
12
- Morandi.process("sample/sample.jpg", {
13
- 'angle' => 90
14
- }, out="sample/out_rotate90.jpg")
13
+ context "with a big image and a bigger cropped area to fill" do
14
+ it 'should create ouptut' do
15
+ settings = {
16
+ "crop"=>"0,477,15839,18804",
17
+ "angle"=>90,
18
+ "fx"=>"colour",
19
+ "straighten"=>0.0,
20
+ "gamma"=>0.98,
21
+ "redeye"=>[]
22
+ }
23
+
24
+ Morandi.process('sample/100_mb_image.jpg', settings, out = 'sample/out_100_mb_image.jpg')
25
+ expect(File.exist?(out))
26
+ end
27
+ end
28
+
29
+ it 'should do rotation of images' do
30
+ original = GdkPixbuf::Pixbuf.get_file_info('sample/sample.jpg')
31
+ Morandi.process('sample/sample.jpg', {
32
+ 'angle' => 90
33
+ }, out = 'sample/out_rotate90.jpg')
15
34
  expect(File.exist?(out))
16
- _,w,h = Gdk::Pixbuf.get_file_info(out)
17
- expect(original[1]).to eq(h)
18
- expect(original[2]).to eq(w)
35
+ _, width, height = GdkPixbuf::Pixbuf.get_file_info(out)
36
+ expect(original[1]).to eq(height)
37
+ expect(original[2]).to eq(width)
19
38
  end
20
39
 
21
- it "should accept pixbufs as an argument" do
22
- pixbuf = Gdk::Pixbuf.new("sample/sample.jpg")
40
+ it 'should accept pixbufs as an argument' do
41
+ pixbuf = GdkPixbuf::Pixbuf.new(file: 'sample/sample.jpg')
23
42
  pro = Morandi::ImageProcessor.new(pixbuf, {}, {})
24
43
  pro.process!
25
44
  expect(pixbuf.width).to eq(pro.result.width)
26
45
  end
27
46
 
28
- it "should do cropping of images" do
29
- Morandi.process("sample/sample.jpg", {
30
- 'crop' => [10,10,300,300]
31
- }, out="sample/out_crop.jpg")
47
+ it 'should do cropping of images' do
48
+ Morandi.process('sample/sample.jpg', {
49
+ 'crop' => [10, 10, 300, 300]
50
+ }, out = 'sample/out_crop.jpg')
32
51
  expect(File.exist?(out))
33
- _,w,h = Gdk::Pixbuf.get_file_info(out)
34
- expect(w).to eq(300)
35
- expect(h).to eq(300)
52
+ _, width, height = GdkPixbuf::Pixbuf.get_file_info(out)
53
+ expect(width).to eq(300)
54
+ expect(height).to eq(300)
36
55
  end
37
56
 
38
- it "should use user supplied path.icc" do
57
+ it 'should use user supplied path.icc' do
39
58
  src = 'sample/sample.jpg'
40
59
  icc = '/tmp/this-is-secure-thing.jpg'
41
60
  default_icc = Morandi::ImageProcessor.default_icc_path(src)
42
61
  out = 'sample/out_icc.jpg'
43
- File.unlink(default_icc) rescue nil
44
- Morandi.process(src, { }, out, { 'path.icc' => icc })
62
+ FileUtils.rm_f(default_icc)
63
+ Morandi.process(src, {}, out, 'path.icc' => icc)
45
64
  expect(File).to exist(icc)
46
65
  expect(File).not_to exist(default_icc)
47
66
  end
48
67
 
49
- it "should ignore user supplied path.icc" do
68
+ it 'should ignore user supplied path.icc' do
50
69
  src = 'sample/sample.jpg'
51
70
  icc = '/tmp/this-is-insecure-thing.jpg'
52
71
  default_icc = Morandi::ImageProcessor.default_icc_path(src)
53
- File.unlink(icc) rescue 0
54
- File.unlink(default_icc) rescue 0
72
+ FileUtils.rm_f(icc)
73
+ FileUtils.rm_f(default_icc)
55
74
  out = 'sample/out_icc.jpg'
56
75
  Morandi.process(src, { 'path.icc' => icc, 'output.max' => 200 }, out)
57
76
  expect(File).not_to exist(icc)
58
77
  expect(File).to exist(default_icc)
59
78
  end
60
79
 
61
- it "should do cropping of images with a string" do
62
- Morandi.process("sample/sample.jpg", {
63
- 'crop' => "10,10,300,300"
64
- }, out="sample/out_crop.jpg")
80
+ it 'should do cropping of images with a string' do
81
+ Morandi.process('sample/sample.jpg', {
82
+ 'crop' => '10,10,300,300'
83
+ }, out = 'sample/out_crop.jpg')
84
+ expect(File.exist?(out))
85
+ _, width, height = GdkPixbuf::Pixbuf.get_file_info(out)
86
+ expect(width).to eq(300)
87
+ expect(height).to eq(300)
88
+ end
89
+
90
+ it 'should reduce the size of images' do
91
+ Morandi.process('sample/sample.jpg', {
92
+ 'output.max' => 200
93
+ }, out = 'sample/out_reduce.jpg')
65
94
  expect(File.exist?(out))
66
- _,w,h = Gdk::Pixbuf.get_file_info(out)
67
- expect(w).to eq(300)
68
- expect(h).to eq(300)
95
+ _, width, height = GdkPixbuf::Pixbuf.get_file_info(out)
96
+ expect(width).to be <= 200
97
+ expect(height).to be <= 200
69
98
  end
70
99
 
71
- it "should reduce the size of images" do
72
- Morandi.process("sample/sample.jpg", {
73
- 'output.max' => 200
74
- }, out="sample/out_reduce.jpg")
100
+ it 'should reduce the straighten images' do
101
+ Morandi.process('sample/sample.jpg', {
102
+ 'straighten' => 5
103
+ }, out = 'sample/out_straighten.jpg')
75
104
  expect(File.exist?(out))
76
- _,w,h = Gdk::Pixbuf.get_file_info(out)
77
- expect(w).to be <= 200
78
- expect(h).to be <= 200
105
+ info, _, _ = GdkPixbuf::Pixbuf.get_file_info(out)
106
+ expect(info.name).to eq('jpeg')
79
107
  end
80
108
 
81
- it "should reduce the straighten images" do
82
- Morandi.process("sample/sample.jpg", {
83
- 'straighten' => 5
84
- }, out="sample/out_straighten.jpg")
109
+ it 'should reduce the gamma correct images' do
110
+ Morandi.process('sample/sample.jpg', {
111
+ 'gamma' => 1.2
112
+ }, out = 'sample/out_gamma.jpg')
85
113
  expect(File.exist?(out))
86
- _,w,h = Gdk::Pixbuf.get_file_info(out)
87
- expect(_.name).to eq('jpeg')
114
+ info, _, _ = GdkPixbuf::Pixbuf.get_file_info(out)
115
+ expect(info.name).to eq('jpeg')
88
116
  end
89
117
 
90
- it "should reduce the gamma correct images" do
91
- Morandi.process("sample/sample.jpg", {
92
- 'gamma' => 1.2
93
- }, out="sample/out_gamma.jpg")
118
+ it 'should reduce the size of images' do
119
+ Morandi.process('sample/sample.jpg', {
120
+ 'fx' => 'sepia'
121
+ }, out = 'sample/out_sepia.jpg')
94
122
  expect(File.exist?(out))
95
- _,w,h = Gdk::Pixbuf.get_file_info(out)
96
- expect(_.name).to eq('jpeg')
123
+ info, _, _ = GdkPixbuf::Pixbuf.get_file_info(out)
124
+ expect(info.name).to eq('jpeg')
97
125
  end
98
126
 
99
- it "should reduce the size of images" do
100
- Morandi.process("sample/sample.jpg", {
101
- 'fx' => 'sepia'
102
- }, out="sample/out_sepia.jpg")
127
+ it 'should output at the specified size' do
128
+ Morandi.process('sample/sample.jpg', {
129
+ 'output.width' => 300,
130
+ 'output.height' => 200,
131
+ 'image.auto-crop' => true,
132
+ 'output.limit' => true
133
+ }, out = 'sample/out_at_size.jpg')
103
134
  expect(File.exist?(out))
104
- _,w,h = Gdk::Pixbuf.get_file_info(out)
105
- expect(_.name).to eq('jpeg')
135
+ info, width, height = GdkPixbuf::Pixbuf.get_file_info(out)
136
+ expect(info.name).to eq('jpeg')
137
+ expect(width).to be <= 300
138
+ expect(height).to be <= 200
106
139
  end
107
140
 
108
- it "should output at the specified size" do
109
- Morandi.process("sample/sample.jpg", {
110
- 'output.width' => 300,
111
- 'output.height' => 200,
112
- 'image.auto-crop' => true,
113
- 'output.limit' => true
114
- }, out="sample/out_at_size.jpg")
141
+ it 'should blur the image' do
142
+ Morandi.process('sample/sample.jpg', {
143
+ 'sharpen' => -3
144
+ }, out = 'sample/out_blur.jpg')
115
145
  expect(File.exist?(out))
116
- _,w,h = Gdk::Pixbuf.get_file_info(out)
117
- expect(_.name).to eq('jpeg')
118
- expect(h).to be <= 200
119
- expect(w).to be <= 300
146
+ end
147
+
148
+ it 'should apply a border and maintain the target size' do
149
+ Morandi.process('sample/sample.jpg', {
150
+ 'border-style' => 'square',
151
+ 'background-style' => 'dominant',
152
+ 'border-size-mm' => 5,
153
+ 'output.width' => 800,
154
+ 'output.height' => 650
155
+ }, out = 'sample/out_border.jpg')
156
+ expect(File.exist?(out))
157
+
158
+ info, width, height = GdkPixbuf::Pixbuf.get_file_info(out)
159
+ expect(info.name).to eq('jpeg')
160
+ expect(width).to eq 800
161
+ expect(height).to eq 650
162
+ end
163
+
164
+ it 'should apply multiple transformations' do
165
+ Morandi.process('sample/sample.jpg', {
166
+ 'brighten' => 5,
167
+ 'contrast' => 5,
168
+ 'sharpen' => 2,
169
+ 'fx' => 'greyscale',
170
+ 'border-style' => 'solid',
171
+ 'background-style' => '#00FF00',
172
+ 'crop' => [50, 0, 750, 650],
173
+ 'output.width' => 300,
174
+ 'output.height' => 260,
175
+ 'output.limit' => true
176
+ }, out = 'sample/out_various.jpg')
177
+ expect(File.exist?(out))
178
+
179
+ info, width, height = GdkPixbuf::Pixbuf.get_file_info(out)
180
+ expect(info.name).to eq('jpeg')
181
+ expect(width).to eq 300
182
+ expect(height).to eq 260
120
183
  end
121
184
  end
122
185
 
123
186
  context 'with increasing quality settings' do
124
187
  let(:max_quality_file_size) do
125
- Morandi.process("sample/sample.jpg", { 'quality' => 100 }, "sample/out-100.jpg")
126
- File.size("sample/out-100.jpg")
188
+ Morandi.process('sample/sample.jpg', { 'quality' => 100 }, 'sample/out-100.jpg')
189
+ File.size('sample/out-100.jpg')
127
190
  end
128
191
 
129
192
  let(:default_of_97_quality) do
130
- Morandi.process("sample/sample.jpg", {}, "sample/out-97.jpg")
131
- File.size("sample/out-97.jpg")
193
+ Morandi.process('sample/sample.jpg', {}, 'sample/out-97.jpg')
194
+ File.size('sample/out-97.jpg')
132
195
  end
133
196
 
134
197
  let(:quality_of_40_by_options_args) do
135
- Morandi.process("sample/sample.jpg", { 'quality' => 40 }, "sample/out-40.jpg")
136
- File.size("sample/out-40.jpg")
198
+ Morandi.process('sample/sample.jpg', { 'quality' => 40 }, 'sample/out-40.jpg')
199
+ File.size('sample/out-40.jpg')
137
200
  end
138
201
 
139
202
  # Sort the output files' sizes and expect them to match to quality order
140
- it "creates files of increasing size" do
203
+ it 'creates files of increasing size' do
141
204
  created_file_sizes = [default_of_97_quality, max_quality_file_size, quality_of_40_by_options_args].sort
142
205
  expect(created_file_sizes).to eq([quality_of_40_by_options_args, default_of_97_quality, max_quality_file_size])
143
206
  end
@@ -4,8 +4,10 @@
4
4
  # loaded once.
5
5
  #
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require "pry"
9
+
7
10
  RSpec.configure do |config|
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
11
  config.run_all_when_everything_filtered = true
10
12
  config.filter_run :focus
11
13
 
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morandi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - |+
8
8
  Geoff Youngs
9
9
 
10
10
 
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-06-27 00:00:00.000000000 Z
14
+ date: 2020-12-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gtk2
@@ -31,16 +31,16 @@ dependencies:
31
31
  name: gdk_pixbuf2
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ">="
34
+ - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: '0'
36
+ version: 3.4.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ">="
41
+ - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '0'
43
+ version: 3.4.0
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: cairo
46
46
  requirement: !ruby/object:Gem::Requirement
@@ -115,16 +115,30 @@ dependencies:
115
115
  name: bundler
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - "~>"
118
+ - - ">="
119
119
  - !ruby/object:Gem::Version
120
- version: '1.5'
120
+ version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - "~>"
125
+ - - ">="
126
126
  - !ruby/object:Gem::Version
127
- version: '1.5'
127
+ version: '0'
128
+ - !ruby/object:Gem::Dependency
129
+ name: pry
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
128
142
  - !ruby/object:Gem::Dependency
129
143
  name: rake
130
144
  requirement: !ruby/object:Gem::Requirement
@@ -162,6 +176,7 @@ extra_rdoc_files: []
162
176
  files:
163
177
  - ".gitignore"
164
178
  - ".rspec"
179
+ - ".ruby-version"
165
180
  - CHANGELOG.md
166
181
  - Gemfile
167
182
  - LICENSE.txt
@@ -175,6 +190,7 @@ files:
175
190
  - lib/morandi/utils.rb
176
191
  - lib/morandi/version.rb
177
192
  - morandi.gemspec
193
+ - sample/100_mb_image.jpg
178
194
  - sample/sample.jpg
179
195
  - spec/morandi_spec.rb
180
196
  - spec/spec_helper.rb
@@ -182,7 +198,7 @@ homepage: ''
182
198
  licenses:
183
199
  - MIT
184
200
  metadata: {}
185
- post_install_message:
201
+ post_install_message:
186
202
  rdoc_options: []
187
203
  require_paths:
188
204
  - lib
@@ -197,10 +213,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
213
  - !ruby/object:Gem::Version
198
214
  version: '0'
199
215
  requirements: []
200
- rubygems_version: 3.0.1
201
- signing_key:
216
+ rubygems_version: 3.1.2
217
+ signing_key:
202
218
  specification_version: 4
203
219
  summary: Simple Image Edits
204
220
  test_files:
205
221
  - spec/morandi_spec.rb
206
222
  - spec/spec_helper.rb
223
+ ...