Class: Ddr::Derivatives::PtifGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/ddr/derivatives/ptif_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



5
6
7
# File 'lib/ddr/derivatives/ptif_generator.rb', line 5

def self.output_mime_type
  "image/tiff"
end

Instance Method Details

#generateObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ddr/derivatives/ptif_generator.rb', line 9

def generate
  case source_depth.strip
  when '16'
    Dir.mktmpdir do |dir|
      temp_8_bit = make_8_bit(dir)
      run_generator(temp_8_bit)
    end
  when '8'
    run_generator(source)
  else
    raise Ddr::Models::DerivativeGenerationFailure,
            "Unexpected depth -- #{source_depth} -- for source file #{Ddr::Utils.file_path(source)}"
  end
end