Class: IiifPrint::ImageTool

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif_print/image_tool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ImageTool



8
9
10
11
# File 'lib/iiif_print/image_tool.rb', line 8

def initialize(path)
  @path = path
   = nil
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/iiif_print/image_tool.rb', line 6

def path
  @path
end

Instance Method Details

#convert(destination, monochrome = false) ⇒ Object

Convert source image to image at destination path, inferring file type

from destination file extension.  In case of JP2 files, create
intermediate file using OpenJPEG 2000 that ImageMagick can use.
Only outputs monochrome output if monochrome is true, destination
format is TIFF.


32
33
34
35
36
# File 'lib/iiif_print/image_tool.rb', line 32

def convert(destination, monochrome = false)
  raise 'JP2 output not yet supported' if destination.end_with?('jp2')
  return convert_image(jp2_to_tiff(@path), destination, monochrome) if jp2?
  convert_image(@path, destination, monochrome)
end

#metadataHash



20
21
22
23
# File 'lib/iiif_print/image_tool.rb', line 20

def 
  return  unless .nil?
   = jp2? ?  : 
end