Class: VIPS::JPEGReader
- Defined in:
- lib/vips/reader.rb,
ext/reader.c
Constant Summary collapse
- SHRINK_FACTOR =
[1, 2, 4, 8]
Instance Attribute Summary collapse
-
#fail_on_warn ⇒ Object
Returns the value of attribute fail_on_warn.
-
#sequential ⇒ Object
Returns the value of attribute sequential.
-
#shrink_factor ⇒ Object
Returns the value of attribute shrink_factor.
Attributes inherited from Reader
Instance Method Summary collapse
- #b_to_i(b) ⇒ Object
-
#initialize(path, options = {}) ⇒ JPEGReader
constructor
Creates a jpeg image file reader.
- #read ⇒ Object
- #read_buffer ⇒ Object
Methods inherited from Reader
#exif, #exif?, recognized?, #x_size, #y_size
Constructor Details
#initialize(path, options = {}) ⇒ JPEGReader
Creates a jpeg image file reader.
59 60 61 62 63 64 65 |
# File 'lib/vips/reader.rb', line 59 def initialize(path, ={}) @shrink_factor = [:shrink_factor] || 1 @fail_on_warn = [:fail_on_warn] || false @sequential = [:sequential] || false super path, end |
Instance Attribute Details
#fail_on_warn ⇒ Object
Returns the value of attribute fail_on_warn.
53 54 55 |
# File 'lib/vips/reader.rb', line 53 def fail_on_warn @fail_on_warn end |
#sequential ⇒ Object
Returns the value of attribute sequential.
54 55 56 |
# File 'lib/vips/reader.rb', line 54 def sequential @sequential end |
#shrink_factor ⇒ Object
Returns the value of attribute shrink_factor.
52 53 54 |
# File 'lib/vips/reader.rb', line 52 def shrink_factor @shrink_factor end |
Instance Method Details
#b_to_i(b) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/vips/reader.rb', line 82 def b_to_i(b) if b 1 else 0 end end |
#read ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/vips/reader.rb', line 67 def read str = "#{@path}:#{@shrink_factor}" str << "," str << "fail" if @fail_on_warn seq = 0 if VIPS.sequential_mode_supported? str << "," str << "sequential" if @sequential seq = 1 end @_im = read_retry str, seq end |
#read_buffer ⇒ Object
90 91 92 |
# File 'lib/vips/reader.rb', line 90 def read_buffer @_im = buf_internal @path, @shrink_factor, b_to_i(@fail_on_warn) end |