Class: VIPS::PNGWriter

Inherits:
Writer
  • Object
show all
Defined in:
lib/vips/writer.rb,
ext/writer.c

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = {}) ⇒ PNGWriter

Returns a new instance of PNGWriter.



88
89
90
91
92
93
94
95
96
# File 'lib/vips/writer.rb', line 88

def initialize(image, options={})
  super image

  @compression = 6
  @interlace = false

  self.compression = options[:compression] if options.has_key?(:compression)
  self.interlace = options[:interlace] if options.has_key?(:interlace)
end

Instance Attribute Details

#compressionObject

Returns the value of attribute compression.



85
86
87
# File 'lib/vips/writer.rb', line 85

def compression
  @compression
end

#interlaceObject

Returns the value of attribute interlace.



86
87
88
# File 'lib/vips/writer.rb', line 86

def interlace
  @interlace
end

Instance Method Details

#to_memoryObject



102
103
104
# File 'lib/vips/writer.rb', line 102

def to_memory
  buf_internal @compression, (@interlace ? 1 : 0)
end

#write(path) ⇒ Object



98
99
100
# File 'lib/vips/writer.rb', line 98

def write(path)
  write_gc "#{path}:#{@compression},#{@interlace ? 1 : 0}"
end