Class: Libis::Format::Converter::ImageConverter
- Inherits:
-
Base
- Object
- Base
- Libis::Format::Converter::ImageConverter
show all
- Defined in:
- lib/libis/format/converter/image_converter.rb
Overview
noinspection RubyTooManyInstanceVariablesInspection
Instance Attribute Summary
Attributes inherited from Base
#flags, #options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
category, #check_file_exist, inherited, using_temp, #using_temp
Constructor Details
Returns a new instance of ImageConverter.
37
38
39
40
|
# File 'lib/libis/format/converter/image_converter.rb', line 37
def initialize
@wm_image = nil
super
end
|
Class Method Details
24
25
26
|
# File 'lib/libis/format/converter/image_converter.rb', line 24
def self.input_types
[:TIFF, :JPG, :PNG, :BMP, :GIF, :PDF, :JP2, :PBM, :PGM, :PPM]
end
|
.multipage?(format) ⇒ Boolean
33
34
35
|
# File 'lib/libis/format/converter/image_converter.rb', line 33
def self.multipage?(format)
[:PDF, :TIFF, :GIF, :PBM, :PGM, :PPM].include?(format)
end
|
.output_types(format = nil) ⇒ Object
28
29
30
31
|
# File 'lib/libis/format/converter/image_converter.rb', line 28
def self.output_types(format = nil)
return [] unless input_types.include?(format) if format
[:TIFF, :JPG, :PNG, :BMP, :GIF, :PDF, :JP2]
end
|
Instance Method Details
#colorspace(value) ⇒ Object
86
87
88
89
|
# File 'lib/libis/format/converter/image_converter.rb', line 86
def colorspace(value)
@options[:colorspace] = value
self
end
|
#convert(source, target, format, opts = {}) ⇒ Object
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/libis/format/converter/image_converter.rb', line 101
def convert(source, target, format, opts = {})
super
FileUtils.mkpath(File.dirname(target))
convert_image(source, target, format)
target
end
|
#delete_date(value = true) ⇒ Object
91
92
93
94
|
# File 'lib/libis/format/converter/image_converter.rb', line 91
def delete_date(value = true)
@delete_date = value
self
end
|
#dpi(value) ⇒ Object
71
72
73
74
|
# File 'lib/libis/format/converter/image_converter.rb', line 71
def dpi(value)
@options[:density] = value
self
end
|
#flatten(value = true) ⇒ Object
81
82
83
84
|
# File 'lib/libis/format/converter/image_converter.rb', line 81
def flatten(value = true)
@options[:flatten] = value
self
end
|
#image_convert(_) ⇒ Object
42
43
44
|
# File 'lib/libis/format/converter/image_converter.rb', line 42
def image_convert(_)
end
|
51
52
53
54
|
# File 'lib/libis/format/converter/image_converter.rb', line 51
def page(nr)
@page = nr
self
end
|
#profile(icc) ⇒ Object
96
97
98
99
|
# File 'lib/libis/format/converter/image_converter.rb', line 96
def profile(icc)
@profile = icc
self
end
|
#quality(value) ⇒ Object
66
67
68
69
|
# File 'lib/libis/format/converter/image_converter.rb', line 66
def quality(value)
@options[:quality] = value
self
end
|
46
47
48
49
|
# File 'lib/libis/format/converter/image_converter.rb', line 46
def quiet(v)
@quiet = !!v
self
end
|
#resample(value) ⇒ Object
76
77
78
79
|
# File 'lib/libis/format/converter/image_converter.rb', line 76
def resample(value)
@options[:resample] = value
self
end
|
#resize(geometry) ⇒ Object
61
62
63
64
|
# File 'lib/libis/format/converter/image_converter.rb', line 61
def resize(geometry)
@options[:resize] = geometry
self
end
|
#scale(percent) ⇒ Object
56
57
58
59
|
# File 'lib/libis/format/converter/image_converter.rb', line 56
def scale(percent)
@options[:scale] = percent
self
end
|