obf 0.9.8.20 → 0.9.8.21
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/lib/obf/pdf.rb +9 -4
- data/lib/obf/utils.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50eeb7069d0910bcd43413ae6926ddc8e2c3dcc73d699aba08b590eca468258e
|
4
|
+
data.tar.gz: ed156dbda3e5a505a9eef60a5d1696b1619820ee1a484b5ebd8372c93be49d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a1e154445ad6827a21b41fa9968b975c2dea290441fd554ce024d234f6a3f91431cddd5a6438630b47815365d67180620631ad6982da3efd528fad6f0f62a7c
|
7
|
+
data.tar.gz: 289e220cdc43bc9e49fddcf65b2ffffc19802f115563b321f0e4c420c4702b70b8106f7a6769b7810538694a2ad57bc9ec80de8a9b49366384a1f814d93fd230
|
data/lib/obf/pdf.rb
CHANGED
@@ -211,14 +211,18 @@ module OBF::PDF
|
|
211
211
|
# prevent too many svg converts from happening at the same time
|
212
212
|
block = block || {grabs: []}
|
213
213
|
block[:grabs] << grab
|
214
|
-
|
215
|
-
if
|
214
|
+
grab[:svg] = true if grab[:image] && grab[:image]['content_type'] && grab[:image]['content_type'].match(/svg/)
|
215
|
+
grab[:svg] = true if grab[:res] && grab[:res]['content_type'] && grab[:res]['content_type'].match(/svg/)
|
216
|
+
if block[:grabs].length > 20 || block[:grabs].select{|g| g[:svg] }.length > 3
|
216
217
|
blocks << block
|
217
218
|
block = nil
|
218
219
|
end
|
219
220
|
end
|
220
|
-
blocks
|
221
|
+
blocks << block if block
|
222
|
+
OBF::Utils.log(" final block #{block.to_json}")
|
223
|
+
blocks.each_with_index do |block, idx|
|
221
224
|
threads = []
|
225
|
+
OBF::Utils.log(" block #{idx}")
|
222
226
|
block[:grabs].each do |grab|
|
223
227
|
if grab[:res] && grab[:res]['data']
|
224
228
|
grab[:image]['raw_data'] = grab[:res]['data']
|
@@ -232,10 +236,11 @@ module OBF::PDF
|
|
232
236
|
elsif options['symbol_background'] == 'black'
|
233
237
|
bg = 'black'
|
234
238
|
end
|
239
|
+
OBF::Utils.log(" img")
|
235
240
|
res = OBF::Utils.save_image(grab[:image], options['zipper'], bg)
|
236
241
|
threads << res if res && !res.is_a?(String)
|
237
242
|
end
|
238
|
-
threads.each{|t| t[:
|
243
|
+
threads.each{|t| t[:thread].join }
|
239
244
|
end
|
240
245
|
grabs.each do |grab|
|
241
246
|
if grab[:image]
|
data/lib/obf/utils.rb
CHANGED
@@ -225,7 +225,7 @@ module OBF::Utils
|
|
225
225
|
return {thread: thr, image: image, type: 'svg', pid: pid}
|
226
226
|
else
|
227
227
|
`#{cmd}`
|
228
|
-
OBF::Utils.log " finished image #{File.size(image['local_path'])}"
|
228
|
+
OBF::Utils.log " finished image #{File.exist?(image['local_path']) && File.size(image['local_path'])}"
|
229
229
|
end
|
230
230
|
# `convert -background "#{background}" -density 300 -resize #{size}x#{size} -gravity center -extent #{size}x#{size} #{file.path} -flatten #{file.path}.jpg`
|
231
231
|
# `rsvg-convert -w #{size} -h #{size} -a #{file.path} > #{file.path}.png`
|