morandi 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -0
- data/lib/morandi/image_processor.rb +1 -1
- data/lib/morandi/profiled_pixbuf.rb +21 -0
- data/lib/morandi/version.rb +1 -1
- data/spec/morandi_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cc53b714e3e5e997376714b0f5033b14c753110b82a2d2de2b0d2d90b173b14
|
4
|
+
data.tar.gz: 4d59da477a6760c96c227d4b1d416b5114086ff63986c4631e9e406e73b4ec3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b12fa0320ca0dd1d036fe2d84fbf7948b6020c0a90d2db75a13b3b8b33c38b6aa9b6ceb9fe5caa0e6b1deace48012c9748e44cd3b455a5af9afc9662e16446ad
|
7
|
+
data.tar.gz: 5695162218181fe2adc94e4d851411079e1703b2238a424330f5b80725e18e4fbe58bb669d92b377aa32e930754a7bd157b8f28a8d0cd595eb0b0515d3f3487b
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -9,3 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
9
9
|
## [0.11.0] 07.12.2018
|
10
10
|
### Added
|
11
11
|
- Added option to set the JPEG image compression size [104324]
|
12
|
+
|
13
|
+
## [0.11.1] 21.02.2019
|
14
|
+
### Added
|
15
|
+
- Have option to set the JPEG image compression size be a string like all the other options. [TECH-7701]
|
16
|
+
- While throwing Gdk::PixbufError::CorruptImage in Morandi::ProfiledPixbuf#initialize try to recover the image by saving it to a tempfile and re-read. This operation should remove all wrong markers. [TECH-7663]
|
@@ -12,6 +12,15 @@ class Morandi::ProfiledPixbuf < Gdk::Pixbuf
|
|
12
12
|
false
|
13
13
|
end
|
14
14
|
|
15
|
+
def self.from_string(string, loader: nil, chunk_size: 4096)
|
16
|
+
loader ||= Gdk::PixbufLoader.new
|
17
|
+
((string.bytesize + chunk_size - 1) / chunk_size).times do |i|
|
18
|
+
loader.write(string.byteslice(i * chunk_size, chunk_size))
|
19
|
+
end
|
20
|
+
loader.close
|
21
|
+
loader.pixbuf
|
22
|
+
end
|
23
|
+
|
15
24
|
def self.default_icc_path(path)
|
16
25
|
"#{path}.icc.jpg"
|
17
26
|
end
|
@@ -30,6 +39,18 @@ class Morandi::ProfiledPixbuf < Gdk::Pixbuf
|
|
30
39
|
end
|
31
40
|
|
32
41
|
super(*args)
|
42
|
+
rescue Gdk::PixbufError::CorruptImage => e
|
43
|
+
if args[0].is_a?(String) && defined? Tempfile
|
44
|
+
temp = Tempfile.new
|
45
|
+
pixbuf = self.class.from_string(File.read(args[0]))
|
46
|
+
pixbuf.save(temp.path, 'jpeg')
|
47
|
+
args[0] = temp.path
|
48
|
+
super(*args)
|
49
|
+
temp.close
|
50
|
+
temp.unlink
|
51
|
+
else
|
52
|
+
throw e
|
53
|
+
end
|
33
54
|
end
|
34
55
|
|
35
56
|
|
data/lib/morandi/version.rb
CHANGED
data/spec/morandi_spec.rb
CHANGED
@@ -122,7 +122,7 @@ RSpec.describe Morandi, "#process" do
|
|
122
122
|
|
123
123
|
context 'with increasing quality settings' do
|
124
124
|
let(:max_quality_file_size) do
|
125
|
-
Morandi.process("sample/sample.jpg", { quality
|
125
|
+
Morandi.process("sample/sample.jpg", { 'quality' => 100 }, "sample/out-100.jpg")
|
126
126
|
File.size("sample/out-100.jpg")
|
127
127
|
end
|
128
128
|
|
@@ -132,7 +132,7 @@ RSpec.describe Morandi, "#process" do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
let(:quality_of_40_by_options_args) do
|
135
|
-
Morandi.process("sample/sample.jpg", { quality
|
135
|
+
Morandi.process("sample/sample.jpg", { 'quality' => 40 }, "sample/out-40.jpg")
|
136
136
|
File.size("sample/out-40.jpg")
|
137
137
|
end
|
138
138
|
|
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.11.
|
4
|
+
version: 0.11.1
|
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:
|
14
|
+
date: 2019-02-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: gtk2
|