Skip to content

Commit e85000a

Browse files
committed
Docsplit 0.3.4
1 parent 5efc676 commit e85000a

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,13 @@ <h2 id="internals">Internals</h2>
279279

280280
<h2 id="changes">Change Log</h2>
281281

282+
<p>
283+
<b class="header">0.3.4</b><br />
284+
Adding a suggested optimization from the GraphicsMagick list -- only ever
285+
generate one page image per GraphicsMagick call. Saves large amounts of
286+
disk space for tempfiles on long documents.
287+
</p>
288+
282289
<p>
283290
<b class="header">0.3.3</b><br />
284291
Start using the MAGICK_TMPDIR environment variable to prevent parallel

lib/docsplit/image_extractor.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def extract(pdfs, options)
2323
end
2424

2525
# Convert a single PDF into page images at the specified size and format.
26+
# If `--rolling`, and we have a previous image at a larger size to work with,
27+
# we simply downsample that image, instead of re-rendering the entire PDF.
28+
# Now we generate one page at a time, a counterintuitive opimization
29+
# suggested by the GraphicsMagick list, that seems to work quite well.
2630
def convert(pdf, size, format, previous=nil)
2731
tempdir = Dir.mktmpdir
2832
basename = File.basename(pdf, File.extname(pdf))
@@ -88,7 +92,7 @@ def page_list(pages)
8892
else
8993
range.to_i
9094
end
91-
}.flatten.sort
95+
}.flatten.uniq.sort
9296
end
9397

9498
end

0 commit comments

Comments
 (0)