Module: OBF::PNG
- Defined in:
- lib/obf/png.rb
Class Method Summary collapse
- .from_external(board, dest_path) ⇒ Object
- .from_obf(obf, dest_path) ⇒ Object
- .from_pdf(pdf_path, dest_path, opts = {}) ⇒ Object
Class Method Details
.from_external(board, dest_path) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/obf/png.rb', line 16 def self.from_external(board, dest_path) tmp_path = OBF::Utils.temp_path("stash") self.from_pdf(OBF::External.to_pdf(board, tmp_path), dest_path) File.unlink(tmp_path) if File.exist?(tmp_path) dest_path end |
.from_obf(obf, dest_path) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/obf/png.rb', line 9 def self.from_obf(obf, dest_path) tmp_path = OBF::Utils.temp_path("stash") self.from_pdf(OBF::OBF.to_pdf(obf, tmp_path), dest_path) File.unlink(tmp_path) if File.exist?(tmp_path) dest_path end |
.from_pdf(pdf_path, dest_path, opts = {}) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/obf/png.rb', line 2 def self.from_pdf(pdf_path, dest_path, opts={}) resize = "" resize = "-resize 600x321 -quality 100" if opts[:resize] `convert -density 300 -crop 3160x1690+0+600 +repage #{resize} #{pdf_path} #{dest_path}` dest_path end |