Class: Poleica::Converters::GraphicsMagick
- Inherits:
-
Object
- Object
- Poleica::Converters::GraphicsMagick
- Includes:
- Utils
- Defined in:
- lib/poleica/converters/graphics_magick.rb
Overview
The GraphicsMagick converter, use the ‘gm’ command to convert images and documents
Defined Under Namespace
Classes: OptionsGenerator
Constant Summary collapse
- COMPATIBLE_TYPES =
[ Types::Image, Types::PDF ]
- DEFAULT_MEASURE =
612
Instance Attribute Summary collapse
-
#polei ⇒ Object
readonly
Returns the value of attribute polei.
Instance Method Summary collapse
-
#initialize(polei) ⇒ GraphicsMagick
constructor
A new instance of GraphicsMagick.
- #to_png(options = {}) ⇒ Object
Methods included from Utils
#bin_path, exec_with_timeout, extract_extension_and_options, #host_os, #linux?, #osx?, set_process_stdout, #underscorize, #windows?
Constructor Details
#initialize(polei) ⇒ GraphicsMagick
Returns a new instance of GraphicsMagick.
18 19 20 |
# File 'lib/poleica/converters/graphics_magick.rb', line 18 def initialize(polei) @polei = polei end |
Instance Attribute Details
#polei ⇒ Object (readonly)
Returns the value of attribute polei.
16 17 18 |
# File 'lib/poleica/converters/graphics_magick.rb', line 16 def polei @polei end |
Instance Method Details
#to_png(options = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/poleica/converters/graphics_magick.rb', line 22 def to_png( = {}) opts_gen = OptionsGenerator.new(polei, ) exec_with_timeout(bin_path, opts_gen.generate) expected_file_path = opts_gen[:path] File.exists?(expected_file_path) ? expected_file_path : nil end |