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, #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.



78
79
80
81
82
83
84
85
86
# File 'lib/vips/writer.rb', line 78

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.



75
76
77
# File 'lib/vips/writer.rb', line 75

def compression
  @compression
end

#interlaceObject

Returns the value of attribute interlace.



76
77
78
# File 'lib/vips/writer.rb', line 76

def interlace
  @interlace
end

Instance Method Details

#to_memoryObject



92
93
94
# File 'lib/vips/writer.rb', line 92

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

#write(path) ⇒ Object



88
89
90
# File 'lib/vips/writer.rb', line 88

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