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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/obf/pdf.rb +9 -4
  3. data/lib/obf/utils.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3e2b11f62122f2f89f8bdec499955bd50f09af2785658ae48678e0117b42dc9
4
- data.tar.gz: 79f7c3ae171cb1e3eff566998a61590a380d9642f610aff9598e4b331699831a
3
+ metadata.gz: 50eeb7069d0910bcd43413ae6926ddc8e2c3dcc73d699aba08b590eca468258e
4
+ data.tar.gz: ed156dbda3e5a505a9eef60a5d1696b1619820ee1a484b5ebd8372c93be49d7f
5
5
  SHA512:
6
- metadata.gz: d560911abadda8aeb4a5bea1d34155d4ecfe6d6cce106b0aa9857d48aa65877e64088cc41dd14eb948a2988cc4b4fb88997c82bfd21c1ea2692bb28fd5a11a5c
7
- data.tar.gz: 693efbacffe3e70ab657e508b9c13dcc36c883731d0c86004d2a8f509b1063081fbab70a42d4af87d470ab0ef2c0033b8e77b5c861250db31c3252d0358a6560
6
+ metadata.gz: 3a1e154445ad6827a21b41fa9968b975c2dea290441fd554ce024d234f6a3f91431cddd5a6438630b47815365d67180620631ad6982da3efd528fad6f0f62a7c
7
+ data.tar.gz: 289e220cdc43bc9e49fddcf65b2ffffc19802f115563b321f0e4c420c4702b70b8106f7a6769b7810538694a2ad57bc9ec80de8a9b49366384a1f814d93fd230
@@ -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
- block[:has_svg] = true if grab[:type] == 'svg'
215
- if block[:grabs].length > 5 && block[:has_svg]
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.each do |block|
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[:thred].join }
243
+ threads.each{|t| t[:thread].join }
239
244
  end
240
245
  grabs.each do |grab|
241
246
  if grab[:image]
@@ -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`
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8.20
4
+ version: 0.9.8.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer