morandi 0.10.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +11 -0
- data/README.md +1 -1
- data/lib/morandi/image_processor.rb +3 -3
- data/lib/morandi/version.rb +1 -1
- data/lib/morandi.rb +0 -1
- data/spec/morandi_spec.rb +24 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 68cd42331964c9dd3672616161db84d71093f565f0186c4cc1b090bfec537cab
|
4
|
+
data.tar.gz: 3715b3e1b8288453ea1421260ca8a6305867305b1047e8ffa855c82b4b5fc501
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
75
|
-
|
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
|
-
|
data/lib/morandi/version.rb
CHANGED
data/lib/morandi.rb
CHANGED
data/spec/morandi_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'morandi'
|
2
2
|
|
3
|
-
RSpec.describe Morandi, "#
|
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.
|
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-
|
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.
|
201
|
+
rubygems_version: 2.7.7
|
201
202
|
signing_key:
|
202
203
|
specification_version: 4
|
203
204
|
summary: Simple Image Edits
|