Class: VIPS::TIFFWriter
- Defined in:
- lib/vips/writer.rb,
ext/writer.c
Constant Summary collapse
- COMPRESSION =
[:none, :jpeg, :deflate, :packbits, :ccittfax4, :lzw]
- PREDICTOR =
[:none, :horizontal_differencing, :floating_point]
- LAYOUT =
[:strip, :tile]
- MULTI_RES =
[:flat, :pyramid]
- FORMAT =
[:manybit, :onebit]
- RESOLUTION_UNITS =
[:cm, :inch]
Instance Attribute Summary collapse
-
#compression ⇒ Object
Returns the value of attribute compression.
-
#format ⇒ Object
Returns the value of attribute format.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#multi_res ⇒ Object
Returns the value of attribute multi_res.
-
#predictor ⇒ Object
Returns the value of attribute predictor.
-
#quality ⇒ Object
Returns the value of attribute quality.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
-
#resolution_units ⇒ Object
Returns the value of attribute resolution_units.
-
#tile_size ⇒ Object
Returns the value of attribute tile_size.
Instance Method Summary collapse
- #compression_str ⇒ Object
-
#initialize(image, options = {}) ⇒ TIFFWriter
constructor
A new instance of TIFFWriter.
- #layout_str ⇒ Object
- #resolution_str ⇒ Object
- #write(path) ⇒ Object
Methods inherited from Writer
#exif=, #icc=, #image, #remove_exif, #remove_icc
Methods included from Header
#band_fmt, #bands, #exif, #exif?, #get, #icc, #icc?, #n_elements, #set, #size, #sizeof_element, #sizeof_line, #sizeof_pel, #x_offset, #x_res, #x_size, #y_offset, #y_res, #y_size
Constructor Details
#initialize(image, options = {}) ⇒ TIFFWriter
Returns a new instance of TIFFWriter.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/vips/writer.rb', line 186 def initialize(image, ={}) super image @compression = :none @quality = 75 @predictor = :none @layout = :strip @tile_size = [128, 128] @multi_res = :flat @format = :manybit @resolution_units = :cm [ :compression, :layout, :multi_res, :format, :resolution_units, :resolution, :predictor, :quality, :tile_size ].each do |att| self.send "#{att}=".to_sym, [att] if .has_key?(att) end end |
Instance Attribute Details
#compression ⇒ Object
Returns the value of attribute compression.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def compression @compression end |
#format ⇒ Object
Returns the value of attribute format.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def format @format end |
#layout ⇒ Object
Returns the value of attribute layout.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def layout @layout end |
#multi_res ⇒ Object
Returns the value of attribute multi_res.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def multi_res @multi_res end |
#predictor ⇒ Object
Returns the value of attribute predictor.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def predictor @predictor end |
#quality ⇒ Object
Returns the value of attribute quality.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def quality @quality end |
#resolution ⇒ Object
Returns the value of attribute resolution.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def resolution @resolution end |
#resolution_units ⇒ Object
Returns the value of attribute resolution_units.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def resolution_units @resolution_units end |
#tile_size ⇒ Object
Returns the value of attribute tile_size.
176 177 178 |
# File 'lib/vips/writer.rb', line 176 def tile_size @tile_size end |
Instance Method Details
#compression_str ⇒ Object
209 210 211 212 213 214 215 |
# File 'lib/vips/writer.rb', line 209 def compression_str case @compression when :jpeg then "#{@compression}:#{@quality}" when :lzw, :deflate then "#{@compression}:#{@predictor}" else @compression end end |
#layout_str ⇒ Object
217 218 219 220 221 |
# File 'lib/vips/writer.rb', line 217 def layout_str s = @layout.to_s s << ":#{@tile_size.join 'x'}" if @layout == :tile s end |
#resolution_str ⇒ Object
223 224 225 226 227 |
# File 'lib/vips/writer.rb', line 223 def resolution_str s = "res_#{@resolution_units}" s << ":#{@resolution.join 'x'}" if @resolution s end |
#write(path) ⇒ Object
204 205 206 207 |
# File 'lib/vips/writer.rb', line 204 def write(path) opts = [compression_str, layout_str, @multi_res, @format, resolution_str].join ',' write_gc "#{path}:#{opts}" end |