imagetools 1.1.0 → 1.2.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/imagetools/imagefilter.rb +7 -6
- data/lib/imagetools/version.rb +1 -1
- 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: 76f5fa221bbd274c1ef8b9c54195abec9b2081b210355cf345ea7ea1dc047a35
|
4
|
+
data.tar.gz: 4b59da67822eb56fbb35af75f9bf2fec12662147988b7a5f788231f8108ba305
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12bfae8ed2f2b75d6d79180c15d50034a996d9c9492d0e4f495a0de615af2a76456e7bb0f5c073c3528aeb559f31777c4bce5c647ccd4a93964a4b69690b42b8
|
7
|
+
data.tar.gz: ff5ef80f32291a7d9197e87ad000950e9136015e621735254d2d539c797e3f1c9b8680301610258388d473222a54110c8b68552ad8fb5a60d18f866806df124a
|
data/Gemfile.lock
CHANGED
@@ -49,13 +49,14 @@ module Imagetools
|
|
49
49
|
|
50
50
|
CONVERT_CMD = "convert"
|
51
51
|
DWEBP_CMD = "dwebp"
|
52
|
-
RESIZE_CMD = "mogrify -resize 1280x\\> "
|
52
|
+
# RESIZE_CMD = "mogrify -resize 1280x\\> "
|
53
|
+
RESIZE_CMD = "mogrify -background white -resize 1280x\\> "
|
53
54
|
ROTATE_CMD = "exiftran -ai "
|
54
55
|
COMPRESS_CMD = "jpegoptim --strip-all --max=90 "
|
55
56
|
EXTERNAL_CMDS = [RESIZE_CMD, ROTATE_CMD, COMPRESS_CMD]
|
56
57
|
|
57
58
|
WEBP_SEARCH = /(.+)\.webp/i
|
58
|
-
WEBP_REPLACE = '\1.
|
59
|
+
WEBP_REPLACE = '\1.png'
|
59
60
|
|
60
61
|
PNG_SEARCH = /(.+)\.png/i
|
61
62
|
PNG_REPLACE = '\1.jpg'
|
@@ -133,7 +134,7 @@ EOM
|
|
133
134
|
filename.sub(OTHER_JPG_SEARCH, OTHER_JPG_REPLACE)
|
134
135
|
end
|
135
136
|
|
136
|
-
def self.
|
137
|
+
def self.replace_webp2png(filename)
|
137
138
|
filename.sub(WEBP_SEARCH, WEBP_REPLACE)
|
138
139
|
end
|
139
140
|
|
@@ -173,7 +174,7 @@ EOM
|
|
173
174
|
end
|
174
175
|
|
175
176
|
filepath = rename_image(filepath)
|
176
|
-
filepath =
|
177
|
+
filepath = webp2png(filepath)
|
177
178
|
filepath = png2jpg(filepath)
|
178
179
|
filepath = resize_jpg(filepath)
|
179
180
|
filepath = rotate_jpg(filepath)
|
@@ -203,9 +204,9 @@ EOM
|
|
203
204
|
return topath
|
204
205
|
end
|
205
206
|
|
206
|
-
def
|
207
|
+
def webp2png(filepath)
|
207
208
|
fromname = File.basename(filepath)
|
208
|
-
toname = self.class.
|
209
|
+
toname = self.class.replace_webp2png(fromname)
|
209
210
|
return filepath if fromname == toname
|
210
211
|
|
211
212
|
dir = File.dirname(filepath)
|
data/lib/imagetools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imagetools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- src
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rmagick
|