Class: Ddr::Derivatives::PngGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/ddr/derivatives/png_generator.rb

Instance Attribute Summary

Attributes inherited from Generator

#options, #output, #source

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Generator

#initialize

Constructor Details

This class inherits a constructor from Ddr::Derivatives::Generator

Class Method Details

.output_mime_typeObject



7
8
9
# File 'lib/ddr/derivatives/png_generator.rb', line 7

def self.output_mime_type
  "image/png"
end

Instance Method Details

#generateObject



11
12
13
14
15
# File 'lib/ddr/derivatives/png_generator.rb', line 11

def generate
  command = "convert #{Ddr::Utils.file_path(source)}[0] #{options} png:#{Ddr::Utils.file_path(output)}"
  out, err, s = Open3.capture3(command)
  GeneratorResult.new(out, err, s)
end