Class: Axon::JPEGWriter

Inherits:
Object
  • Object
show all
Includes:
JPEGNativeWriter
Defined in:
lib/axon/jpeg_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from JPEGNativeWriter

#jpeg_native_write

Constructor Details

#initialize(image) ⇒ JPEGWriter

Returns a new instance of JPEGWriter.



10
11
12
13
14
15
# File 'lib/axon/jpeg_writer.rb', line 10

def initialize(image)
  @image = image
  @quality = nil
  @icc_profile = nil
  @exif = nil
end

Instance Attribute Details

#bufsizeObject (readonly)

Returns the value of attribute bufsize.



8
9
10
# File 'lib/axon/jpeg_writer.rb', line 8

def bufsize
  @bufsize
end

#exifObject

Returns the value of attribute exif.



7
8
9
# File 'lib/axon/jpeg_writer.rb', line 7

def exif
  @exif
end

#icc_profileObject

Returns the value of attribute icc_profile.



7
8
9
# File 'lib/axon/jpeg_writer.rb', line 7

def icc_profile
  @icc_profile
end

#imageObject (readonly)

Returns the value of attribute image.



8
9
10
# File 'lib/axon/jpeg_writer.rb', line 8

def image
  @image
end

#ioObject (readonly)

Returns the value of attribute io.



8
9
10
# File 'lib/axon/jpeg_writer.rb', line 8

def io
  @io
end

#qualityObject

Returns the value of attribute quality.



7
8
9
# File 'lib/axon/jpeg_writer.rb', line 7

def quality
  @quality
end

Instance Method Details

#dataObject



23
24
25
26
27
28
29
# File 'lib/axon/jpeg_writer.rb', line 23

def data
  s = StringIO.new
  s.set_encoding 'BINARY' if s.respond_to?(:set_encoding)

  write(s)
  s.string
end

#write(io, bufsize = nil) ⇒ Object



17
18
19
20
21
# File 'lib/axon/jpeg_writer.rb', line 17

def write(io, bufsize = nil)
  @bufsize = bufsize || 512
  @io = io
  jpeg_native_write
end