morandi 0.10.3 → 0.11.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
- SHA1:
3
- metadata.gz: 6509e684d2ddcb40e40bd4e354a61ce7f1e5bcc3
4
- data.tar.gz: 415f941df4d9440901415f2906862ef7a8730721
2
+ SHA256:
3
+ metadata.gz: 68cd42331964c9dd3672616161db84d71093f565f0186c4cc1b090bfec537cab
4
+ data.tar.gz: 3715b3e1b8288453ea1421260ca8a6305867305b1047e8ffa855c82b4b5fc501
5
5
  SHA512:
6
- metadata.gz: 020dd16c067e38f99d80cf4b3429ca956ec5999f0e0cc8f7f7298e81c356640451ad54c09a698330b1b8e9976cc802625c10776a585574ea9da8c1706eef6da8
7
- data.tar.gz: 76f2c80deafe8bea29fc8e5a38c953437a1b85c13de94377a9952fa9f1b6f1e6f2ef2a5db3b869d3e640818d25bd76934d26be6d38c35c25c97bef8a9ca75be7
6
+ metadata.gz: b1af52f959e8b6dc5c25dadb1368797943d5d68256386b3f41be57ed4d1c92c1091977f00982ca1f3169b82df71f75dcd64d8a7346f4eb03f1fdc939df98856c
7
+ data.tar.gz: c8831c9ad0fc69f433abddbacc15352dfca2ad156841167f942038536cfcabf243d659967b1b64f865d6280797a0dcf2866e1f46695ef4c8e99db333cc700909
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## Last updated 07.12.2018
8
+
9
+ ## [0.11.0] 07.12.2018
10
+ ### Added
11
+ - Added option to set the JPEG image compression size [104324]
data/README.md CHANGED
@@ -38,7 +38,7 @@ crop | Array[Integer,Integer,Integer,Integer] | Crop image
38
38
  fx | String greyscale,sepia,bluetone | Apply colour filters
39
39
  border-style | String square,retro | Set border style
40
40
  background-style | String retro,black,white | Set border colour
41
-
41
+ quality | Integer 1..100 | Set JPG compression value, defaults to 97%
42
42
 
43
43
  ## Contributing
44
44
 
@@ -71,8 +71,9 @@ class Morandi::ImageProcessor
71
71
  pb.save(fn, 'png')
72
72
  end
73
73
 
74
- def write_to_jpeg(fn, quality = 97)
75
- @pb.save(fn, 'jpeg', :quality => quality)
74
+ def write_to_jpeg(fn, quality = nil)
75
+ quality ||= options.fetch(:quality, 97)
76
+ @pb.save(fn, 'jpeg', quality: quality)
76
77
  end
77
78
 
78
79
  protected
@@ -242,4 +243,3 @@ protected
242
243
  end
243
244
 
244
245
  end
245
-
@@ -1,3 +1,3 @@
1
1
  module Morandi
2
- VERSION = '0.10.3'.freeze
2
+ VERSION = '0.11.0'.freeze
3
3
  end
data/lib/morandi.rb CHANGED
@@ -18,4 +18,3 @@ module Morandi
18
18
  pro.write_to_jpeg(out_file)
19
19
  end
20
20
  end
21
-
data/spec/morandi_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'morandi'
2
2
 
3
- RSpec.describe Morandi, "#process_to_file" do
3
+ RSpec.describe Morandi, "#process" do
4
4
  context "in command mode" do
5
5
  it "should create ouptut" do
6
6
  Morandi.process("sample/sample.jpg", {}, out="sample/out_plain.jpg")
@@ -119,4 +119,27 @@ RSpec.describe Morandi, "#process_to_file" do
119
119
  expect(w).to be <= 300
120
120
  end
121
121
  end
122
+
123
+ context 'with increasing quality settings' do
124
+ 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")
127
+ end
128
+
129
+ let(:default_of_97_quality) do
130
+ Morandi.process("sample/sample.jpg", {}, "sample/out-97.jpg")
131
+ File.size("sample/out-97.jpg")
132
+ end
133
+
134
+ 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")
137
+ end
138
+
139
+ # Sort the output files' sizes and expect them to match to quality order
140
+ it "creates files of increasing size" do
141
+ expect([default_of_97_quality, max_quality_file_size, quality_of_40_by_options_args].sort).to
142
+ eq([quality_of_40_by_options_args, default_of_97_quality, max_quality_file_size])
143
+ end
144
+ end
122
145
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morandi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - |+
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-10-18 00:00:00.000000000 Z
14
+ date: 2018-12-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gtk2
@@ -162,6 +162,7 @@ extra_rdoc_files: []
162
162
  files:
163
163
  - ".gitignore"
164
164
  - ".rspec"
165
+ - CHANGELOG.md
165
166
  - Gemfile
166
167
  - LICENSE.txt
167
168
  - README.md
@@ -197,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
198
  version: '0'
198
199
  requirements: []
199
200
  rubyforge_project:
200
- rubygems_version: 2.5.2.2
201
+ rubygems_version: 2.7.7
201
202
  signing_key:
202
203
  specification_version: 4
203
204
  summary: Simple Image Edits