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
-
#initialize(path, options = {}) ⇒ JPEGReader
constructor
Creates a jpeg image file reader.
- #read ⇒ 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
#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 |