diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 4fdacec0..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,316 +0,0 @@ -# Changelog - -## master - -## Version 2.1.3 (2021-8-23) - -* fix a gtype size error on win64 [danini-the-panini] - -## Version 2.1.2 (2021-5-3) - -* allow `FFI::Pointer` as an argument to `new_from_memory` etc. [sled] - -## Version 2.1.1 (2021-5-3) - -* fix "mutate" with libvips 8.9 [jcupitt] -* update autodocs for libvips 8.11 [jcupitt] - -## Version 2.1.0 (2021-3-8) - -* add "mutate" system [jcupitt] -* better behaviour with some nil parameters [jcupitt] -* revise gemspec [jcupitt] -* allow symbols for Interpolate.new [noraj] -* update docs for 8.10, fix minor doc formatting issues [jcupitt] -* `new_from_array` checks array argument more carefully [dkam] -* add `new_from_memory` and `new_from_memory_copy` [ankane] -* jruby added to CI testing [pftg] -* switch to github actions for CI [pftg] -* remove rubocop, revise formatting for standardrb [pftg] - -## Version 2.0.17 (2019-10-29) - -* install msys2 libvips on Windows [larskanis] -* better `-` to `_` conversion [Nakilon] -* fix `GValue#set` for stricter metadata rules in 8.9 [jcupitt] -* fix a ref leak on operation build error [jcupitt] -* faster operation call [jcupitt] -* add support for VipsConnection [jcupitt] -* add `signal_connect` [jcupitt] -* add `Image#set_kill` for progress termination [jcupitt] - -## Version 2.0.16 (2019-9-21) - -* better library name generation [renchap] -* allow `_` as a separator in enum names [D-W-L] -* add `Vips::Region` and `Region#fetch` [jcupitt] - -## Version 2.0.15 (2019-6-12) - -* better error messages from `write_to_memory` [linkyndy] -* fix doc generation typo for array return [jcupitt] -* update tests for libvips 8.8 [jcupitt] - -## Version 2.0.14 (2018-10-3) - -* update links for new home [jcupitt] -* various doc fixes [janko-m] -* add `Vips::get_suffixes` [jcupitt] -* prefer options splat [ioquatix] -* update docs for 8.8 [jcupitt] - -## Version 2.0.13 (2018-8-6) - -* allow optional args to have `nil` as a value [janko-m] -* fix five small memleaks [kleisauke] - -## Version 2.0.12 (2018-4-25) - -* fix `Vips::Image#has_alpha?` with older libvips [larskanis] - -## Version 2.0.11 (2018-4-23) - -* fix init with older glib [lsat12357] -* add `Vips::Image#has_alpha?` and `#add_alpha` [aried3r] - -## Version 2.0.10 (2017-12-21) - -* add support for uint64 parameters -* add `draw_point` convenience method -* add docs for `CompassDirection` [janko-m] -* add `MAX_COORD` constant -* doc fixes [janko-m] -* remove duplicate function attach [janko-m] -* fix a crash with `new_from_buffer` with a UTF-8 string [janko-m] - -## Version 2.0.9 (2017-12-21) - -* update docs for libvips 8.6 - -## Version 2.0.8 (2017-09-14) - -* add `thumb.rb` example, and verify we run stably and in constant memory -* cleanups and polish [Nakilon] -* add `composite` convenience method -* add `Vips::concurrency_set` and `Vips::vector_set` - -## Version 2.0.7 (2017-09-08) - -* disable the logging for now, it could deadlock - -## Version 2.0.6 (2017-09-02) - -* improve get() behaviour on error with older libvipses - -## Version 2.0.5 (2017-09-02) - -* fix get() with older libvipses - -## Version 2.0.4 (2017-09-02) - -* add a test for `get_fields`, since it appeared in libvips 8.5 (thanks zverok) - -## Version 2.0.3 (2017-09-02) - -* add `get_fields` - -## Version 2.0.2 (2017-08-26) - -* switch to `logger` for all logging output -* add libvips cache control functions `Vips::cache_set_max()` etc. -* fix a ref leak - -## Version 2.0.1 (2017-08-23) - -* add support for `VipsRefStr` in gvalue, thanks tomasc - -## Version 2.0.0 (2017-08-22) - -* rewrite on top of 'ffi' [John Cupitt, Kleis Auke Wolthuizen] - -## Version 1.0.6 (2017-07-17) - -* remove lazy load, fixing a race with multi-threading [felixbuenemann] -* make `Image#to_a` much faster [John Cupitt] -* remove the `at_exit` handler [John Cupitt] - -## Version 1.0.5 (2017-04-29) - -* fix `_const` for libvips 8.5 [John Cupitt] -* add `scaleimage`, the scale operation renamed to avoid a clash with the - `scale` property [John Cupitt] -* add `.new_from_image`: make a new image from a constant [John Cupitt] -* `bandjoin` will use `bandjoin_const`, if it can [John Cupitt] -* update generated docs for libvips 8.5 [John Cupitt] -* added docs for new libvips 8.5 enums [John Cupitt] - -## Version 1.0.4 (2017-02-07) - -* remove stray comma from some docs lines [John Cupitt] -* update generated docs for libvips 8.5 [John Cupitt] -* small doc improvements [John Cupitt] -* update for gobject-introspection 3.1 [John Cupitt] -* support ruby 2.4 [John Cupitt] - -## Version 1.0.3 (2016-08-18) - -* doc improvements [John Cupitt] -* add `Image#size` to get `[width, height]` [John Cupitt] -* only ask for ruby 2.0 to help OS X [John Cupitt] -* break up `Image.call` to make it easier to understand [John Cupitt] -* detect operation build fail correctly [John Cupitt] -* lock gobject-introspection at 3.0.8 to avoid breakage [John Cupitt] - -## Version 1.0.2 (2016-07-07) - -* add `.yardopts` to fix ruby-gems docs [John Cupitt] - -## Version 1.0.1 (2016-07-07) - -* simplify gemspec [sandstrom] -* remove jeweler dependency [John Cupitt] -* add `.to_a` to Image [John Cupitt] - -## Version 1.0.0 (2016-06-07) - -* complete rewrite, API break [John Cupitt] - -## Version 0.3.14 (2016-01-25) - -* more GC tuning [felixbuenemann] -* add `write.rb` example program [felixbuenemann] - -## Version 0.3.13 (2016-01-18) - -* don't use generational GC options on old Rubys [John Cupitt] - -## Version 0.3.12 (2016-01-17) - -* incremental GC every 10 writes [felixbuenemann] -* updated bundle [John Cupitt] - -## Version 0.3.11 (2015-10-15) - -* added magick load from buffer [John Cupitt] - -## Version 0.3.10 (2015-06-24) - -* added webp write [John Cupitt] - -## Version 0.3.9 (2014-07-17) - -* removed a stray file from gemspec [Alessandro Tagliapietra] -* updated bundle [John Cupitt] -* revised spec tests [John Cupitt] -* fix a segv in im.label_regions [John Cupitt] -* add a Valgrind suppressions file [John Cupitt] -* fix .monotonic? [John Cupitt] -* fix .data on coded images [John Cupitt] -* add .size, see issue #58 [John Cupitt] -* add rdoc-data dep, maybe it will help ruby-gems docs [John Cupitt] - -## Version 0.3.8 (2014-05-11) - -* add VIPS::thread_shutdown(), must be called on foreign thread exit [John Cupitt] - -## Version 0.3.7 (2014-02-04) - -* update build dependencies [John Cupitt] -* README updated [John Cupitt] - -## Version 0.3.6 (2013-06-25) - -* add png and jpg load from memory buffer [John Cupitt] -* README updated to include buffer read/write example [John Cupitt] -* better vips version testing [John Cupitt] -* spec tests for new buffer read/write code [John Cupitt] -* fix rdoc build to include C sources [John Cupitt] -* better compat with older libvips [John Cupitt] - -## Version 0.3.5 (2013-01-15) - -* rb_raise() in mask.c no longer passes a string pointer as the fmt arg, stopping gcc bailing out on some platforms [John Cupitt] -* Image.magick() now calls im_magick2vips() directly rather than relying on libvips file type sniffing [John Cupitt] - -## Version 0.3.4 (2012-09-11) - -* Update specs for lcms changes, thanks Stanislaw [John Cupitt] -* VIPS::Reader supports .exif() / .exif?() methods for better back compat, thanks Jeremy [John Cupitt] -* VIPS::Reader fallbacks load the image if its not been loaded [John Cupitt] -* VIPS::Reader no longer allows VIPS::Header methods [John Cupitt] - -## Version 0.3.3 (2012-08-31) - -* Typo in workaround in 0.3.2 [John Cupitt] - -## Version 0.3.2 (2012-08-31) - -### Fixed - -* Workaround helps ruby-vips compile (and run) against 7.26.3 [John Cupitt and -James Harrison] - -## Version 0.3.1 (2012-08-30) - -### Fixed - -* PNG writer no longer changes the filename argument [John Cupitt] -* Workaround helps ruby-vips compile against 7.26.3 [John Cupitt] -* Image read now runs GC and retries on fail [John Cupitt] -* Image write GCs every 100 images [John Cupitt] - -## Version 0.3.0 (2012-07-20) - -### Added - -* More rspec tests [John Cupitt] -* Updated to libvips-7.30 [John Cupitt] - -### Changed - -* Reworked Reader class offers better performance and compatibility [John - Cupitt] -* Don't use :sequential option for older libvipses [John Cupitt] -* Rename "tone_analyze" as "tone_analyse" for consistency with the rest of - vips [John CUpitt] - -### Fixed - -* Now passes rspec test suite cleanly in valgrind [John Cupitt] -* Fixed check of sequential mode support [Stanislaw Pankevich] - -## Version 0.2.0 (2012-06-29) - -### Added - -* Add tile_cache [John Cupitt] -* Add :sequential option to tiff, jpeg and png readers [John Cupitt] -* Add raise if suitable pkg_config for libvips is not found, thanks to Pierre - Chapuis [Stanislaw Pankevich] -* Add backward compatibility of 0.1.x ruby-vips with libvips versions less than 7.28 [John Cupitt] -* Add Travis. ruby-vips now is being tested on travis-ci.org. [Stanislaw Pankevich] - -### Changed - -* Disable the vips8 operation cache to save some memory [John Cupitt] -* Update example shrinker [John Cupitt] - -### Fixed - -* #8: Memory allocation-free issues [Grigoriy Chudnov] - -## Version 0.1.1 (2012-06-22) - -### Changed - -* Upgrade spec/* code to latest RSpec [Stanislaw Pankevich] - -### Added - -* Added CHANGELOG.md file (thanks to jnicklas/capybara - using the layout of their History.txt) [Stanislaw Pankevich] -* Added Gemfile with the only 'rspec' dependency. [Stanislaw Pankevich] -* Added Jeweler Rakefile contents to release ruby-vips as a gem. [Stanislaw Pankevich] - -## Before (initial unreleased version 0.1.0) - -Long-long history here undocumented... diff --git a/GLib.html b/GLib.html new file mode 100644 index 00000000..5206d5f2 --- /dev/null +++ b/GLib.html @@ -0,0 +1,523 @@ + + + + + + + Module: GLib + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: GLib + + + +

+
+ + + + +
+
Extended by:
+
FFI::Library
+
+ + + + + + + + +
+
Defined in:
+
lib/vips.rb
+
+ +
+ + + +

+ Constant Summary + collapse +

+ +
+ +
G_FREE = +
+
+ +

save the FFI::Function that attach will return … we can use it directly as a param for callbacks

+ + +
+
+
+ + +
+
+
attach_function :g_free, [:pointer], :void
+ +
LOG_FLAG_RECURSION = +
+
+ +

log flags

+ + +
+
+
+ + +
+
+
1 << 0
+ +
LOG_FLAG_FATAL = + +
+
1 << 1
+ +
LOG_LEVEL_ERROR = +
+
+ +

GLib log levels

+ + +
+
+
+ + +
+
+
1 << 2
+ +
LOG_LEVEL_CRITICAL = +
+
+ +

always fatal

+ + +
+
+
+ + +
+
+
1 << 3
+ +
LOG_LEVEL_WARNING = + +
+
1 << 4
+ +
LOG_LEVEL_MESSAGE = + +
+
1 << 5
+ +
LOG_LEVEL_INFO = + +
+
1 << 6
+ +
LOG_LEVEL_DEBUG = + +
+
1 << 7
+ +
GLIB_TO_SEVERITY = +
+
+ +

map glib levels to Logger::Severity

+ + +
+
+
+ + +
+
+
{
+  LOG_LEVEL_ERROR => Logger::ERROR,
+  LOG_LEVEL_CRITICAL => Logger::FATAL,
+  LOG_LEVEL_WARNING => Logger::WARN,
+  LOG_LEVEL_MESSAGE => Logger::UNKNOWN,
+  LOG_LEVEL_INFO => Logger::INFO,
+  LOG_LEVEL_DEBUG => Logger::DEBUG
+}
+ +
LOG_HANDLER = +
+
+ +

module-level, so it's not GCd away

+ + +
+
+
+ + +
+
+
proc { |domain, level, message, _user_data|
+  @logger.log(GLIB_TO_SEVERITY[level], message, domain)
+}
+ +
+ + + + + +

Class Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Attribute Details

+ + + +
+

+ + .loggerObject + + + + + +

+
+ +

Returns the value of attribute logger.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+38
+39
+40
+
+
# File 'lib/vips.rb', line 38
+
+def logger
+  @logger
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .remove_log_handlerObject + + + + + +

+ + + + +
+
+
+
+90
+91
+92
+93
+94
+95
+
+
# File 'lib/vips.rb', line 90
+
+def self.remove_log_handler
+  if @glib_log_handler_id != 0 && @glib_log_domain
+    g_log_remove_handler @glib_log_domain, @glib_log_handler_id
+    @glib_log_handler_id = nil
+  end
+end
+
+
+ +
+

+ + .set_log_domain(domain) ⇒ Object + + + + + +

+ + + + +
+
+
+
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+
+
# File 'lib/vips.rb', line 97
+
+def self.set_log_domain domain
+  GLib.remove_log_handler
+
+  @glib_log_domain = domain
+
+  # forward all glib logging output from this domain to a Ruby logger
+  if @glib_log_domain
+    # disable this feature for now
+    #
+    # libvips background worker threads can issue warnings, and
+    # since the main thread is blocked waiting for libvips to come back
+    # from an ffi call, you get a deadlock on the GIL
+    #
+    # to fix this, we need a way for g_log() calls from libvips workers
+    # to be returned via the main thread
+    #
+
+    #             @glib_log_handler_id = g_log_set_handler @glib_log_domain,
+    #                 LOG_LEVEL_DEBUG |
+    #                 LOG_LEVEL_INFO |
+    #                 LOG_LEVEL_MESSAGE |
+    #                 LOG_LEVEL_WARNING |
+    #                 LOG_LEVEL_ERROR |
+    #                 LOG_LEVEL_CRITICAL |
+    #                 LOG_FLAG_FATAL | LOG_FLAG_RECURSION,
+    #                 LOG_HANDLER, nil
+
+    # we must remove any handlers on exit, since libvips may log stuff
+    # on shutdown and we don't want LOG_HANDLER to be invoked
+    # after Ruby has gone
+    at_exit {
+      GLib.remove_log_handler
+    }
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/GObject.html b/GObject.html new file mode 100644 index 00000000..d3811e15 --- /dev/null +++ b/GObject.html @@ -0,0 +1,185 @@ + + + + + + + Module: GObject + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: GObject + + + +

+
+ + + + +
+
Extended by:
+
FFI::Library
+
+ + + + + + + + +
+
Defined in:
+
lib/vips.rb,
+ lib/vips/gvalue.rb,
lib/vips/gobject.rb
+
+
+ +
+ +

Defined Under Namespace

+

+ + + + + Classes: GObject, GParamSpec, GParamSpecPtr, GValue + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
GBOOL_TYPE = +
+
+ +

look up some common gtypes

+ + +
+
+
+ + +
+
+
g_type_from_name "gboolean"
+ +
GINT_TYPE = + +
+
g_type_from_name "gint"
+ +
GUINT64_TYPE = + +
+
g_type_from_name "guint64"
+ +
GDOUBLE_TYPE = + +
+
g_type_from_name "gdouble"
+ +
GENUM_TYPE = + +
+
g_type_from_name "GEnum"
+ +
GFLAGS_TYPE = + +
+
g_type_from_name "GFlags"
+ +
GSTR_TYPE = + +
+
g_type_from_name "gchararray"
+ +
GOBJECT_TYPE = + +
+
g_type_from_name "GObject"
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/GObject/GObject.html b/GObject/GObject.html new file mode 100644 index 00000000..787e3c80 --- /dev/null +++ b/GObject/GObject.html @@ -0,0 +1,680 @@ + + + + + + + Class: GObject::GObject + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: GObject::GObject + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + +
+
Extended by:
+
Forwardable, SingleForwardable
+
+ + + + + + + + +
+
Defined in:
+
lib/vips/gobject.rb
+
+ +
+ +

Overview

+
+ +

we have a number of things we need to inherit in different ways:

+
  • +

    we want to be able to subclass GObject in Ruby in a simple way

    +
  • +

    the layouts of the nested structs need to inherit

    +
  • +

    we need to be able to cast between structs which share a base struct without creating new wrappers or messing up refcounting

    +
  • +

    we need automatic gobject refcounting

    +
+ +

the solution is to split the class into four areas which we treat differently:

+
  • +

    we have a “wrapper” Ruby class to allow easy subclassing … this has a @struct member which holds the actual pointer

    +
  • +

    we use “forwardable” to forward the various ffi methods on to the @struct member … we arrange things so that subclasses do not need to do the forwarding themselves

    +
  • +

    we have two versions of the struct: a plain one which we can use for casting that will not change the refcounts

    +
  • +

    and a managed one with an unref which we just use for .new

    +
  • +

    we separate the struct layout into a separate module to avoid repeating ourselves

    +
+ + +
+
+
+ + +
+

Direct Known Subclasses

+

Vips::Object

+
+

Defined Under Namespace

+

+ + + Modules: GObjectLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + +
+

Constructor Details

+ +
+

+ + #initialize(ptr) ⇒ GObject + + + + + +

+
+ +

don't allow ptr == nil, we never want to allocate a GObject struct ourselves, we just want to wrap GLib-allocated GObjects

+ +

here we use ManagedStruct, not Struct, since this is the ref that will need the unref

+ + +
+
+
+ + +
+ + + + +
+
+
+
+75
+76
+77
+78
+79
+80
+81
+82
+
+
# File 'lib/vips/gobject.rb', line 75
+
+def initialize ptr
+  # GLib::logger.debug("GObject::GObject.initialize") {"ptr = #{ptr}"}
+  @ptr = ptr
+  @struct = ffi_managed_struct.new ptr
+
+  # sometimes we need to keep refs across C calls ... hide them here
+  @references = []
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #ptrObject (readonly) + + + + + +

+
+ +

get the pointer we were built from … #to_ptr gets the pointer after we have wrapped it up with an auto unref

+ + +
+
+
+ + +
+ + + + +
+
+
+
+91
+92
+93
+
+
# File 'lib/vips/gobject.rb', line 91
+
+def ptr
+  @ptr
+end
+
+
+ + + +
+

+ + #referencesObject (readonly) + + + + + +

+
+ +

Returns the value of attribute references.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+40
+41
+42
+
+
# File 'lib/vips/gobject.rb', line 40
+
+def references
+  @references
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .ffi_managed_structObject + + + + + +

+ + + + +
+
+
+
+105
+106
+107
+
+
# File 'lib/vips/gobject.rb', line 105
+
+def ffi_managed_struct
+  const_get :ManagedStruct
+end
+
+
+ +
+

+ + .ffi_structObject + + + + + +

+ + + + +
+
+
+
+94
+95
+96
+
+
# File 'lib/vips/gobject.rb', line 94
+
+def ffi_struct
+  const_get :Struct
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #ffi_managed_structObject + + + + + +

+
+ +

access to the managed struct for this class

+ + +
+
+
+ + +
+ + + + +
+
+
+
+100
+101
+102
+
+
# File 'lib/vips/gobject.rb', line 100
+
+def ffi_managed_struct
+  self.class.ffi_managed_struct
+end
+
+
+ +
+

+ + #ffi_structObject + + + + + +

+
+ +

access to the casting struct for this class

+ + +
+
+
+ + +
+ + + + +
+
+
+
+85
+86
+87
+
+
# File 'lib/vips/gobject.rb', line 85
+
+def ffi_struct
+  self.class.ffi_struct
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/GObject/GObject/GObjectLayout.html b/GObject/GObject/GObjectLayout.html new file mode 100644 index 00000000..1adbba65 --- /dev/null +++ b/GObject/GObject/GObjectLayout.html @@ -0,0 +1,198 @@ + + + + + + + Module: GObject::GObject::GObjectLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: GObject::GObject::GObjectLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/gobject.rb
+
+ +
+ +

Overview

+
+ +

the layout of the GObject struct

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+
+
# File 'lib/vips/gobject.rb', line 44
+
+def self.included base
+  base.class_eval do
+    layout :g_type_instance, :pointer,
+      :ref_count, :uint,
+      :qdata, :pointer
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/GObject/GObject/ManagedStruct.html b/GObject/GObject/ManagedStruct.html new file mode 100644 index 00000000..9f266670 --- /dev/null +++ b/GObject/GObject/ManagedStruct.html @@ -0,0 +1,230 @@ + + + + + + + Class: GObject::GObject::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: GObject::GObject::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ FFI::ManagedStruct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
GObjectLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/gobject.rb
+
+ +
+ +

Overview

+
+ +

the struct with unref … manage object lifetime with this

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

Vips::Object::ManagedStruct

+
+ + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods included from GObjectLayout

+

included

+ + + +
+

Class Method Details

+ + +
+

+ + .release(ptr) ⇒ Object + + + + + +

+ + + + +
+
+
+
+57
+58
+59
+60
+61
+62
+
+
# File 'lib/vips/gobject.rb', line 57
+
+def self.release ptr
+  # GLib::logger.debug("GObject::GObject::ManagedStruct.release") {
+  #     "unreffing #{ptr}"
+  # }
+  ::GObject.g_object_unref ptr
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/GObject/GObject/Struct.html b/GObject/GObject/Struct.html new file mode 100644 index 00000000..c31309d9 --- /dev/null +++ b/GObject/GObject/Struct.html @@ -0,0 +1,155 @@ + + + + + + + Class: GObject::GObject::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: GObject::GObject::Struct + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + +
+
Includes:
+
GObjectLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/gobject.rb
+
+ +
+ +

Overview

+
+ +

the plain struct … cast with this

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

Vips::Object::Struct

+
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/GObject/GParamSpec.html b/GObject/GParamSpec.html new file mode 100644 index 00000000..1187518f --- /dev/null +++ b/GObject/GParamSpec.html @@ -0,0 +1,124 @@ + + + + + + + Class: GObject::GParamSpec + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: GObject::GParamSpec + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/gobject.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/GObject/GParamSpecPtr.html b/GObject/GParamSpecPtr.html new file mode 100644 index 00000000..3b88c586 --- /dev/null +++ b/GObject/GParamSpecPtr.html @@ -0,0 +1,124 @@ + + + + + + + Class: GObject::GParamSpecPtr + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: GObject::GParamSpecPtr + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/gobject.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/GObject/GValue.html b/GObject/GValue.html new file mode 100644 index 00000000..72e59f13 --- /dev/null +++ b/GObject/GValue.html @@ -0,0 +1,1114 @@ + + + + + + + Class: GObject::GValue + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: GObject::GValue + + + +

+
+ +
+
Inherits:
+
+ FFI::ManagedStruct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/gvalue.rb
+
+ +
+ +

Overview

+
+ +

Represent a GValue. Example use:

+ +
gvalue = GValue::alloc
+gvalue.init GObject::GDOUBLE_TYPE
+gvalue.set 3.1415
+value = gvalue.get
+# optional -- drop any ref the gvalue had
+gvalue.unset
+
+ +

Lifetime is managed automatically. It doesn't know about all GType values, but it does know the ones that libvips uses.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + +
+

Class Method Details

+ + +
+

+ + .allocGValue + + + + + +

+
+ +

Allocate memory for a GValue and return a class wrapper. Memory will be freed automatically when it goes out of scope. The GValue is inited to 0, use #init to set a type.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (GValue) + + + + — +
    +

    a new gvalue set to 0

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+
+
# File 'lib/vips/gvalue.rb', line 63
+
+def self.alloc
+  # allocate memory
+  memory = FFI::MemoryPointer.new GValue
+
+  # make this alloc autorelease ... we mustn't release in
+  # GValue::release, since we are used to wrap GValue pointers
+  # made by other people
+  pointer = FFI::Pointer.new GValue, memory
+
+  # ... and wrap in a GValue
+  GValue.new pointer
+end
+
+
+ +
+

+ + .from_nick(gtype, value) ⇒ Object + + + + + +

+
+ +

convert an enum value (str/symb/int) into an int ready for libvips

+ + +
+
+
+ + +
+ + + + +
+
+
+
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+
+
# File 'lib/vips/gvalue.rb', line 28
+
+def self.from_nick(gtype, value)
+  value = value.to_s if value.is_a? Symbol
+
+  if value.is_a? String
+    # libvips expects "-" as a separator in enum names, but "_" is more
+    # convenient for ruby, eg. :b_w
+    value = Vips.vips_enum_from_nick "ruby-vips", gtype, value.tr("_", "-")
+    if value == -1
+      raise Vips::Error
+    end
+  end
+
+  value
+end
+
+
+ +
+

+ + .release(ptr) ⇒ Object + + + + + +

+ + + + +
+
+
+
+53
+54
+55
+56
+
+
# File 'lib/vips/gvalue.rb', line 53
+
+def self.release ptr
+  # GLib::logger.debug("GObject::GValue::release") {"ptr = #{ptr}"}
+  ::GObject.g_value_unset ptr
+end
+
+
+ +
+

+ + .to_nick(gtype, enum_value) ⇒ Object + + + + + +

+
+ +

convert an int enum back into a symbol

+ + +
+
+
+ + +
+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/vips/gvalue.rb', line 44
+
+def self.to_nick(gtype, enum_value)
+  enum_name = Vips.vips_enum_nick gtype, enum_value
+  if enum_name.nil?
+    raise Vips::Error
+  end
+
+  enum_name.to_sym
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #getAny + + + + + +

+
+ +

Get the value of a GValue. The value is converted to a Ruby type in the obvious way.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Any) + + + + — +
    +

    the value held by the GValue

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+
+
# File 'lib/vips/gvalue.rb', line 171
+
+def get
+  gtype = self[:gtype]
+  fundamental = ::GObject.g_type_fundamental gtype
+  result = nil
+
+  case gtype
+  when GBOOL_TYPE
+    result = ::GObject.g_value_get_boolean(self) != 0
+
+  when GINT_TYPE
+    result = ::GObject.g_value_get_int self
+
+  when GUINT64_TYPE
+    result = ::GObject.g_value_get_uint64 self
+
+  when GDOUBLE_TYPE
+    result = ::GObject.g_value_get_double self
+
+  when GSTR_TYPE
+    result = ::GObject.g_value_get_string self
+
+  when Vips::REFSTR_TYPE
+    len = Vips::SizeStruct.new
+    result = ::Vips.vips_value_get_ref_string self, len
+
+  when Vips::ARRAY_INT_TYPE
+    len = Vips::IntStruct.new
+    array = Vips.vips_value_get_array_int self, len
+    result = array.get_array_of_int32 0, len[:value]
+
+  when Vips::ARRAY_DOUBLE_TYPE
+    len = Vips::IntStruct.new
+    array = Vips.vips_value_get_array_double self, len
+    result = array.get_array_of_double 0, len[:value]
+
+  when Vips::ARRAY_IMAGE_TYPE
+    len = Vips::IntStruct.new
+    array = Vips.vips_value_get_array_image self, len
+    result = array.get_array_of_pointer 0, len[:value]
+    result.map! do |pointer|
+      ::GObject.g_object_ref pointer
+      Vips::Image.new pointer
+    end
+
+  when Vips::BLOB_TYPE
+    len = Vips::SizeStruct.new
+    array = Vips.vips_value_get_blob self, len
+    result = array.get_bytes 0, len[:value]
+
+  else
+    case fundamental
+    when GFLAGS_TYPE
+      result = ::GObject.g_value_get_flags self
+
+    when GENUM_TYPE
+      enum_value = ::GObject.g_value_get_enum(self)
+      result = GValue.to_nick self[:gtype], enum_value
+
+    when GOBJECT_TYPE
+      obj = ::GObject.g_value_get_object self
+      # g_value_get_object() does not add a ref ... we need to add
+      # one to match the unref in gobject release
+      ::GObject.g_object_ref obj
+      result = Vips::Image.new obj
+
+    else
+      raise Vips::Error, "unimplemented gtype for get: " \
+        "#{::GObject.g_type_name gtype} (#{gtype})"
+    end
+  end
+
+  # GLib::logger.debug("GObject::GValue.get") {
+  #     "result = #{result.inspect[0..50]}"
+  # }
+
+  result
+end
+
+
+ +
+

+ + #init(gtype) ⇒ Object + + + + + +

+
+ +

Set the type of thing a gvalue can hold.

+ + +
+
+
+

Parameters:

+
    + +
  • + + gtype + + + (GType) + + + + — +
    +

    the type of thing this GValue can hold.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+79
+80
+81
+
+
# File 'lib/vips/gvalue.rb', line 79
+
+def init gtype
+  ::GObject.g_value_init self, gtype
+end
+
+
+ +
+

+ + #set(value) ⇒ Object + + + + + +

+
+ +

Set the value of a GValue. The value is converted to the type of the GValue, if possible.

+ + +
+
+
+

Parameters:

+
    + +
  • + + value + + + (Any) + + + + — +
    +

    The value to set

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+
+
# File 'lib/vips/gvalue.rb', line 87
+
+def set value
+  # GLib::logger.debug("GObject::GValue.set") {
+  #     "value = #{value.inspect[0..50]}"
+  # }
+
+  gtype = self[:gtype]
+  fundamental = ::GObject.g_type_fundamental gtype
+
+  case gtype
+  when GBOOL_TYPE
+    ::GObject.g_value_set_boolean self, (value ? 1 : 0)
+
+  when GINT_TYPE
+    ::GObject.g_value_set_int self, value
+
+  when GUINT64_TYPE
+    ::GObject.g_value_set_uint64 self, value
+
+  when GDOUBLE_TYPE
+    ::GObject.g_value_set_double self, value
+
+  when GSTR_TYPE
+    ::GObject.g_value_set_string self, value
+
+  when Vips::REFSTR_TYPE
+    ::Vips.vips_value_set_ref_string self, value
+
+  when Vips::ARRAY_INT_TYPE
+    value = [value] unless value.is_a? Array
+
+    Vips.vips_value_set_array_int self, nil, value.length
+    ptr = Vips.vips_value_get_array_int self, nil
+    ptr.write_array_of_int32 value
+
+  when Vips::ARRAY_DOUBLE_TYPE
+    value = [value] unless value.is_a? Array
+
+    # this will allocate an array in the gvalue
+    Vips.vips_value_set_array_double self, nil, value.length
+
+    # pull the array out and fill it
+    ptr = Vips.vips_value_get_array_double self, nil
+
+    ptr.write_array_of_double value
+
+  when Vips::ARRAY_IMAGE_TYPE
+    value = [value] unless value.is_a? Array
+
+    Vips.vips_value_set_array_image self, value.length
+    ptr = Vips.vips_value_get_array_image self, nil
+    ptr.write_array_of_pointer value
+
+    # the gvalue needs a ref on each of the images
+    value.each { |image| ::GObject.g_object_ref image }
+
+  when Vips::BLOB_TYPE
+    len = value.bytesize
+    ptr = GLib.g_malloc len
+    Vips.vips_value_set_blob self, GLib::G_FREE, ptr, len
+    ptr.write_bytes value
+
+  else
+    case fundamental
+    when GFLAGS_TYPE
+      ::GObject.g_value_set_flags self, value
+
+    when GENUM_TYPE
+      enum_value = GValue.from_nick(self[:gtype], value)
+      ::GObject.g_value_set_enum self, enum_value
+
+    when GOBJECT_TYPE
+      ::GObject.g_value_set_object self, value
+
+    else
+      raise Vips::Error, "unimplemented gtype for set: " \
+        "#{::GObject.g_type_name gtype} (#{gtype})"
+    end
+  end
+end
+
+
+ +
+

+ + #unsetObject + + + + + +

+
+ +

Clear the thing held by a GValue.

+ +

This happens automatically when a GValue is GCed, but this method can be handy if you need to drop a reference explicitly for some reason.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+253
+254
+255
+
+
# File 'lib/vips/gvalue.rb', line 253
+
+def unset
+  ::GObject.g_value_unset self
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 2442dde9..00000000 --- a/Gemfile +++ /dev/null @@ -1,6 +0,0 @@ -source "https://rubygems.org" - -# all gems are handled by .gemspec (since this repo is for a gem) -gemspec - -gem "github-markup" diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 619fc1e0..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2014 John Cupitt - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 22f05a19..00000000 --- a/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# ruby-vips - -[![Gem Version](https://badge.fury.io/rb/ruby-vips.svg)](https://badge.fury.io/rb/ruby-vips) -[![Test](https://github.com/libvips/ruby-vips/workflows/Test/badge.svg)](https://github.com/libvips/ruby-vips/actions?query=workflow%3ATest) - -This gem is a Ruby binding for the [libvips image processing -library](https://libvips.github.io/libvips). - -libvips is a [demand-driven, horizontally -threaded](https://github.com/libvips/libvips/wiki/Why-is-libvips-quick) -image processing library. Compared to similar -libraries, [libvips runs quickly and uses little -memory](https://github.com/libvips/libvips/wiki/Speed-and-memory-use). -libvips is licensed under the [LGPL -2.1+](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html). - -## Requirements - - * macOS, Linux, and Windows tested - - * libvips 8.2 or later, see the [libvips install instructions](https://libvips.github.io/libvips/install.html) - - * [ruby-ffi](https://github.com/ffi/ffi) 1.9 or later - - * Ruby 2.0+, JRuby - -## Install - -[Install libvips](https://libvips.github.io/libvips/install.html), then: - -``` -$ gem install ruby-vips -``` - -or include it in `Gemfile`: - -```ruby -gem "ruby-vips" -``` - -On Windows, you'll need to set the `RUBY_DLL_PATH` environment variable to -point to the libvips bin directory. - -# Example - -```ruby -require "vips" - -im = Vips::Image.new_from_file filename - -# put im at position (100, 100) in a 3000 x 3000 pixel image, -# make the other pixels in the image by mirroring im up / down / -# left / right, see -# https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-embed -im = im.embed 100, 100, 3000, 3000, extend: :mirror - -# multiply the green (middle) band by 2, leave the other two alone -im *= [1, 2, 1] - -# make an image from an array constant, convolve with it -mask = Vips::Image.new_from_array [ - [-1, -1, -1], - [-1, 16, -1], - [-1, -1, -1]], 8 -im = im.conv mask, precision: :integer - -# finally, write the result back to a file on disk -im.write_to_file output_filename -``` - -The `Vips` section in the API docs has a [tutorial introduction with -examples](https://www.rubydoc.info/gems/ruby-vips/Vips). - -ruby-vips has [API - documentation](http://www.rubydoc.info/gems/ruby-vips). The [libvips - reference manual](https://libvips.github.io/libvips/API/current/) has a - complete explanation of every method. - -The -[`example/`](https://github.com/libvips/ruby-vips/tree/master/example) -directory has some simple example programs. - -# Benchmarks - -The benchmark at [vips-benchmarks](https://github.com/jcupitt/vips-benchmarks) -loads a large image, crops, shrinks, sharpens and saves again, and repeats -10 times. - -```text -real time in seconds, fastest of five runs -benchmark tiff jpeg -ruby-vips.rb 0.85 0.78 -image-magick 2.03 2.44 -rmagick.rb 3.87 3.89 - -peak memory use in kb -benchmark peak RES -ruby-vips.rb 43864 -rmagick.rb 788768 -``` - -See also [benchmarks at the official libvips -website](https://github.com/libvips/libvips/wiki/Speed-and-memory-use). - diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 27575b90..00000000 --- a/Rakefile +++ /dev/null @@ -1,27 +0,0 @@ -require "bundler/gem_tasks" - -begin - Bundler.setup(:default, :development) -rescue Bundler::BundlerError => e - warn e.message - warn "Run `bundle install` to install missing gems" - exit e.status_code -end - -require "rake" - -require "rspec/core" -require "rspec/core/rake_task" -RSpec::Core::RakeTask.new(:spec) do |spec| - spec.pattern = FileList["spec/**/*_spec.rb"] -end - -task default: :spec - -unless RUBY_PLATFORM.include?("java") - require "github/markup" - require "yard" - require "yard/rake/yardoc_task" - - YARD::Rake::YardocTask.new -end diff --git a/TODO b/TODO deleted file mode 100644 index 5f19a37d..00000000 --- a/TODO +++ /dev/null @@ -1,44 +0,0 @@ -# Notes - -- We should support complex constants, eg: - - Complex(1, 2) - => (1+2i) - -# Common operations - -- Lint. - - bundle exec standardrb - -- Reinstall local copy of gem after a change. - - bundle exec rake install - -- Run test suite. - - bundle exec rake - -- Version bump. - - edit lib/vips/version.rb - edit VERSION - -- Regenerate autodocs. - - cd lib/vips - ruby > methods.rb - require "vips"; Vips::Yard.generate - ^D - -- Regenerate docs. - - bundle exec rake yard - -- Push new gem to rubygems, tag repository with version. - - gem signin --otp 111111 - bundle exec rake release - - The otp is from authy / google authenticator / etc. - diff --git a/VERSION b/VERSION deleted file mode 100644 index ac2cdeba..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.1.3 diff --git a/Vips.html b/Vips.html new file mode 100644 index 00000000..c89655e6 --- /dev/null +++ b/Vips.html @@ -0,0 +1,1201 @@ + + + + + + + Module: Vips + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips + + + +

+
+ + + + +
+
Extended by:
+
FFI::Library
+
+ + + + + + + + +
+
Defined in:
+
lib/vips.rb,
+ lib/vips/size.rb,
lib/vips/align.rb,
lib/vips/angle.rb,
lib/vips/image.rb,
lib/vips/image.rb,
lib/vips/access.rb,
lib/vips/coding.rb,
lib/vips/extend.rb,
lib/vips/kernel.rb,
lib/vips/object.rb,
lib/vips/region.rb,
lib/vips/source.rb,
lib/vips/target.rb,
lib/vips/angle45.rb,
lib/vips/methods.rb,
lib/vips/version.rb,
lib/vips/direction.rb,
lib/vips/operation.rb,
lib/vips/bandformat.rb,
lib/vips/blend_mode.rb,
lib/vips/connection.rb,
lib/vips/interesting.rb,
lib/vips/interpolate.rb,
lib/vips/mutableimage.rb,
lib/vips/sourcecustom.rb,
lib/vips/targetcustom.rb,
lib/vips/operationmath.rb,
lib/vips/interpretation.rb,
lib/vips/operationmath2.rb,
lib/vips/operationround.rb,
lib/vips/operationboolean.rb,
lib/vips/operationcomplex.rb,
lib/vips/compass_direction.rb,
lib/vips/operationcomplex2.rb,
lib/vips/operationcomplexget.rb,
lib/vips/operationrelational.rb
+
+
+ +
+ +

Overview

+
+ +

This module provides a binding for the libvips image processing library.

+ +

Example

+ +
require 'vips'
+
+if ARGV.length < 2
+    raise "usage: #{$PROGRAM_NAME}: input-file output-file"
+end
+
+im = Vips::Image.new_from_file ARGV[0], access: :sequential
+
+im *= [1, 2, 1]
+
+mask = Vips::Image.new_from_array [
+        [-1, -1, -1],
+        [-1, 16, -1],
+        [-1, -1, -1]
+       ], 8
+im = im.conv mask, precision: :integer
+
+im.write_to_file ARGV[1]
+
+ +

This example loads a file, boosts the green channel (I'm not sure why), sharpens the image, and saves it back to disc again.

+ +

Reading this example line by line, we have:

+ +
im = Vips::Image.new_from_file ARGV[0], access: :sequential
+
+ +

Image.new_from_file can load any image file supported by vips. In this example, we will be accessing pixels top-to-bottom as we sweep through the image reading and writing, so :sequential access mode is best for us. The default mode is :random: this allows for full random access to image pixels, but is slower and needs more memory. See Access for full details on the various modes available.

+ +

You can also load formatted images from memory buffers, create images that wrap C-style memory arrays, or make images from constants. Use Source and Image.new_from_source to load images from any data source, for example URIs.

+ +

The next line:

+ +
im *= [1, 2, 1]
+
+ +

Multiplying the image by an array constant uses one array element for each image band. This line assumes that the input image has three bands and will double the middle band. For RGB images, that's doubling green.

+ +

Next we have:

+ +
mask = Vips::Image.new_from_array [
+        [-1, -1, -1],
+        [-1, 16, -1],
+        [-1, -1, -1]
+       ], 8
+im = im.conv mask, precision: :integer
+
+ +

Image.new_from_array creates an image from an array constant. The 8 at the end sets the scale: the amount to divide the image by after integer convolution.

+ +

See the libvips API docs for vips_conv() (the operation invoked by Image#conv) for details on the convolution operator. By default, it computes with a float mask, but :integer is fine for this case, and is much faster.

+ +

Finally:

+ +
im.write_to_file ARGV[1]
+
+ +

Image#write_to_file writes an image back to the filesystem. It can write any format supported by vips: the file type is set from the filename suffix. You can also write formatted images to memory buffers, or dump image data to a raw memory array.

+ +

Use Target and Image#write_to_target to write formatted images to any data sink, for example URIs.

+ +

How it works

+ +

The binding uses ruby-ffi to open the libvips shared library. When you call a method on the image class, it uses libvips introspection system (based on GObject) to search the library for an operation of that name, transforms the arguments to a form libvips can digest, and runs the operation.

+ +

This means ruby-vips always presents the API implemented by the libvips shared library. It should update itself as new features are added.

+ +

Automatic wrapping

+ +

ruby-vips adds a Image.method_missing handler to Image and uses it to look up vips operations. For example, the libvips operation add, which appears in C as vips_add(), appears in Ruby as Image#add.

+ +

The operation's list of required arguments is searched and the first input image is set to the value of self. Operations which do not take an input image, such as Image.black, appear as class methods. The remainder of the arguments you supply in the function call are used to set the other required input arguments. Any trailing keyword arguments are used to set options on the operation.

+ +

The result is the required output argument if there is only one result, or an array of values if the operation produces several results. If the operation has optional output objects, they are returned as a final hash.

+ +

For example, Image#min, the vips operation that searches an image for the minimum value, has a large number of optional arguments. You can use it to find the minimum value like this:

+ +
min_value = image.min
+
+ +

You can ask it to return the position of the minimum with :x and :y.

+ +
min_value, opts = min x: true, y: true
+x_pos = opts['x']
+y_pos = opts['y']
+
+ +

Now x_pos and y_pos will have the coordinates of the minimum value. There's actually a convenience method for this, Image#minpos.

+ +

You can also ask for the top n minimum, for example:

+ +
min_value, opts = min size: 10, x_array: true, y_array: true
+x_pos = opts['x_array']
+y_pos = opts['y_array']
+
+ +

Now x_pos and y_pos will be 10-element arrays.

+ +

Because operations are member functions and return the result image, you can chain them. For example, you can write:

+ +
result_image = image.real.cos
+
+ +

to calculate the cosine of the real part of a complex image. There are also a full set of arithmetic operator overloads, see below.

+ +

libvips types are also automatically wrapped. The override looks at the type of argument required by the operation and converts the value you supply, when it can. For example, Image#linear takes a VipsArrayDouble as an argument for the set of constants to use for multiplication. You can supply this value as an integer, a float, or some kind of compound object and it will be converted for you. You can write:

+ +
result_image = image.linear 1, 3
+result_image = image.linear 12.4, 13.9
+result_image = image.linear [1, 2, 3], [4, 5, 6]
+result_image = image.linear 1, [4, 5, 6]
+
+ +

And so on. A set of overloads are defined for Image#linear, see below.

+ +

It does a couple of more ambitious conversions. It will automatically convert to and from the various vips types, like VipsBlob and VipsArrayImage. For example, you can read the ICC profile out of an image like this:

+ +
profile = im.get_value "icc-profile-data"
+
+ +

and profile will be a byte array.

+ +

If an operation takes several input images, you can use a constant for all but one of them and the wrapper will expand the constant to an image for you. For example, Image#ifthenelse uses a condition image to pick pixels between a then and an else image:

+ +
result_image = condition_image.ifthenelse then_image, else_image
+
+ +

You can use a constant instead of either the then or the else parts and it will be expanded to an image for you. If you use a constant for both then and else, it will be expanded to match the condition image. For example:

+ +
result_image = condition_image.ifthenelse [0, 255, 0], [255, 0, 0]
+
+ +

Will make an image where true pixels are green and false pixels are red.

+ +

This is useful for Image#bandjoin, the thing to join two or more images up bandwise. You can write:

+ +
rgba = rgb.bandjoin 255
+
+ +

to append a constant 255 band to an image, perhaps to add an alpha channel. Of course you can also write:

+ +
result_image = image1.bandjoin image2
+result_image = image1.bandjoin [image2, image3]
+result_image = Vips::Image.bandjoin [image1, image2, image3]
+result_image = image1.bandjoin [image2, 255]
+
+ +

and so on.

+ +

Logging

+ +

Libvips uses g_log() to log warning, debug, info and (some) error messages.

+ +

developer.gnome.org/glib/stable/glib-Message-Logging.html

+ +

You can disable warnings by defining the VIPS_WARNING environment variable. You can enable info output by defining VIPS_INFO.

+ +

Exceptions

+ +

The wrapper spots errors from vips operations and raises the Error exception. You can catch it in the usual way.

+ +

Automatic YARD documentation

+ +

The bulk of these API docs are generated automatically by Yard.generate. It examines libvips and writes a summary of each operation and the arguments and options that that operation expects.

+ +

Use the C API # docs for more detail.

+ +

Enums

+ +

The libvips enums, such as VipsBandFormat appear in ruby-vips as Symbols like :uchar. They are documented as a set of classes for convenience, see BandFormat, for example.

+ +

Draw operations

+ +

There are two ways of calling the libvips draw operations, like Image#draw_circle and Image#draw_line.

+ +

First, you can use them like functions. For example:

+ +
y = x.draw_line 255, 0, 0, x.width, x.height
+
+ +

This will make a new image, y, which is a copy of x but with a line drawn across it. x is unchanged.

+ +

This is simple, but will be slow if you want to draw many lines, since ruby-vips will make a copy of the whole image each time.

+ +

You can use Image#mutate to make a MutableImage. This is an image which is unshared and is only available inside the Image#mutate block. Within this block, you can use ! versions of the draw operations to modify images and avoid the copy. For example:

+ +
image = image.mutate do |mutable|
+  (0 ... 1).step(0.01) do |i|
+    mutable.draw_line! 255, mutable.width * i, 0, 0, mutable.height * (1 - i)
+  end
+end
+
+ +

Now each Image#draw_line will directly modify the mutable image, saving the copy. This is much faster and needs much less memory.

+ +

Metadata read

+ +

Use Image#get_fields to get a list of the metadata fields that an image supports. ICC profiles, for example, are in a field called icc-profile-data. Use vipsheader -a something.jpg at the command-line to see all the fields on an image.

+ +

Use Image#get_typeof to get the type of a field. Types are integers, with 0 meaning “no such field”. Constants like GObject::GINT_TYPE are useful for testing field types.

+ +

You can read image metadata using Image#get. The field value is converted to a Ruby value in the obvious way.

+ +

Metadata write

+ +

You can also set and remove image metadata fields. Images are immutable, so you must make any changes inside a Image#mutate block. For example:

+ +
image = image.mutate do |mutable|
+  image.get_fields.each do |field|
+    mutable.remove! field unless field == "icc-profile-data"
+  end
+end
+
+ +

To remove all metadata except the icc profile.

+ +

You can use MutableImage#set! to change the value of an existing field, and MutableImage#set_type! to create a new field with a specified type.

+ +

Progress

+ +

You can attach signal handlers to images to watch computation progress. For example:

+ +
image = Vips::Image.black 1, 100000
+image.set_progress true
+
+def progress_to_s(name, progress)
+  puts "#{name}:"
+  puts "    run = #{progress[:run]}"
+  puts "    eta = #{progress[:eta]}"
+  puts "    tpels = #{progress[:tpels]}"
+  puts "    npels = #{progress[:npels]}"
+  puts "    percent = #{progress[:percent]}"
+end
+
+image.signal_connect :preeval do |progress|
+  progress_to_s("preeval", progress)
+end
+
+image.signal_connect :eval do |progress|
+  progress_to_s("eval", progress)
+  image.set_kill(true) if progress[:percent] > 50
+end
+
+image.signal_connect :posteval do |progress|
+  progress_to_s("posteval", progress)
+end
+
+image.avg
+
+ +

The :eval signal will fire for every tile that is processed. You can stop progress with Image#set_kill and processing will end with an exception.

+ +

User streams

+ +

You can make your own input and output stream objects with SourceCustom and TargetCustom. For example:

+ +
file = File.open "some/file", "rb"
+source = Vips::SourceCustom.new
+source.on_read { |length| file.read length }
+image = Vips::Image.new_from_source source, "", access: "sequential"
+
+ +

Overloads

+ +

The wrapper defines the usual set of arithmetic, boolean and relational overloads on image. You can mix images, constants and lists of constants (almost) freely. For example, you can write:

+ +
result_image = ((image * [1, 2, 3]).abs < 128) | 4
+
+ +

Expansions

+ +

Some vips operators take an enum to select an action, for example Image#math can be used to calculate sine of every pixel like this:

+ +
result_image = image.math :sin
+
+ +

This is annoying, so the wrapper expands all these enums into separate members named after the enum. So you can write:

+ +
result_image = image.sin
+
+ +

Convenience functions

+ +

The wrapper defines a few extra useful utility functions: Image#get_value, Image#set_value, Image#bandsplit, Image#maxpos, Image#minpos, Image#median.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: Yard + + + + Classes: Access, Align, Angle, Angle45, Argument, ArgumentClass, ArgumentClassPtr, ArgumentInstance, ArgumentInstancePtr, BandFormat, BlendMode, Coding, CompassDirection, Connection, Direction, Error, Extend, Image, IntStruct, Interesting, Interpolate, Interpretation, Introspect, Kernel, MutableImage, Object, ObjectClass, Operation, OperationBoolean, OperationComplex, OperationComplex2, OperationComplexget, OperationMath, OperationMath2, OperationRelational, OperationRound, Progress, Region, Size, SizeStruct, Source, SourceCustom, Target, TargetCustom + + +

+ + +

+ Constant Summary + collapse +

+ +
+ +
LOG_DOMAIN = + +
+
"VIPS"
+ +
LIBRARY_VERSION = + +
+
Vips.version_string
+ +
MAX_COORD = +
+
+ +

libvips has this arbitrary number as a sanity-check upper bound on image size. It's sometimes useful to know when calculating scale factors.

+ + +
+
+
+ + +
+
+
10000000
+ +
IMAGE_TYPE = +
+
+ +

some handy gtypes

+ + +
+
+
+ + +
+
+
GObject.g_type_from_name "VipsImage"
+ +
ARRAY_INT_TYPE = + +
+
GObject.g_type_from_name "VipsArrayInt"
+ +
ARRAY_DOUBLE_TYPE = + +
+
GObject.g_type_from_name "VipsArrayDouble"
+ +
ARRAY_IMAGE_TYPE = + +
+
GObject.g_type_from_name "VipsArrayImage"
+ +
REFSTR_TYPE = + +
+
GObject.g_type_from_name "VipsRefString"
+ +
BLOB_TYPE = + +
+
GObject.g_type_from_name "VipsBlob"
+ +
BAND_FORMAT_TYPE = + +
+
Vips.vips_band_format_get_type
+ +
INTERPRETATION_TYPE = + +
+
Vips.vips_interpretation_get_type
+ +
CODING_TYPE = + +
+
Vips.vips_coding_get_type
+ +
BLEND_MODE_TYPE = + +
+
nil
+ +
VERSION = + +
+
"2.1.3"
+ +
+ + + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + + +
+

Class Method Details

+ + +
+

+ + .at_least_libvips?(x, y) ⇒ Boolean + + + + + +

+
+ +

True if this is at least libvips x.y

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+690
+691
+692
+693
+694
+695
+
+
# File 'lib/vips.rb', line 690
+
+def self.at_least_libvips?(x, y)
+  major = version(0)
+  minor = version(1)
+
+  major > x || (major == x && minor >= y)
+end
+
+
+ +
+

+ + .cache_set_max(size) ⇒ Object + + + + + +

+
+ +

Set the maximum number of operations that libvips should cache. Set 0 to disable the operation cache. The default is 1000.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+647
+648
+649
+
+
# File 'lib/vips.rb', line 647
+
+def self.cache_set_max size
+  vips_cache_set_max size
+end
+
+
+ +
+

+ + .cache_set_max_files(size) ⇒ Object + + + + + +

+
+ +

Set the maximum number of files libvips should keep open in the operation cache. Set 0 to disable the operation cache. The default is 100.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+660
+661
+662
+
+
# File 'lib/vips.rb', line 660
+
+def self.cache_set_max_files size
+  vips_cache_set_max_files size
+end
+
+
+ +
+

+ + .cache_set_max_mem(size) ⇒ Object + + + + + +

+
+ +

Set the maximum amount of memory that libvips should use for the operation cache. Set 0 to disable the operation cache. The default is 100mb.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+653
+654
+655
+
+
# File 'lib/vips.rb', line 653
+
+def self.cache_set_max_mem size
+  vips_cache_set_max_mem size
+end
+
+
+ +
+

+ + .concurrency_set(n) ⇒ Object + + + + + +

+
+ +

Set the size of the libvips worker pool. This defaults to the number of hardware threads on your computer. Set to 1 to disable threading.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+666
+667
+668
+
+
# File 'lib/vips.rb', line 666
+
+def self.concurrency_set n
+  vips_concurrency_set n
+end
+
+
+ +
+

+ + .get_suffixes[String] + + + + + +

+
+ +

Get a list of all supported file suffixes.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + ([String]) + + + + — +
    +

    array of supported suffixes

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+
+
# File 'lib/vips.rb', line 700
+
+def self.get_suffixes
+  # vips_foreign_get_suffixes() was added in libvips 8.8
+  return [] unless Vips.respond_to? :vips_foreign_get_suffixes
+
+  array = Vips.vips_foreign_get_suffixes
+
+  names = []
+  p = array
+  until (q = p.read_pointer).null?
+    suff = q.read_string
+    GLib.g_free q
+    names << suff unless names.include? suff
+    p += FFI::Type::POINTER.size
+  end
+  GLib.g_free array
+
+  names
+end
+
+
+ +
+

+ + .leak_set(leak) ⇒ Object + + + + + +

+
+ +

Turn libvips leak testing on and off. Handy for debugging ruby-vips, not very useful for user code.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+637
+638
+639
+
+
# File 'lib/vips.rb', line 637
+
+def self.leak_set leak
+  vips_leak_set((leak ? 1 : 0))
+end
+
+
+ +
+

+ + .set_debug(debug) ⇒ Object + + + + + +

+
+ +

Deprecated compatibility function.

+ +

Don't use this, instead change GLib::logger.level.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+680
+681
+682
+683
+684
+
+
# File 'lib/vips.rb', line 680
+
+def self.set_debug debug
+  if debug
+    GLib.logger.level = Logger::DEBUG
+  end
+end
+
+
+ +
+

+ + .vector_set(enabled) ⇒ Object + + + + + +

+
+ +

Enable or disable SIMD and the run-time compiler. This can give a nice speed-up, but can also be unstable on some systems or with some versions of the run-time compiler.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+673
+674
+675
+
+
# File 'lib/vips.rb', line 673
+
+def self.vector_set enabled
+  vips_vector_set_enabled(enabled ? 1 : 0)
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Access.html b/Vips/Access.html new file mode 100644 index 00000000..a7ffe4f1 --- /dev/null +++ b/Vips/Access.html @@ -0,0 +1,140 @@ + + + + + + + Class: Vips::Access + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Access + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/access.rb
+
+ +
+ +

Overview

+
+ +

The type of access an operation has to supply.

+
  • +

    :random means requests can come in any order.

    +
  • +

    :sequential means requests will be top-to-bottom, but with some amount of buffering behind the read point for small non-local accesses.

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Align.html b/Vips/Align.html new file mode 100644 index 00000000..1b7a4a67 --- /dev/null +++ b/Vips/Align.html @@ -0,0 +1,142 @@ + + + + + + + Class: Vips::Align + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Align + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/align.rb
+
+ +
+ +

Overview

+
+ +

Various types of alignment. See Image#join, for example.

+
  • +

    :low Align on the low coordinate edge

    +
  • +

    :centre Align on the centre

    +
  • +

    :high Align on the high coordinate edge

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Angle.html b/Vips/Angle.html new file mode 100644 index 00000000..c3515017 --- /dev/null +++ b/Vips/Angle.html @@ -0,0 +1,144 @@ + + + + + + + Class: Vips::Angle + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Angle + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/angle.rb
+
+ +
+ +

Overview

+
+ +

Various fixed 90 degree rotation angles. See Image#rot.

+
  • +

    :d0 no rotate

    +
  • +

    :d90 90 degrees clockwise

    +
  • +

    :d180 180 degrees

    +
  • +

    :d270 90 degrees anti-clockwise

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Angle45.html b/Vips/Angle45.html new file mode 100644 index 00000000..f75a91c5 --- /dev/null +++ b/Vips/Angle45.html @@ -0,0 +1,152 @@ + + + + + + + Class: Vips::Angle45 + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Angle45 + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/angle45.rb
+
+ +
+ +

Overview

+
+ +

Various fixed 45 degree rotation angles. See Image#rot45.

+
  • +

    :d0 no rotate

    +
  • +

    :d45 45 degrees clockwise

    +
  • +

    :d90 90 degrees clockwise

    +
  • +

    :d135 135 degrees clockwise

    +
  • +

    :d180 180 degrees

    +
  • +

    :d225 135 degrees anti-clockwise

    +
  • +

    :d270 90 degrees anti-clockwise

    +
  • +

    :d315 45 degrees anti-clockwise

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Argument.html b/Vips/Argument.html new file mode 100644 index 00000000..ae214b63 --- /dev/null +++ b/Vips/Argument.html @@ -0,0 +1,128 @@ + + + + + + + Class: Vips::Argument + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Argument + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ +
+

Direct Known Subclasses

+

ArgumentClass, ArgumentInstance

+
+ + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/ArgumentClass.html b/Vips/ArgumentClass.html new file mode 100644 index 00000000..3a15a0b7 --- /dev/null +++ b/Vips/ArgumentClass.html @@ -0,0 +1,132 @@ + + + + + + + Class: Vips::ArgumentClass + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::ArgumentClass + + + +

+
+ +
+
Inherits:
+
+ Argument + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/ArgumentClassPtr.html b/Vips/ArgumentClassPtr.html new file mode 100644 index 00000000..5221c7f5 --- /dev/null +++ b/Vips/ArgumentClassPtr.html @@ -0,0 +1,124 @@ + + + + + + + Class: Vips::ArgumentClassPtr + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::ArgumentClassPtr + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/ArgumentInstance.html b/Vips/ArgumentInstance.html new file mode 100644 index 00000000..7e2593dd --- /dev/null +++ b/Vips/ArgumentInstance.html @@ -0,0 +1,132 @@ + + + + + + + Class: Vips::ArgumentInstance + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::ArgumentInstance + + + +

+
+ +
+
Inherits:
+
+ Argument + +
    +
  • Object
  • + + + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/ArgumentInstancePtr.html b/Vips/ArgumentInstancePtr.html new file mode 100644 index 00000000..36e9731c --- /dev/null +++ b/Vips/ArgumentInstancePtr.html @@ -0,0 +1,124 @@ + + + + + + + Class: Vips::ArgumentInstancePtr + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::ArgumentInstancePtr + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/BandFormat.html b/Vips/BandFormat.html new file mode 100644 index 00000000..41d560cc --- /dev/null +++ b/Vips/BandFormat.html @@ -0,0 +1,158 @@ + + + + + + + Class: Vips::BandFormat + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::BandFormat + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/bandformat.rb
+
+ +
+ +

Overview

+
+ +

The format used for each band element. Each corresponds to a native C type for the current machine.

+
  • +

    :notset invalid setting

    +
  • +

    :uchar unsigned char format

    +
  • +

    :char char format

    +
  • +

    :ushort unsigned short format

    +
  • +

    :short short format

    +
  • +

    :uint unsigned int format

    +
  • +

    :int int format

    +
  • +

    :float float format

    +
  • +

    :complex complex (two floats) format

    +
  • +

    :double double float format

    +
  • +

    :dpcomplex double complex (two double) format

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/BlendMode.html b/Vips/BlendMode.html new file mode 100644 index 00000000..aa8ea068 --- /dev/null +++ b/Vips/BlendMode.html @@ -0,0 +1,186 @@ + + + + + + + Class: Vips::BlendMode + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::BlendMode + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/blend_mode.rb
+
+ +
+ +

Overview

+
+ +

Blend mode to use when compositing images. See Image#composite.

+
  • +

    :clear where the second object is drawn, the first is removed

    +
  • +

    :source the second object is drawn as if nothing were below

    +
  • +

    :over the image shows what you would expect if you held two semi-transparent slides on top of each other

    +
  • +

    :in the first object is removed completely, the second is only drawn where the first was

    +
  • +

    :out the second is drawn only where the first isn't

    +
  • +

    :atop this leaves the first object mostly intact, but mixes both objects in the overlapping area

    +
  • +

    :dest leaves the first object untouched, the second is discarded completely

    +
  • +

    :dest_over like :over, but swaps the arguments

    +
  • +

    :dest_in like :in, but swaps the arguments

    +
  • +

    :dest_out like :out, but swaps the arguments

    +
  • +

    :dest_atop like :atop, but swaps the arguments

    +
  • +

    :xor something like a difference operator

    +
  • +

    :add a bit like adding the two images

    +
  • +

    :saturate a bit like the darker of the two

    +
  • +

    :multiply at least as dark as the darker of the two inputs

    +
  • +

    :screen at least as light as the lighter of the inputs

    +
  • +

    :overlay multiplies or screens colors, depending on the lightness

    +
  • +

    :darken the darker of each component

    +
  • +

    :lighten the lighter of each component

    +
  • +

    :colour_dodge brighten first by a factor second

    +
  • +

    :colour_burn darken first by a factor of second

    +
  • +

    :hard_light multiply or screen, depending on lightness

    +
  • +

    :soft_light darken or lighten, depending on lightness

    +
  • +

    :difference difference of the two

    +
  • +

    :exclusion somewhat like :difference, but lower-contrast

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Coding.html b/Vips/Coding.html new file mode 100644 index 00000000..daf1e4e6 --- /dev/null +++ b/Vips/Coding.html @@ -0,0 +1,144 @@ + + + + + + + Class: Vips::Coding + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Coding + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/coding.rb
+
+ +
+ +

Overview

+
+ +

How pixels are coded.

+ +

Normally, pixels are uncoded and can be manipulated as you would expect. However some file formats code pixels for compression, and sometimes it's useful to be able to manipulate images in the coded format.

+
  • +

    :none pixels are not coded

    +
  • +

    :labq pixels encode 3 float CIELAB values as 4 uchar

    +
  • +

    :rad pixels encode 3 float RGB as 4 uchar (Radiance coding)

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/CompassDirection.html b/Vips/CompassDirection.html new file mode 100644 index 00000000..ec5eefd1 --- /dev/null +++ b/Vips/CompassDirection.html @@ -0,0 +1,154 @@ + + + + + + + Class: Vips::CompassDirection + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::CompassDirection + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/compass_direction.rb
+
+ +
+ +

Overview

+
+ +

A direction on a compass used for placing images. See Image#gravity.

+
  • +

    :centre

    +
  • +

    :north

    +
  • +

    :east

    +
  • +

    :south

    +
  • +

    :west

    +
  • +

    :"north-east"

    +
  • +

    :"south-east"

    +
  • +

    :"south-west"

    +
  • +

    :"north-west"

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Connection.html b/Vips/Connection.html new file mode 100644 index 00000000..0c38ee77 --- /dev/null +++ b/Vips/Connection.html @@ -0,0 +1,334 @@ + + + + + + + Class: Vips::Connection + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Connection + + + +

+
+ +
+
Inherits:
+
+ Object + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/connection.rb
+
+ +
+ +

Overview

+
+ +

Abstract base class for connections.

+ + +
+
+
+ + +
+

Direct Known Subclasses

+

Source, Target

+
+

Defined Under Namespace

+

+ + + Modules: ConnectionLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct, #initialize

+ + +
+

Constructor Details

+ +

This class inherits a constructor from GObject::GObject

+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #filenameObject + + + + + +

+
+ +

Get any filename associated with a connection, or nil.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+36
+37
+38
+
+
# File 'lib/vips/connection.rb', line 36
+
+def filename
+  Vips.vips_connection_filename self
+end
+
+
+ +
+

+ + #nickObject + + + + + +

+
+ +

Get a nickname (short description) of a connection that could be shown to the user.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+42
+43
+44
+
+
# File 'lib/vips/connection.rb', line 42
+
+def nick
+  Vips.vips_connection_nick self
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Connection/ConnectionLayout.html b/Vips/Connection/ConnectionLayout.html new file mode 100644 index 00000000..873b4731 --- /dev/null +++ b/Vips/Connection/ConnectionLayout.html @@ -0,0 +1,196 @@ + + + + + + + Module: Vips::Connection::ConnectionLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Connection::ConnectionLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/connection.rb
+
+ +
+ +

Overview

+
+ +

The layout of the VipsRegion struct.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+19
+20
+21
+22
+23
+24
+
+
# File 'lib/vips/connection.rb', line 19
+
+def self.included(base)
+  base.class_eval do
+    layout :parent, Vips::Object::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Connection/ManagedStruct.html b/Vips/Connection/ManagedStruct.html new file mode 100644 index 00000000..f37c28ee --- /dev/null +++ b/Vips/Connection/ManagedStruct.html @@ -0,0 +1,187 @@ + + + + + + + Class: Vips::Connection::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Connection::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Object::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
ConnectionLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/connection.rb
+
+ +
+ +
+

Direct Known Subclasses

+

Source::ManagedStruct, Target::ManagedStruct

+
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Connection/Struct.html b/Vips/Connection/Struct.html new file mode 100644 index 00000000..a427d9cb --- /dev/null +++ b/Vips/Connection/Struct.html @@ -0,0 +1,182 @@ + + + + + + + Class: Vips::Connection::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Connection::Struct + + + +

+
+ +
+
Inherits:
+
+ Object::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
ConnectionLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/connection.rb
+
+ +
+ +
+

Direct Known Subclasses

+

Source::Struct, Target::Struct

+
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Direction.html b/Vips/Direction.html new file mode 100644 index 00000000..3f65c60a --- /dev/null +++ b/Vips/Direction.html @@ -0,0 +1,140 @@ + + + + + + + Class: Vips::Direction + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Direction + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/direction.rb
+
+ +
+ +

Overview

+
+ +

Operations like Image#flip need to be told whether to flip left-right or top-bottom.

+
  • +

    :horizontal left-right

    +
  • +

    :vertical top-bottom

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Error.html b/Vips/Error.html new file mode 100644 index 00000000..55db8f9e --- /dev/null +++ b/Vips/Error.html @@ -0,0 +1,350 @@ + + + + + + + Exception: Vips::Error + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Exception: Vips::Error + + + +

+
+ +
+
Inherits:
+
+ RuntimeError + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips.rb
+
+ +
+ +

Overview

+
+ +

The ruby-vips error class.

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + +
+

Constructor Details

+ +
+

+ + #initialize(msg = nil) ⇒ Error + + + + + +

+
+ +

Returns a new instance of Error.

+ + +
+
+
+

Parameters:

+
    + +
  • + + msg + + + (String) + + + (defaults to: nil) + + + — +
    +

    The error message. If this is not supplied, grab and clear the vips error buffer and use that.

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+
+
# File 'lib/vips.rb', line 592
+
+def initialize msg = nil
+  if msg
+    @details = msg
+  elsif Vips.vips_error_buffer != ""
+    @details = Vips.vips_error_buffer
+    Vips.vips_error_clear
+  else
+    @details = nil
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #to_sString + + + + + +

+
+ +

Pretty-print a Vips::Error.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +
    +

    The error message

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+606
+607
+608
+609
+610
+611
+612
+
+
# File 'lib/vips.rb', line 606
+
+def to_s
+  if !@details.nil?
+    @details
+  else
+    super.to_s
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Extend.html b/Vips/Extend.html new file mode 100644 index 00000000..f13c8b64 --- /dev/null +++ b/Vips/Extend.html @@ -0,0 +1,148 @@ + + + + + + + Class: Vips::Extend + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Extend + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/extend.rb
+
+ +
+ +

Overview

+
+ +

When the edges of an image are extended, you can specify how you want the extension done. See Image#embed, Image#conv, Image#affine and so on.

+
  • +

    :black new pixels are black, ie. all bits are zero.

    +
  • +

    :copy each new pixel takes the value of the nearest edge pixel

    +
  • +

    :repeat the image is tiled to fill the new area

    +
  • +

    :mirror the image is reflected and tiled to reduce hash edges

    +
  • +

    :white new pixels are white, ie. all bits are set

    +
  • +

    :background colour set from the @background property

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Image.html b/Vips/Image.html new file mode 100644 index 00000000..e40c56dd --- /dev/null +++ b/Vips/Image.html @@ -0,0 +1,63688 @@ + + + + + + + Class: Vips::Image + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Image + + + +

+
+ +
+
Inherits:
+
+ Object + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/image.rb,
+ lib/vips/methods.rb
+
+
+ +
+ +

Overview

+
+ +

This class represents a libvips image. See the Vips module documentation for an introduction to using this class.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: ImageLayout + + + + Classes: GenericPtr, ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Class Method Summary + collapse +

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Object

+

#get_pspec, #get_typeof_error, print_all, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct, #initialize

+ + +
+

Constructor Details

+ +

This class inherits a constructor from GObject::GObject

+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + #method_missing(name, *args, **options) ⇒ Object + + + + + +

+
+ +

Invoke a vips operation with Operation.call, using self as the first input argument.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +
    +

    vips operation to call

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + + + + + +
    +

    result of vips operation

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+228
+229
+230
+
+
# File 'lib/vips/image.rb', line 228
+
+def method_missing name, *args, **options
+  Vips::Operation.call name.to_s, [self, *args], options
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .analyzeload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load an analyze6 image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 977
+
+
+
+
+ +
+

+ + .arrayjoin(im, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Join an array of images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + im + + + (Array<Image>) + + + + — +
    +

    Array of input images

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :across + (Integer) + + + + + —
    +

    Number of images across grid

    +
    + +
  • + +
  • + :shim + (Integer) + + + + + —
    +

    Pixels between images

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Colour for new pixels

    +
    + +
  • + +
  • + :halign + (Vips::Align) + + + + + —
    +

    Align on the left, centre or right

    +
    + +
  • + +
  • + :valign + (Vips::Align) + + + + + —
    +

    Align on the top, centre or bottom

    +
    + +
  • + +
  • + :hspacing + (Integer) + + + + + —
    +

    Horizontal spacing between images

    +
    + +
  • + +
  • + :vspacing + (Integer) + + + + + —
    +

    Vertical spacing between images

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 365
+
+
+
+
+ +
+

+ + .bandrank(im, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Band-wise rank of a set of images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + im + + + (Array<Image>) + + + + — +
    +

    Array of input images

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :index + (Integer) + + + + + —
    +

    Select this band element from sorted list

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 417
+
+
+
+
+ +
+

+ + .black(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a black image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :bands + (Integer) + + + + + —
    +

    Number of bands in image

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 575
+
+
+
+
+ +
+

+ + .csvload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load csv.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :skip + (Integer) + + + + + —
    +

    Skip this many lines at the start of the file

    +
    + +
  • + +
  • + :lines + (Integer) + + + + + —
    +

    Read this many lines from the file

    +
    + +
  • + +
  • + :whitespace + (String) + + + + + —
    +

    Set of whitespace characters

    +
    + +
  • + +
  • + :separator + (String) + + + + + —
    +

    Set of separator characters

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 879
+
+
+
+
+ +
+

+ + .csvload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load csv.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :skip + (Integer) + + + + + —
    +

    Skip this many lines at the start of the file

    +
    + +
  • + +
  • + :lines + (Integer) + + + + + —
    +

    Read this many lines from the file

    +
    + +
  • + +
  • + :whitespace + (String) + + + + + —
    +

    Set of whitespace characters

    +
    + +
  • + +
  • + :separator + (String) + + + + + —
    +

    Set of separator characters

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 895
+
+
+
+
+ +
+

+ + .eye(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make an image showing the eye's spatial response.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :factor + (Float) + + + + + —
    +

    Maximum spatial frequency

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 639
+
+
+
+
+ +
+

+ + .fitsload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load a fits image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1397
+
+
+
+
+ +
+

+ + .fitsload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load fits from a source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1409
+
+
+
+
+ +
+

+ + .fractsurf(width, height, fractal_dimension, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a fractal surface.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + fractal_dimension + + + (Float) + + + + — +
    +

    Fractal dimension

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 846
+
+
+
+
+ +
+

+ + .gaussmat(sigma, min_ampl, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a gaussian image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sigma + + + (Float) + + + + — +
    +

    Sigma of Gaussian

    +
    + +
  • + +
  • + + min_ampl + + + (Float) + + + + — +
    +

    Minimum amplitude of Gaussian

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :separable + (Boolean) + + + + + —
    +

    Generate separable Gaussian

    +
    + +
  • + +
  • + :integer + (Boolean) + + + + + —
    +

    Generate integer Gaussian

    +
    + +
  • + +
  • + :precision + (Vips::Precision) + + + + + —
    +

    Generate with this precision

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 603
+
+
+
+
+ +
+

+ + .gaussnoise(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a gaussnoise image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :sigma + (Float) + + + + + —
    +

    Standard deviation of pixels in generated image

    +
    + +
  • + +
  • + :mean + (Float) + + + + + —
    +

    Mean of pixels in generated image

    +
    + +
  • + +
  • + :seed + (Integer) + + + + + —
    +

    Random number seed

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 583
+
+
+
+
+ +
+

+ + .gifload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load gif with libnsgif.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1169
+
+
+
+
+ +
+

+ + .gifload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load gif with libnsgif.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1183
+
+
+
+
+ +
+

+ + .gifload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load gif from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1197
+
+
+
+
+ +
+

+ + .grey(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a grey ramp image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 648
+
+
+
+
+ +
+

+ + .heifload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load a heif image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :thumbnail + (Boolean) + + + + + —
    +

    Fetch thumbnail image

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using exif orientation

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1489
+
+
+
+
+ +
+

+ + .heifload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load a heif image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :thumbnail + (Boolean) + + + + + —
    +

    Fetch thumbnail image

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using exif orientation

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1505
+
+
+
+
+ +
+

+ + .heifload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load a heif image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :thumbnail + (Boolean) + + + + + —
    +

    Fetch thumbnail image

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using exif orientation

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1521
+
+
+
+
+ +
+

+ + .identity(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a 1d image where pixel values are indexes.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :bands + (Integer) + + + + + —
    +

    Number of bands in LUT

    +
    + +
  • + +
  • + :ushort + (Boolean) + + + + + —
    +

    Create a 16-bit LUT

    +
    + +
  • + +
  • + :size + (Integer) + + + + + —
    +

    Size of 16-bit LUT

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 838
+
+
+
+
+ +
+

+ + .jp2kload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load jpeg2000 image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the image

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1130
+
+
+
+
+ +
+

+ + .jp2kload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load jpeg2000 image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the image

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1143
+
+
+
+
+ +
+

+ + .jp2kload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load jpeg2000 image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the image

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1156
+
+
+
+
+ +
+

+ + .jpegload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load jpeg from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :shrink + (Integer) + + + + + —
    +

    Shrink factor on load

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using exif orientation

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1259
+
+
+
+
+ +
+

+ + .jpegload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load jpeg from buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :shrink + (Integer) + + + + + —
    +

    Shrink factor on load

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using exif orientation

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1273
+
+
+
+
+ +
+

+ + .jpegload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load image from jpeg source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :shrink + (Integer) + + + + + —
    +

    Shrink factor on load

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using exif orientation

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1287
+
+
+
+
+ +
+

+ + .jxlload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load jpeg-xl image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1094
+
+
+
+
+ +
+

+ + .jxlload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load jpeg-xl image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1106
+
+
+
+
+ +
+

+ + .jxlload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load jpeg-xl image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1118
+
+
+
+
+ +
+

+ + .logmat(sigma, min_ampl, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a laplacian of gaussian image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sigma + + + (Float) + + + + — +
    +

    Radius of Logmatian

    +
    + +
  • + +
  • + + min_ampl + + + (Float) + + + + — +
    +

    Minimum amplitude of Logmatian

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :separable + (Boolean) + + + + + —
    +

    Generate separable Logmatian

    +
    + +
  • + +
  • + :integer + (Boolean) + + + + + —
    +

    Generate integer Logmatian

    +
    + +
  • + +
  • + :precision + (Vips::Precision) + + + + + —
    +

    Generate with this precision

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 613
+
+
+
+
+ +
+

+ + .magickload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load file with imagemagick.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :all_frames + (Boolean) + + + + + —
    +

    Read all frames from an image

    +
    + +
  • + +
  • + :density + (String) + + + + + —
    +

    Canvas resolution for rendering vector formats like SVG

    +
    + +
  • + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1588
+
+
+
+
+ +
+

+ + .magickload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load buffer with imagemagick.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :all_frames + (Boolean) + + + + + —
    +

    Read all frames from an image

    +
    + +
  • + +
  • + :density + (String) + + + + + —
    +

    Canvas resolution for rendering vector formats like SVG

    +
    + +
  • + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1604
+
+
+
+
+ +
+

+ + .mask_butterworth(width, height, order, frequency_cutoff, amplitude_cutoff, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a butterworth filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + order + + + (Float) + + + + — +
    +

    Filter order

    +
    + +
  • + +
  • + + frequency_cutoff + + + (Float) + + + + — +
    +

    Frequency cutoff

    +
    + +
  • + +
  • + + amplitude_cutoff + + + (Float) + + + + — +
    +

    Amplitude cutoff

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 713
+
+
+
+
+ +
+

+ + .mask_butterworth_band(width, height, order, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a butterworth_band filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + order + + + (Float) + + + + — +
    +

    Filter order

    +
    + +
  • + +
  • + + frequency_cutoff_x + + + (Float) + + + + — +
    +

    Frequency cutoff x

    +
    + +
  • + +
  • + + frequency_cutoff_y + + + (Float) + + + + — +
    +

    Frequency cutoff y

    +
    + +
  • + +
  • + + radius + + + (Float) + + + + — +
    +

    radius of circle

    +
    + +
  • + +
  • + + amplitude_cutoff + + + (Float) + + + + — +
    +

    Amplitude cutoff

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 742
+
+
+
+
+ +
+

+ + .mask_butterworth_ring(width, height, order, frequency_cutoff, amplitude_cutoff, ringwidth, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a butterworth ring filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + order + + + (Float) + + + + — +
    +

    Filter order

    +
    + +
  • + +
  • + + frequency_cutoff + + + (Float) + + + + — +
    +

    Frequency cutoff

    +
    + +
  • + +
  • + + amplitude_cutoff + + + (Float) + + + + — +
    +

    Amplitude cutoff

    +
    + +
  • + +
  • + + ringwidth + + + (Float) + + + + — +
    +

    Ringwidth

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 727
+
+
+
+
+ +
+

+ + .mask_fractal(width, height, fractal_dimension, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make fractal filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + fractal_dimension + + + (Float) + + + + — +
    +

    Fractal dimension

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 800
+
+
+
+
+ +
+

+ + .mask_gaussian(width, height, frequency_cutoff, amplitude_cutoff, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a gaussian filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + frequency_cutoff + + + (Float) + + + + — +
    +

    Frequency cutoff

    +
    + +
  • + +
  • + + amplitude_cutoff + + + (Float) + + + + — +
    +

    Amplitude cutoff

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 758
+
+
+
+
+ +
+

+ + .mask_gaussian_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a gaussian filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + frequency_cutoff_x + + + (Float) + + + + — +
    +

    Frequency cutoff x

    +
    + +
  • + +
  • + + frequency_cutoff_y + + + (Float) + + + + — +
    +

    Frequency cutoff y

    +
    + +
  • + +
  • + + radius + + + (Float) + + + + — +
    +

    radius of circle

    +
    + +
  • + +
  • + + amplitude_cutoff + + + (Float) + + + + — +
    +

    Amplitude cutoff

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 785
+
+
+
+
+ +
+

+ + .mask_gaussian_ring(width, height, frequency_cutoff, amplitude_cutoff, ringwidth, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a gaussian ring filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + frequency_cutoff + + + (Float) + + + + — +
    +

    Frequency cutoff

    +
    + +
  • + +
  • + + amplitude_cutoff + + + (Float) + + + + — +
    +

    Amplitude cutoff

    +
    + +
  • + +
  • + + ringwidth + + + (Float) + + + + — +
    +

    Ringwidth

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 771
+
+
+
+
+ +
+

+ + .mask_ideal(width, height, frequency_cutoff, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make an ideal filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + frequency_cutoff + + + (Float) + + + + — +
    +

    Frequency cutoff

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 674
+
+
+
+
+ +
+

+ + .mask_ideal_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make an ideal band filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + frequency_cutoff_x + + + (Float) + + + + — +
    +

    Frequency cutoff x

    +
    + +
  • + +
  • + + frequency_cutoff_y + + + (Float) + + + + — +
    +

    Frequency cutoff y

    +
    + +
  • + +
  • + + radius + + + (Float) + + + + — +
    +

    radius of circle

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 699
+
+
+
+
+ +
+

+ + .mask_ideal_ring(width, height, frequency_cutoff, ringwidth, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make an ideal ring filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + frequency_cutoff + + + (Float) + + + + — +
    +

    Frequency cutoff

    +
    + +
  • + +
  • + + ringwidth + + + (Float) + + + + — +
    +

    Ringwidth

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :nodc + (Boolean) + + + + + —
    +

    Remove DC component

    +
    + +
  • + +
  • + :reject + (Boolean) + + + + + —
    +

    Invert the sense of the filter

    +
    + +
  • + +
  • + :optical + (Boolean) + + + + + —
    +

    Rotate quadrants to optical space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 686
+
+
+
+
+ +
+

+ + .matload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load mat from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1247
+
+
+
+
+ +
+

+ + .matrix_from_array(width, height, array) ⇒ Object + + + + + +

+ + + + +
+
+
+
+464
+465
+466
+467
+468
+469
+470
+
+
# File 'lib/vips/image.rb', line 464
+
+def self.matrix_from_array width, height, array
+  ptr = FFI::MemoryPointer.new :double, array.length
+  ptr.write_array_of_double array
+  image = Vips.vips_image_new_matrix_from_array width, height,
+    ptr, array.length
+  Vips::Image.new image
+end
+
+
+ +
+

+ + .matrixload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load matrix.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 911
+
+
+
+
+ +
+

+ + .matrixload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load matrix.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 923
+
+
+
+
+ +
+

+ + .method_missing(name, *args, **options) ⇒ Object + + + + + +

+
+ +

Invoke a vips operation with Operation.call.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+233
+234
+235
+
+
# File 'lib/vips/image.rb', line 233
+
+def self.method_missing name, *args, **options
+  Vips::Operation.call name.to_s, args, options
+end
+
+
+ +
+

+ + .new_from_array(array, scale = 1, offset = 0) ⇒ Image + + + + + +

+
+ +

Create a new Image from a 1D or 2D array. A 1D array becomes an image with height 1. Use scale and offset to set the scale and offset fields in the header. These are useful for integer convolutions.

+ +

For example:

+ +
image = Vips::Image.new_from_array [1, 2, 3]
+
+ +

or

+ +
image = Vips::Image.new_from_array [
+    [-1, -1, -1],
+    [-1, 16, -1],
+    [-1, -1, -1]], 8
+
+ +

for a simple sharpening mask.

+ + +
+
+
+

Parameters:

+
    + +
  • + + array + + + (Array) + + + + — +
    +

    the pixel data as an array of numbers

    +
    + +
  • + +
  • + + scale + + + (Real) + + + (defaults to: 1) + + + — +
    +

    the convolution scale

    +
    + +
  • + +
  • + + offset + + + (Real) + + + (defaults to: 0) + + + — +
    +

    the convolution offset

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    the image

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+
+
# File 'lib/vips/image.rb', line 498
+
+def self.new_from_array array, scale = 1, offset = 0
+  # we accept a 1D array and assume height == 1, or a 2D array
+  # and check all lines are the same length
+  unless array.is_a? Array
+    raise Vips::Error, "Argument is not an array."
+  end
+
+  if array[0].is_a? Array
+    height = array.length
+    width = array[0].length
+    unless array.all? { |x| x.is_a? Array }
+      raise Vips::Error, "Not a 2D array."
+    end
+    unless array.all? { |x| x.length == width }
+      raise Vips::Error, "Array not rectangular."
+    end
+
+    array = array.flatten
+  else
+    height = 1
+    width = array.length
+  end
+
+  unless array.length == width * height
+    raise Vips::Error, "Bad array dimensions."
+  end
+
+  unless array.all? { |x| x.is_a? Numeric }
+    raise Vips::Error, "Not all array elements are Numeric."
+  end
+
+  image = Vips::Image.matrix_from_array width, height, array
+  raise Vips::Error if image.nil?
+
+  image.mutate do |mutable|
+    # be careful to set them as double
+    mutable.set_type! GObject::GDOUBLE_TYPE, "scale", scale.to_f
+    mutable.set_type! GObject::GDOUBLE_TYPE, "offset", offset.to_f
+  end
+end
+
+
+ +
+

+ + .new_from_buffer(data, option_string, **opts) ⇒ Image + + + + + +

+
+ +

Create a new Vips::Image for an image encoded in a format such as JPEG in a binary string. Load options may be passed as strings or appended as a hash. For example:

+ +
image = Vips::Image.new_from_buffer memory_buffer, "shrink=2"
+
+ +

or alternatively:

+ +
image = Vips::Image.new_from_buffer memory_buffer, "", shrink: 2
+
+ +

The options available depend on the file format. Try something like:

+ +
$ vips jpegload_buffer
+
+ +

at the command-line to see the available options. Not all loaders support load from buffer, but at least JPEG, PNG and TIFF images will work.

+ +

Loading is fast: only enough of the image is loaded to be able to fill out the header. Pixels will only be decompressed when they are needed.

+ + +
+
+
+

Parameters:

+
    + +
  • + + data + + + (String) + + + + — +
    +

    the data to load from

    +
    + +
  • + +
  • + + option_string + + + (String) + + + + — +
    +

    load options as a string

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :disc + (Boolean) + + + — default: + true + + + + —
    +

    Open large images via a temporary disc file

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + — default: + :random + + + + —
    +

    Access mode for file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    the loaded image

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+317
+318
+319
+320
+321
+322
+
+
# File 'lib/vips/image.rb', line 317
+
+def self.new_from_buffer data, option_string, **opts
+  loader = Vips.vips_foreign_find_load_buffer data, data.bytesize
+  raise Vips::Error if loader.nil?
+
+  Vips::Operation.call loader, [data], opts, option_string
+end
+
+
+ +
+

+ + .new_from_file(name, **opts) ⇒ Image + + + + + +

+
+ +

Return a new Vips::Image for a file on disc. This method can load images in any format supported by vips. The filename can include load options, for example:

+ +
image = Vips::Image.new_from_file "fred.jpg[shrink=2]"
+
+ +

You can also supply options as a hash, for example:

+ +
image = Vips::Image.new_from_file "fred.jpg", shrink: 2
+
+ +

The full set of options available depend upon the load operation that will be executed. Try something like:

+ +
$ vips jpegload
+
+ +

at the command-line to see a summary of the available options for the JPEG loader.

+ +

Loading is fast: only enough of the image is loaded to be able to fill out the header. Pixels will only be decompressed when they are needed.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +
    +

    the filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :disc + (Boolean) + + + — default: + true + + + + —
    +

    Open large images via a temporary disc file

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + — default: + :random + + + + —
    +

    Access mode for file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    the loaded image

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+
+
# File 'lib/vips/image.rb', line 273
+
+def self.new_from_file name, **opts
+  # very common, and Vips::vips_filename_get_filename will segv if we
+  # pass this
+  raise Vips::Error, "filename is nil" if name.nil?
+
+  filename = Vips.p2str(Vips.vips_filename_get_filename(name))
+  option_string = Vips.p2str(Vips.vips_filename_get_options(name))
+  loader = Vips.vips_foreign_find_load filename
+  raise Vips::Error if loader.nil?
+
+  Operation.call loader, [filename], opts, option_string
+end
+
+
+ +
+

+ + .new_from_memory(data, width, height, bands, format) ⇒ Image + + + + + +

+
+ +

Create a new Vips::Image from a C-style array held in memory. For example:

+ +
image = Vips::Image.black(16, 16) + 128
+data = image.write_to_memory
+
+x = Vips::Image.new_from_memory data,
+  image.width, image.height, image.bands, image.format
+
+ +

Creating a new image from a memory pointer:

+ +
ptr = FFI::MemoryPointer.new(:uchar, 10*10)
+# => #<FFI::MemoryPointer address=0x00007fc236db31d0 size=100>
+x = Vips::Image.new_from_memory(ptr, 10, 10, 1, :uchar)
+
+ +

Creating a new image from an address only pointer:

+ +
ptr = call_to_external_c_library(w: 10, h: 10)
+# => #<FFI::Pointer address=0x00007f9780813a00>
+ptr_slice = ptr.slice(0, 10*10)
+# => #<FFI::Pointer address=0x00007f9780813a00 size=100>
+x = Vips::Image.new_from_memory(ptr_slice, 10, 10, 1, :uchar)
+
+ +

new_from_memory keeps a reference to the array of pixels you pass in to try to prevent that memory from being freed by the Ruby GC while it is being used.

+ +

See new_from_memory_copy for a version of this method which does not keep a reference.

+ + +
+
+
+

Parameters:

+
    + +
  • + + data + + + (String, FFI::Pointer) + + + + — +
    +

    the data to load from

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    height in pixels

    +
    + +
  • + +
  • + + bands + + + (Integer) + + + + — +
    +

    number of bands

    +
    + +
  • + +
  • + + format + + + (Symbol) + + + + — +
    +

    band format

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    the loaded image

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+
+
# File 'lib/vips/image.rb', line 365
+
+def self.new_from_memory data, width, height, bands, format
+  # prevent data from being freed with JRuby FFI
+  if defined?(JRUBY_VERSION) && !data.is_a?(FFI::Pointer)
+    data = ::FFI::MemoryPointer.new(:char, data.bytesize).write_bytes data
+  end
+
+  if data.is_a?(FFI::Pointer)
+    # A pointer needs to know about the size of the memory it points to.
+    # If you have an address-only pointer, use the .slice method to wrap
+    # the pointer in a size aware pointer.
+    if data.size == UNKNOWN_POINTER_SIZE
+      raise Vips::Error, "size of memory is unknown"
+    end
+    size = data.size
+  else
+    size = data.bytesize
+  end
+
+  format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format
+  vi = Vips.vips_image_new_from_memory data, size,
+    width, height, bands, format_number
+  raise Vips::Error if vi.null?
+  image = new(vi)
+
+  # keep a secret ref to the underlying object .. this reference will be
+  # inherited by things that in turn depend on us, so the memory we are
+  # using will not be freed
+  image.references << data
+
+  image
+end
+
+
+ +
+

+ + .new_from_memory_copy(data, width, height, bands, format) ⇒ Image + + + + + +

+
+ +

Create a new Vips::Image from memory and copies the memory area. See new_from_memory for a version of this method which does not copy the memory area.

+ + +
+
+
+

Parameters:

+
    + +
  • + + data + + + (String, FFI::Pointer) + + + + — +
    +

    the data to load from

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    height in pixels

    +
    + +
  • + +
  • + + bands + + + (Integer) + + + + — +
    +

    number of bands

    +
    + +
  • + +
  • + + format + + + (Symbol) + + + + — +
    +

    band format

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    the loaded image

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+
+
# File 'lib/vips/image.rb', line 407
+
+def self.new_from_memory_copy data, width, height, bands, format
+  format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format
+
+  if data.is_a?(FFI::Pointer)
+    if data.size == UNKNOWN_POINTER_SIZE
+      raise Vips::Error, "size of memory is unknown"
+    end
+    size = data.size
+  else
+    size = data.bytesize
+  end
+
+  vi = Vips.vips_image_new_from_memory_copy data, size,
+    width, height, bands, format_number
+  raise Vips::Error if vi.null?
+  new(vi)
+end
+
+
+ +
+

+ + .new_from_source(source, option_string, **opts) ⇒ Image + + + + + +

+
+ +

Create a new Vips::Image from a source. Load options may be passed as strings or appended as a hash. For example:

+ +
source = Vips::Source.new_from_file("k2.jpg")
+image = Vips::Image.new_from_source source, "shrink=2"
+
+ +

or alternatively:

+ +
image = Vips::Image.new_from_source source, "", shrink: 2
+
+ +

The options available depend on the file format. Try something like:

+ +
$ vips jpegload_source
+
+ +

at the command-line to see the available options. Not all loaders support load from source, but at least JPEG, PNG and TIFF images will work.

+ +

Loading is fast: only enough data is read to be able to fill out the header. Pixels will only be read and decompressed when they are needed.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    the source to load from

    +
    + +
  • + +
  • + + option_string + + + (String) + + + + — +
    +

    load options as a string

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :disc + (Boolean) + + + — default: + true + + + + —
    +

    Open large images via a temporary disc file

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + — default: + :random + + + + —
    +

    Access mode for file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    the loaded image

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+457
+458
+459
+460
+461
+462
+
+
# File 'lib/vips/image.rb', line 457
+
+def self.new_from_source source, option_string, **opts
+  loader = Vips.vips_foreign_find_load_source source
+  raise Vips::Error if loader.nil?
+
+  Vips::Operation.call loader, [source], opts, option_string
+end
+
+
+ +
+

+ + .niftiload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load nifti volume.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1433
+
+
+
+
+ +
+

+ + .niftiload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load nifti volumes.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1445
+
+
+
+
+ +
+

+ + .openexrload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load an openexr image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1421
+
+
+
+
+ +
+

+ + .openslideload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load file with openslide.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :attach_associated + (Boolean) + + + + + —
    +

    Attach all associated images

    +
    + +
  • + +
  • + :level + (Integer) + + + + + —
    +

    Load this level from the file

    +
    + +
  • + +
  • + :autocrop + (Boolean) + + + + + —
    +

    Crop to image bounds

    +
    + +
  • + +
  • + :associated + (String) + + + + + —
    +

    Load this associated image

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1457
+
+
+
+
+ +
+

+ + .openslideload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load source with openslide.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :attach_associated + (Boolean) + + + + + —
    +

    Attach all associated images

    +
    + +
  • + +
  • + :level + (Integer) + + + + + —
    +

    Load this level from the file

    +
    + +
  • + +
  • + :autocrop + (Boolean) + + + + + —
    +

    Crop to image bounds

    +
    + +
  • + +
  • + :associated + (String) + + + + + —
    +

    Load this associated image

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1473
+
+
+
+
+ +
+

+ + .pdfload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load pdf from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :dpi + (Float) + + + + + —
    +

    Render at this DPI

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale output by this factor

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1537
+
+
+
+
+ +
+

+ + .pdfload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load pdf from buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :dpi + (Float) + + + + + —
    +

    Render at this DPI

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale output by this factor

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1554
+
+
+
+
+ +
+

+ + .pdfload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load pdf from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :dpi + (Float) + + + + + —
    +

    Render at this DPI

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale output by this factor

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1571
+
+
+
+
+ +
+

+ + .perlin(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a perlin noise image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :cell_size + (Integer) + + + + + —
    +

    Size of Perlin cells

    +
    + +
  • + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :seed + (Integer) + + + + + —
    +

    Random number seed

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 863
+
+
+
+
+ +
+

+ + .pngload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load png from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1211
+
+
+
+
+ +
+

+ + .pngload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load png from buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1223
+
+
+
+
+ +
+

+ + .pngload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load png from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1235
+
+
+
+
+ +
+

+ + .ppmload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load ppm from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 989
+
+
+
+
+ +
+

+ + .ppmload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load ppm base class.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1001
+
+
+
+
+ +
+

+ + .profile_load(name, **opts) ⇒ VipsBlob + + + + + +

+
+ +

Load named icc profile.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +
    +

    Profile name

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Loaded profile

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2594
+
+
+
+
+ +
+

+ + .radload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load a radiance image from a file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1013
+
+
+
+
+ +
+

+ + .radload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load rad from buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1025
+
+
+
+
+ +
+

+ + .radload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load rad from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1037
+
+
+
+
+ +
+

+ + .rawload(filename, width, height, bands, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load raw data from a file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + bands + + + (Integer) + + + + — +
    +

    Number of bands in image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :offset + (guint64) + + + + + —
    +

    Offset in bytes from start of file

    +
    + +
  • + +
  • + :format + (Vips::BandFormat) + + + + + —
    +

    Pixel format in image

    +
    + +
  • + +
  • + :interpretation + (Vips::Interpretation) + + + + + —
    +

    Pixel interpretation

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 935
+
+
+
+
+ +
+

+ + .respond_to_missing?(name, include_all = false) ⇒ Boolean + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+216
+217
+218
+219
+220
+221
+
+
# File 'lib/vips/image.rb', line 216
+
+def self.respond_to_missing? name, include_all = false
+  # respond to all vips operations by nickname
+  return true if Vips.type_find("VipsOperation", name.to_s) != 0
+
+  super
+end
+
+
+ +
+

+ + .sines(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a 2d sine wave.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
  • + :hfreq + (Float) + + + + + —
    +

    Horizontal spatial frequency

    +
    + +
  • + +
  • + :vfreq + (Float) + + + + + —
    +

    Vertical spatial frequency

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 664
+
+
+
+
+ +
+

+ + .sum(im, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Sum an array of images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + im + + + (Array<Image>) + + + + — +
    +

    Array of input images

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 79
+
+
+
+
+ +
+

+ + .svgload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load svg with rsvg.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :dpi + (Float) + + + + + —
    +

    Render at this DPI

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale output by this factor

    +
    + +
  • + +
  • + :unlimited + (Boolean) + + + + + —
    +

    Allow SVG of any size

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1049
+
+
+
+
+ +
+

+ + .svgload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load svg with rsvg.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :dpi + (Float) + + + + + —
    +

    Render at this DPI

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale output by this factor

    +
    + +
  • + +
  • + :unlimited + (Boolean) + + + + + —
    +

    Allow SVG of any size

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1064
+
+
+
+
+ +
+

+ + .svgload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load svg from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :dpi + (Float) + + + + + —
    +

    Render at this DPI

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale output by this factor

    +
    + +
  • + +
  • + :unlimited + (Boolean) + + + + + —
    +

    Allow SVG of any size

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1079
+
+
+
+
+ +
+

+ + .switch(tests, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Find the index of the first non-zero pixel in tests.

+ + +
+
+
+

Parameters:

+
    + +
  • + + tests + + + (Array<Image>) + + + + — +
    +

    Table of images to test

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 873
+
+
+
+
+ +
+

+ + .system(cmd_format, **opts) ⇒ nil, Hash<Symbol => Object> + + + + + +

+
+ +

Run an external command.

+ + +
+
+
+

Parameters:

+
    + +
  • + + cmd_format + + + (String) + + + + — +
    +

    Command to run

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :im + (Array<Image>) + + + + + —
    +

    Array of input images

    +
    + +
  • + +
  • + :out_format + (String) + + + + + —
    +

    Format for output filename

    +
    + +
  • + +
  • + :in_format + (String) + + + + + —
    +

    Format for input filename

    +
    + +
  • + +
  • + :out + (Vips::Image) + + + + + —
    +

    Output Output image

    +
    + +
  • + +
  • + :log + (String) + + + + + —
    +

    Output Command log

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil, Hash<Symbol => Object>) + + + + — +
    +

    Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 4
+
+
+
+
+ +
+

+ + .text(text, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Make a text image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + text + + + (String) + + + + — +
    +

    Text to render

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :font + (String) + + + + + —
    +

    Font to render with

    +
    + +
  • + +
  • + :width + (Integer) + + + + + —
    +

    Maximum image width in pixels

    +
    + +
  • + +
  • + :height + (Integer) + + + + + —
    +

    Maximum image height in pixels

    +
    + +
  • + +
  • + :align + (Vips::Align) + + + + + —
    +

    Align on the low, centre or high edge

    +
    + +
  • + +
  • + :rgba + (Boolean) + + + + + —
    +

    Enable RGBA output

    +
    + +
  • + +
  • + :dpi + (Integer) + + + + + —
    +

    DPI to render at

    +
    + +
  • + +
  • + :justify + (Boolean) + + + + + —
    +

    Justify lines

    +
    + +
  • + +
  • + :spacing + (Integer) + + + + + —
    +

    Line spacing

    +
    + +
  • + +
  • + :fontfile + (String) + + + + + —
    +

    Load this font file

    +
    + +
  • + +
  • + :autofit_dpi + (Integer) + + + + + —
    +

    Output DPI selected by autofit

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 623
+
+
+
+
+ +
+

+ + .thumbnail(filename, width, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Generate thumbnail from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to read from

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Size to this width

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :height + (Integer) + + + + + —
    +

    Size to this height

    +
    + +
  • + +
  • + :size + (Vips::Size) + + + + + —
    +

    Only upsize, only downsize, or both

    +
    + +
  • + +
  • + :no_rotate + (Boolean) + + + + + —
    +

    Don't use orientation tags to rotate image upright

    +
    + +
  • + +
  • + :crop + (Vips::Interesting) + + + + + —
    +

    Reduce to fill target rectangle, then crop

    +
    + +
  • + +
  • + :linear + (Boolean) + + + + + —
    +

    Reduce in linear light

    +
    + +
  • + +
  • + :import_profile + (String) + + + + + —
    +

    Fallback import profile

    +
    + +
  • + +
  • + :export_profile + (String) + + + + + —
    +

    Fallback export profile

    +
    + +
  • + +
  • + :intent + (Vips::Intent) + + + + + —
    +

    Rendering intent

    +
    + +
  • + +
  • + :auto_rotate + (Boolean) + + + + + —
    +

    Use orientation tags to rotate image upright

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2220
+
+
+
+
+ +
+

+ + .thumbnail_buffer(buffer, width, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Generate thumbnail from buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Size to this width

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :option_string + (String) + + + + + —
    +

    Options that are passed on to the underlying loader

    +
    + +
  • + +
  • + :height + (Integer) + + + + + —
    +

    Size to this height

    +
    + +
  • + +
  • + :size + (Vips::Size) + + + + + —
    +

    Only upsize, only downsize, or both

    +
    + +
  • + +
  • + :no_rotate + (Boolean) + + + + + —
    +

    Don't use orientation tags to rotate image upright

    +
    + +
  • + +
  • + :crop + (Vips::Interesting) + + + + + —
    +

    Reduce to fill target rectangle, then crop

    +
    + +
  • + +
  • + :linear + (Boolean) + + + + + —
    +

    Reduce in linear light

    +
    + +
  • + +
  • + :import_profile + (String) + + + + + —
    +

    Fallback import profile

    +
    + +
  • + +
  • + :export_profile + (String) + + + + + —
    +

    Fallback export profile

    +
    + +
  • + +
  • + :intent + (Vips::Intent) + + + + + —
    +

    Rendering intent

    +
    + +
  • + +
  • + :auto_rotate + (Boolean) + + + + + —
    +

    Use orientation tags to rotate image upright

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2236
+
+
+
+
+ +
+

+ + .thumbnail_source(source, width, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Generate thumbnail from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Size to this width

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :option_string + (String) + + + + + —
    +

    Options that are passed on to the underlying loader

    +
    + +
  • + +
  • + :height + (Integer) + + + + + —
    +

    Size to this height

    +
    + +
  • + +
  • + :size + (Vips::Size) + + + + + —
    +

    Only upsize, only downsize, or both

    +
    + +
  • + +
  • + :no_rotate + (Boolean) + + + + + —
    +

    Don't use orientation tags to rotate image upright

    +
    + +
  • + +
  • + :crop + (Vips::Interesting) + + + + + —
    +

    Reduce to fill target rectangle, then crop

    +
    + +
  • + +
  • + :linear + (Boolean) + + + + + —
    +

    Reduce in linear light

    +
    + +
  • + +
  • + :import_profile + (String) + + + + + —
    +

    Fallback import profile

    +
    + +
  • + +
  • + :export_profile + (String) + + + + + —
    +

    Fallback export profile

    +
    + +
  • + +
  • + :intent + (Vips::Intent) + + + + + —
    +

    Rendering intent

    +
    + +
  • + +
  • + :auto_rotate + (Boolean) + + + + + —
    +

    Use orientation tags to rotate image upright

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2268
+
+
+
+
+ +
+

+ + .tiffload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load tiff from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the image

    +
    + +
  • + +
  • + :subifd + (Integer) + + + + + —
    +

    Select subifd index

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using orientation tag

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1349
+
+
+
+
+ +
+

+ + .tiffload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load tiff from buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the image

    +
    + +
  • + +
  • + :subifd + (Integer) + + + + + —
    +

    Select subifd index

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using orientation tag

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1365
+
+
+
+
+ +
+

+ + .tiffload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load tiff from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the image

    +
    + +
  • + +
  • + :subifd + (Integer) + + + + + —
    +

    Select subifd index

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :autorotate + (Boolean) + + + + + —
    +

    Rotate image using orientation tag

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1381
+
+
+
+
+ +
+

+ + .tonelut(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Build a look-up table.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :in_max + (Integer) + + + + + —
    +

    Size of LUT to build

    +
    + +
  • + +
  • + :out_max + (Integer) + + + + + —
    +

    Maximum value in output LUT

    +
    + +
  • + +
  • + :Lb + (Float) + + + + + —
    +

    Lowest value in output

    +
    + +
  • + +
  • + :Lw + (Float) + + + + + —
    +

    Highest value in output

    +
    + +
  • + +
  • + :Ps + (Float) + + + + + —
    +

    Position of shadow

    +
    + +
  • + +
  • + :Pm + (Float) + + + + + —
    +

    Position of mid-tones

    +
    + +
  • + +
  • + :Ph + (Float) + + + + + —
    +

    Position of highlights

    +
    + +
  • + +
  • + :S + (Float) + + + + + —
    +

    Adjust shadows by this much

    +
    + +
  • + +
  • + :M + (Float) + + + + + —
    +

    Adjust mid-tones by this much

    +
    + +
  • + +
  • + :H + (Float) + + + + + —
    +

    Adjust highlights by this much

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 823
+
+
+
+
+ +
+

+ + .vipsload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load vips from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 953
+
+
+
+
+ +
+

+ + .vipsload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load vips from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 965
+
+
+
+
+ +
+

+ + .webpload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load webp from file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale factor on load

    +
    + +
  • + +
  • + :shrink + (Integer) + + + + + —
    +

    Shrink factor on load

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1301
+
+
+
+
+ +
+

+ + .webpload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load webp from buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + buffer + + + (VipsBlob) + + + + — +
    +

    Buffer to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale factor on load

    +
    + +
  • + +
  • + :shrink + (Integer) + + + + + —
    +

    Shrink factor on load

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1317
+
+
+
+
+ +
+

+ + .webpload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Load webp from source.

+ + +
+
+
+

Parameters:

+
    + +
  • + + source + + + (Vips::Source) + + + + — +
    +

    Source to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :page + (Integer) + + + + + —
    +

    Load this page from the file

    +
    + +
  • + +
  • + :n + (Integer) + + + + + —
    +

    Load this many pages

    +
    + +
  • + +
  • + :scale + (Float) + + + + + —
    +

    Scale factor on load

    +
    + +
  • + +
  • + :shrink + (Integer) + + + + + —
    +

    Shrink factor on load

    +
    + +
  • + +
  • + :memory + (Boolean) + + + + + —
    +

    Force open via memory

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Required access pattern for this file

    +
    + +
  • + +
  • + :sequential + (Boolean) + + + + + —
    +

    Sequential read only

    +
    + +
  • + +
  • + :fail + (Boolean) + + + + + —
    +

    Fail on first error

    +
    + +
  • + +
  • + :disc + (Boolean) + + + + + —
    +

    Open to disc

    +
    + +
  • + +
  • + :flags + (Vips::ForeignFlags) + + + + + —
    +

    Output Flags for this file

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1333
+
+
+
+
+ +
+

+ + .worley(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a worley noise image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :cell_size + (Integer) + + + + + —
    +

    Size of Worley cells

    +
    + +
  • + +
  • + :seed + (Integer) + + + + + —
    +

    Random number seed

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 854
+
+
+
+
+ +
+

+ + .xyz(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make an image where pixel values are coordinates.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :csize + (Integer) + + + + + —
    +

    Size of third dimension

    +
    + +
  • + +
  • + :dsize + (Integer) + + + + + —
    +

    Size of fourth dimension

    +
    + +
  • + +
  • + :esize + (Integer) + + + + + —
    +

    Size of fifth dimension

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 593
+
+
+
+
+ +
+

+ + .zone(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Make a zone plate.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output an unsigned char image

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 656
+
+
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #!Image + + + + + +

+
+ +

Equivalent to image ^ -1

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    image with bits flipped

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1077
+1078
+1079
+
+
# File 'lib/vips/image.rb', line 1077
+
+def !
+  self ^ -1
+end
+
+
+ +
+

+ + #!=(other) ⇒ Image + + + + + +

+
+ +

Compare inequality to nil, an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (nil, Image, Real, Array<Real>) + + + + — +
    +

    test inequality to this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of inequality

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+
+
# File 'lib/vips/image.rb', line 1151
+
+def != other
+  # for equality, we must allow tests against nil
+  if other.nil?
+    true
+  else
+    call_enum "relational", other, :noteq
+  end
+end
+
+
+ +
+

+ + #%(other) ⇒ Image + + + + + +

+
+ +

Remainder after integer division with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    self modulo this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of modulo

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1021
+1022
+1023
+1024
+
+
# File 'lib/vips/image.rb', line 1021
+
+def % other
+  other.is_a?(Vips::Image) ?
+      remainder(other) : remainder_const(other)
+end
+
+
+ +
+

+ + #&(other) ⇒ Image + + + + + +

+
+ +

Integer bitwise AND with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    bitwise AND with this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of bitwise AND

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1062
+1063
+1064
+
+
# File 'lib/vips/image.rb', line 1062
+
+def & other
+  call_enum "boolean", other, :and
+end
+
+
+ +
+

+ + #*(other) ⇒ Image + + + + + +

+
+ +

Multiply an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    Thing to multiply by self

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of multiplication

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1003
+1004
+1005
+1006
+
+
# File 'lib/vips/image.rb', line 1003
+
+def * other
+  other.is_a?(Vips::Image) ?
+      multiply(other) : linear(other, 0)
+end
+
+
+ +
+

+ + #**(other) ⇒ Image + + + + + +

+
+ +

Raise to power of an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    self to the power of this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of power

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1030
+1031
+1032
+
+
# File 'lib/vips/image.rb', line 1030
+
+def ** other
+  call_enum "math2", other, :pow
+end
+
+
+ +
+

+ + #+(other) ⇒ Image + + + + + +

+
+ +

Add an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    Thing to add to self

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of addition

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+985
+986
+987
+988
+
+
# File 'lib/vips/image.rb', line 985
+
+def + other
+  other.is_a?(Vips::Image) ?
+      add(other) : linear(1, other)
+end
+
+
+ +
+

+ + #+@Image + + + + + +

+
+ +

Returns image.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1089
+1090
+1091
+
+
# File 'lib/vips/image.rb', line 1089
+
+def +@
+  self
+end
+
+
+ +
+

+ + #-(other) ⇒ Image + + + + + +

+
+ +

Subtract an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    Thing to subtract from self

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of subtraction

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+994
+995
+996
+997
+
+
# File 'lib/vips/image.rb', line 994
+
+def - other
+  other.is_a?(Vips::Image) ?
+      subtract(other) : linear(1, Image.smap(other) { |x| x * -1 })
+end
+
+
+ +
+

+ + #-@Image + + + + + +

+
+ +

Equivalent to image * -1

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    negative of image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1096
+1097
+1098
+
+
# File 'lib/vips/image.rb', line 1096
+
+def -@
+  self * -1
+end
+
+
+ +
+

+ + #/(other) ⇒ Image + + + + + +

+
+ +

Divide an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    Thing to divide self by

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of division

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1012
+1013
+1014
+1015
+
+
# File 'lib/vips/image.rb', line 1012
+
+def / other
+  other.is_a?(Vips::Image) ?
+      divide(other) : linear(Image.smap(other) { |x| 1.0 / x }, 0)
+end
+
+
+ +
+

+ + #<(other) ⇒ Image + + + + + +

+
+ +

Relational less than with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    relational less than with this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of less than

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1104
+1105
+1106
+
+
# File 'lib/vips/image.rb', line 1104
+
+def < other
+  call_enum "relational", other, :less
+end
+
+
+ +
+

+ + #<<(other) ⇒ Image + + + + + +

+
+ +

Integer left shift with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    shift left by this much

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of left shift

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1038
+1039
+1040
+
+
# File 'lib/vips/image.rb', line 1038
+
+def << other
+  call_enum "boolean", other, :lshift
+end
+
+
+ +
+

+ + #<=(other) ⇒ Image + + + + + +

+
+ +

Relational less than or equal to with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    relational less than or equal to with this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of less than or equal to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1113
+1114
+1115
+
+
# File 'lib/vips/image.rb', line 1113
+
+def <= other
+  call_enum "relational", other, :lesseq
+end
+
+
+ +
+

+ + #==(other) ⇒ Image + + + + + +

+
+ +

Compare equality to nil, an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (nil, Image, Real, Array<Real>) + + + + — +
    +

    test equality to this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of equality

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+
+
# File 'lib/vips/image.rb', line 1138
+
+def == other
+  # for equality, we must allow tests against nil
+  if other.nil?
+    false
+  else
+    call_enum "relational", other, :equal
+  end
+end
+
+
+ +
+

+ + #>(other) ⇒ Image + + + + + +

+
+ +

Relational more than with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    relational more than with this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of more than

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1121
+1122
+1123
+
+
# File 'lib/vips/image.rb', line 1121
+
+def > other
+  call_enum "relational", other, :more
+end
+
+
+ +
+

+ + #>=(other) ⇒ Image + + + + + +

+
+ +

Relational more than or equal to with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    relational more than or equal to with this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of more than or equal to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1130
+1131
+1132
+
+
# File 'lib/vips/image.rb', line 1130
+
+def >= other
+  call_enum "relational", other, :moreeq
+end
+
+
+ +
+

+ + #>>(other) ⇒ Image + + + + + +

+
+ +

Integer right shift with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    shift right by this much

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of right shift

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1046
+1047
+1048
+
+
# File 'lib/vips/image.rb', line 1046
+
+def >> other
+  call_enum "boolean", other, :rshift
+end
+
+
+ +
+

+ + #[](index) ⇒ Image + + + + + +

+
+ +

Fetch bands using a number or a range

+ + +
+
+
+

Parameters:

+
    + +
  • + + index + + + (Numeric, Range) + + + + — +
    +

    extract these band(s)

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    extracted band(s)

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+
+
# File 'lib/vips/image.rb', line 1164
+
+def [] index
+  if index.is_a? Range
+    n = index.size
+    extract_band index.begin, n: n
+  elsif index.is_a? Numeric
+    extract_band index
+  else
+    raise Vips::Error, "[] index is not range or numeric."
+  end
+end
+
+
+ +
+

+ + #^(other) ⇒ Image + + + + + +

+
+ +

Integer bitwise EOR with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    bitwise EOR with this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of bitwise EOR

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1070
+1071
+1072
+
+
# File 'lib/vips/image.rb', line 1070
+
+def ^ other
+  call_enum "boolean", other, :eor
+end
+
+
+ +
+

+ + #abs(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Absolute value of an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 104
+
+
+
+
+ +
+

+ + #acosImage + + + + + +

+
+ +

Return the inverse cosine of an image in degrees.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    inverse cosine of each pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1426
+1427
+1428
+
+
# File 'lib/vips/image.rb', line 1426
+
+def acos
+  math :acos
+end
+
+
+ +
+

+ + #add(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Add two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 15
+
+
+
+
+ +
+

+ + #add_alphaImage + + + + + +

+
+ +

Append an alpha channel to an image.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    new image

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+951
+952
+953
+954
+955
+956
+957
+
+
# File 'lib/vips/image.rb', line 951
+
+def add_alpha
+  ptr = GenericPtr.new
+  result = Vips.vips_addalpha self, ptr
+  raise Vips::Error if result != 0
+
+  Vips::Image.new ptr[:value]
+end
+
+
+ +
+

+ + #affine(matrix, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Affine transform of an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + matrix + + + (Array<Double>) + + + + — +
    +

    Transformation matrix

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :interpolate + (Vips::Interpolate) + + + + + —
    +

    Interpolate pixels with this

    +
    + +
  • + +
  • + :oarea + (Array<Integer>) + + + + + —
    +

    Area of output to generate

    +
    + +
  • + +
  • + :odx + (Float) + + + + + —
    +

    Horizontal output displacement

    +
    + +
  • + +
  • + :ody + (Float) + + + + + —
    +

    Vertical output displacement

    +
    + +
  • + +
  • + :idx + (Float) + + + + + —
    +

    Horizontal input displacement

    +
    + +
  • + +
  • + :idy + (Float) + + + + + —
    +

    Vertical input displacement

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :premultiplied + (Boolean) + + + + + —
    +

    Images have premultiplied alpha

    +
    + +
  • + +
  • + :extend + (Vips::Extend) + + + + + —
    +

    How to generate the extra pixels

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2351
+
+
+
+
+ +
+

+ + #asinImage + + + + + +

+
+ +

Return the inverse sine of an image in degrees.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    inverse sine of each pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1419
+1420
+1421
+
+
# File 'lib/vips/image.rb', line 1419
+
+def asin
+  math :asin
+end
+
+
+ +
+

+ + #atanImage + + + + + +

+
+ +

Return the inverse tangent of an image in degrees.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    inverse tangent of each pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1433
+1434
+1435
+
+
# File 'lib/vips/image.rb', line 1433
+
+def atan
+  math :atan
+end
+
+
+ +
+

+ + #autorot(**opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Autorotate image by exif tag.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :angle + (Vips::Angle) + + + + + —
    +

    Output Angle image was rotated by

    +
    + +
  • + +
  • + :flip + (Boolean) + + + + + —
    +

    Output Whether the image was flipped or not

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 461
+
+
+
+
+ +
+

+ + #avg(**opts) ⇒ Float + + + + + +

+
+ +

Find image average.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +
    +

    Output value

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 159
+
+
+
+
+ +
+

+ + #bandandImage + + + + + +

+
+ +

AND the bands of an image together

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    all bands ANDed together

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1235
+1236
+1237
+
+
# File 'lib/vips/image.rb', line 1235
+
+def bandand
+  bandbool :and
+end
+
+
+ +
+

+ + #bandbool(boolean, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Boolean operation across image bands.

+ + +
+
+
+

Parameters:

+
    + +
  • + + boolean + + + (Vips::OperationBoolean) + + + + — +
    +

    boolean to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 429
+
+
+
+
+ +
+

+ + #bandeorImage + + + + + +

+
+ +

EOR the bands of an image together

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    all bands EORed together

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1249
+1250
+1251
+
+
# File 'lib/vips/image.rb', line 1249
+
+def bandeor
+  bandbool :eor
+end
+
+
+ +
+

+ + #bandfold(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Fold up x axis into bands.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :factor + (Integer) + + + + + —
    +

    Fold by this factor

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 474
+
+
+
+
+ +
+

+ + #bandjoin(other) ⇒ Image + + + + + +

+
+ +

Join a set of images bandwise.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Array<Image>, Real, Array<Real>) + + + + — +
    +

    bands to append

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    many band image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+
+
# File 'lib/vips/image.rb', line 1264
+
+def bandjoin other
+  unless other.is_a? Array
+    other = [other]
+  end
+
+  # if other is just Numeric, we can use bandjoin_const
+  not_all_real = !other.all? { |x| x.is_a? Numeric }
+
+  if not_all_real
+    Vips::Image.bandjoin([self] + other)
+  else
+    bandjoin_const other
+  end
+end
+
+
+ +
+

+ + #bandjoin_const(c, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Append a constant band to an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + c + + + (Array<Double>) + + + + — +
    +

    Array of constants to add

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 411
+
+
+
+
+ +
+

+ + #bandmean(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Band-wise average.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 424
+
+
+
+
+ +
+

+ + #bandorImage + + + + + +

+
+ +

OR the bands of an image together

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    all bands ORed together

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1242
+1243
+1244
+
+
# File 'lib/vips/image.rb', line 1242
+
+def bandor
+  bandbool :or
+end
+
+
+ +
+

+ + #bandsInteger + + + + + +

+
+ +

Get number of image bands.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    number of image bands

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+852
+853
+854
+
+
# File 'lib/vips/image.rb', line 852
+
+def bands
+  Vips.vips_image_get_bands self
+end
+
+
+ +
+

+ + #bandsplitArray<Image> + + + + + +

+
+ +

Split an n-band image into n separate images.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array<Image>) + + + + — +
    +

    Array of n one-band images

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1256
+1257
+1258
+
+
# File 'lib/vips/image.rb', line 1256
+
+def bandsplit
+  (0...bands).map { |i| extract_band i }
+end
+
+
+ +
+

+ + #bandunfold(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Unfold image bands into x axis.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :factor + (Integer) + + + + + —
    +

    Unfold by this factor

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 480
+
+
+
+
+ +
+

+ + #boolean(right, boolean, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Boolean operation on two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + boolean + + + (Vips::OperationBoolean) + + + + — +
    +

    boolean to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 52
+
+
+
+
+ +
+

+ + #boolean_const(boolean, c, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Boolean operations against a constant.

+ + +
+
+
+

Parameters:

+
    + +
  • + + boolean + + + (Vips::OperationBoolean) + + + + — +
    +

    boolean to perform

    +
    + +
  • + +
  • + + c + + + (Array<Double>) + + + + — +
    +

    Array of constants

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 133
+
+
+
+
+ +
+

+ + #buildlut(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Build a look-up table.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 812
+
+
+
+
+ +
+

+ + #byteswap(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Byteswap an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 548
+
+
+
+
+ +
+

+ + #cache(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Cache an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :max_tiles + (Integer) + + + + + —
    +

    Maximum number of tiles to cache

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 309
+
+
+
+
+ +
+

+ + #canny(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Canny edge detector.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :sigma + (Float) + + + + + —
    +

    Sigma of Gaussian

    +
    + +
  • + +
  • + :precision + (Vips::Precision) + + + + + —
    +

    Convolve with this precision

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2764
+
+
+
+
+ +
+

+ + #case(cases, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Use pixel values to pick cases from an array of images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + cases + + + (Array<Image>) + + + + — +
    +

    Array of case images

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2607
+
+
+
+
+ +
+

+ + #cast(format, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Cast an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + format + + + (Vips::BandFormat) + + + + — +
    +

    Format to cast to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :shift + (Boolean) + + + + + —
    +

    Shift integer values up and down

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 442
+
+
+
+
+ +
+

+ + #ceilImage + + + + + +

+
+ +

Return the smallest integral value not less than the argument.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    ceil of image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1221
+1222
+1223
+
+
# File 'lib/vips/image.rb', line 1221
+
+def ceil
+  round :ceil
+end
+
+
+ +
+

+ + #CMC2LCh(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform lch to cmc.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2437
+
+
+
+
+ +
+

+ + #CMYK2XYZ(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform cmyk to xyz.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2584
+
+
+
+
+ +
+

+ + #codingSymbol + + + + + +

+
+ +

Get image coding.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + + — +
    +

    image coding

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+873
+874
+875
+
+
# File 'lib/vips/image.rb', line 873
+
+def coding
+  get "coding"
+end
+
+
+ +
+

+ + #colourspace(space, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Convert to a new colorspace.

+ + +
+
+
+

Parameters:

+
    + +
  • + + space + + + (Vips::Interpretation) + + + + — +
    +

    Destination color space

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+ + + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2403
+
+
+
+
+ +
+

+ + #compass(mask, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Convolve with rotating mask.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input matrix image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :times + (Integer) + + + + + —
    +

    Rotate and convolve this many times

    +
    + +
  • + +
  • + :angle + (Vips::Angle45) + + + + + —
    +

    Rotate mask by this much between convolutions

    +
    + +
  • + +
  • + :combine + (Vips::Combine) + + + + + —
    +

    Combine convolution results like this

    +
    + +
  • + +
  • + :precision + (Vips::Precision) + + + + + —
    +

    Convolve with this precision

    +
    + +
  • + +
  • + :layers + (Integer) + + + + + —
    +

    Use this many layers in approximation

    +
    + +
  • + +
  • + :cluster + (Integer) + + + + + —
    +

    Cluster lines closer than this in approximation

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2704
+
+
+
+
+ +
+

+ + #complex(cmplx, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Perform a complex operation on an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + cmplx + + + (Vips::OperationComplex) + + + + — +
    +

    complex to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 147
+
+
+
+
+ +
+

+ + #complex2(right, cmplx, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Complex binary operations on two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + cmplx + + + (Vips::OperationComplex2) + + + + — +
    +

    binary complex operation to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 66
+
+
+
+
+ +
+

+ + #complexform(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Form a complex image from two real images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 73
+
+
+
+
+ +
+

+ + #complexget(get, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Get a component from a complex image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + get + + + (Vips::OperationComplexget) + + + + — +
    +

    complex to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 153
+
+
+
+
+ +
+

+ + #composite(overlay, mode, **opts) ⇒ Image + + + + + +

+
+ +

Composite a set of images with a set of blend modes.

+ + +
+
+
+

Parameters:

+
    + +
  • + + overlay + + + (Image, Array<Image>) + + + + — +
    +

    images to composite

    +
    + +
  • + +
  • + + mode + + + (BlendMode, Array<BlendMode>) + + + + — +
    +

    blend modes to use

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :x + (Array<Integer>) + + + + + —
    +

    x positions of overlay

    +
    + +
  • + +
  • + :y + (Array<Integer>) + + + + + —
    +

    y positions of overlay

    +
    + +
  • + +
  • + :compositing_space + (Vips::Interpretation) + + + + + —
    +

    Composite images in this colour space

    +
    + +
  • + +
  • + :premultiplied + (Boolean) + + + + + —
    +

    Images have premultiplied alpha

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    blended image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+
+
# File 'lib/vips/image.rb', line 1290
+
+def composite overlay, mode, **opts
+  unless overlay.is_a? Array
+    overlay = [overlay]
+  end
+  unless mode.is_a? Array
+    mode = [mode]
+  end
+
+  mode = mode.map do |x|
+    GObject::GValue.from_nick Vips::BLEND_MODE_TYPE, x
+  end
+
+  Vips::Image.composite([self] + overlay, mode, **opts)
+end
+
+
+ +
+

+ + #composite2(overlay, mode, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Blend a pair of images with a blend mode.

+ + +
+
+
+

Parameters:

+
    + +
  • + + overlay + + + (Vips::Image) + + + + — +
    +

    Overlay image

    +
    + +
  • + +
  • + + mode + + + (Vips::BlendMode) + + + + — +
    +

    VipsBlendMode to join with

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :x + (Integer) + + + + + —
    +

    x position of overlay

    +
    + +
  • + +
  • + :y + (Integer) + + + + + —
    +

    y position of overlay

    +
    + +
  • + +
  • + :compositing_space + (Vips::Interpretation) + + + + + —
    +

    Composite images in this colour space

    +
    + +
  • + +
  • + :premultiplied + (Boolean) + + + + + —
    +

    Images have premultiplied alpha

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 564
+
+
+
+
+ +
+

+ + #conjImage + + + + + +

+
+ +

Return the complex conjugate of an image.

+ +

The image can be complex, in which case the return image will also be complex, or must have an even number of bands, in which case pairs of bands are treated as (x, y) coordinates.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    complex conjugate

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1383
+1384
+1385
+
+
# File 'lib/vips/image.rb', line 1383
+
+def conj
+  Image.run_cmplx(self) { |x| x.complex :conj }
+end
+
+
+ +
+

+ + #conv(mask, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Convolution operation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input matrix image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :precision + (Vips::Precision) + + + + + —
    +

    Convolve with this precision

    +
    + +
  • + +
  • + :layers + (Integer) + + + + + —
    +

    Use this many layers in approximation

    +
    + +
  • + +
  • + :cluster + (Integer) + + + + + —
    +

    Cluster lines closer than this in approximation

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2675
+
+
+
+
+ +
+

+ + #conva(mask, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Approximate integer convolution.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input matrix image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :layers + (Integer) + + + + + —
    +

    Use this many layers in approximation

    +
    + +
  • + +
  • + :cluster + (Integer) + + + + + —
    +

    Cluster lines closer than this in approximation

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2684
+
+
+
+
+ +
+

+ + #convasep(mask, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Approximate separable integer convolution.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input matrix image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :layers + (Integer) + + + + + —
    +

    Use this many layers in approximation

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2725
+
+
+
+
+ +
+

+ + #convf(mask, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Float convolution operation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input matrix image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2692
+
+
+
+
+ +
+

+ + #convi(mask, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Int convolution operation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input matrix image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2698
+
+
+
+
+ +
+

+ + #convsep(mask, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Seperable convolution operation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input matrix image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :precision + (Vips::Precision) + + + + + —
    +

    Convolve with this precision

    +
    + +
  • + +
  • + :layers + (Integer) + + + + + —
    +

    Use this many layers in approximation

    +
    + +
  • + +
  • + :cluster + (Integer) + + + + + —
    +

    Cluster lines closer than this in approximation

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2716
+
+
+
+
+ +
+

+ + #copy(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Copy an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :swap + (Boolean) + + + + + —
    +

    Swap bytes in image between little and big-endian

    +
    + +
  • + +
  • + :width + (Integer) + + + + + —
    +

    Image width in pixels

    +
    + +
  • + +
  • + :height + (Integer) + + + + + —
    +

    Image height in pixels

    +
    + +
  • + +
  • + :bands + (Integer) + + + + + —
    +

    Number of bands in image

    +
    + +
  • + +
  • + :format + (Vips::BandFormat) + + + + + —
    +

    Pixel format in image

    +
    + +
  • + +
  • + :coding + (Vips::Coding) + + + + + —
    +

    Pixel coding

    +
    + +
  • + +
  • + :interpretation + (Vips::Interpretation) + + + + + —
    +

    Pixel interpretation

    +
    + +
  • + +
  • + :xres + (Float) + + + + + —
    +

    Horizontal resolution in pixels/mm

    +
    + +
  • + +
  • + :yres + (Float) + + + + + —
    +

    Vertical resolution in pixels/mm

    +
    + +
  • + +
  • + :xoffset + (Integer) + + + + + —
    +

    Horizontal offset of origin

    +
    + +
  • + +
  • + :yoffset + (Integer) + + + + + —
    +

    Vertical offset of origin

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 265
+
+
+
+
+ +
+

+ + #copy_memoryImage + + + + + +

+
+ +

Copy an image to a memory area.

+ +

This can be useful for reusing results, but can obviously use a lot of memory for large images. See #tilecache for a way of caching parts of an image.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    new memory image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+967
+968
+969
+970
+
+
# File 'lib/vips/image.rb', line 967
+
+def copy_memory
+  new_image = Vips.vips_image_copy_memory self
+  Vips::Image.new new_image
+end
+
+
+ +
+

+ + #cosImage + + + + + +

+
+ +

Return the cosine of an image in degrees.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    cosine of each pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1405
+1406
+1407
+
+
# File 'lib/vips/image.rb', line 1405
+
+def cos
+  math :cos
+end
+
+
+ +
+

+ + #countlines(direction, **opts) ⇒ Float + + + + + +

+
+ +

Count lines in an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + direction + + + (Vips::Direction) + + + + — +
    +

    Countlines left-right or up-down

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +
    +

    Number of lines

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2819
+
+
+
+
+ +
+

+ + #crop(left, top, width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Extract an area from an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + left + + + (Integer) + + + + — +
    +

    Left edge of extract area

    +
    + +
  • + +
  • + + top + + + (Integer) + + + + — +
    +

    Top edge of extract area

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Width of extract area

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Height of extract area

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 387
+
+
+
+
+ +
+

+ + #cross_phase(other) ⇒ Image + + + + + +

+
+ +

Calculate the cross phase of two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    cross phase with this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    cross phase

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1391
+1392
+1393
+
+
# File 'lib/vips/image.rb', line 1391
+
+def cross_phase other
+  complex2 other, :cross_phase
+end
+
+
+ +
+

+ + #csvsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to csv.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :separator + (String) + + + + + —
    +

    Separator characters

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1620
+
+
+
+
+ +
+

+ + #csvsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image to csv.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :separator + (String) + + + + + —
    +

    Separator characters

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1630
+
+
+
+
+ +
+

+ + #dE00(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Calculate de00.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand input image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2555
+
+
+
+
+ +
+

+ + #dE76(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Calculate de76.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand input image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2549
+
+
+
+
+ +
+

+ + #dECMC(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Calculate decmc.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand input image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2561
+
+
+
+
+ +
+

+ + #deviate(**opts) ⇒ Float + + + + + +

+
+ +

Find image standard deviation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +
    +

    Output value

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 186
+
+
+
+
+ +
+

+ + #dilate(mask) ⇒ Image + + + + + +

+
+ +

Dilate with a structuring element.

+ +

The structuring element must be an array with 0 for black, 255 for white and 128 for don't care.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Image, Array<Real>, Array<Array<Real>>) + + + + — +
    +

    structuring element

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    dilated image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1499
+1500
+1501
+
+
# File 'lib/vips/image.rb', line 1499
+
+def dilate mask
+  morph mask, :dilate
+end
+
+
+ +
+

+ + #divide(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Divide two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 33
+
+
+
+
+ +
+

+ + #draw_circle(ink, cx, cy, radius, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Draw a circle on an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + ink + + + (Array<Double>) + + + + — +
    +

    Color for pixels

    +
    + +
  • + +
  • + + cx + + + (Integer) + + + + — +
    +

    Centre of draw_circle

    +
    + +
  • + +
  • + + cy + + + (Integer) + + + + — +
    +

    Centre of draw_circle

    +
    + +
  • + +
  • + + radius + + + (Integer) + + + + — +
    +

    Radius in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :fill + (Boolean) + + + + + —
    +

    Draw a solid object

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Image to draw on

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2867
+
+
+
+
+ +
+

+ + #draw_flood(ink, x, y, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Flood-fill an area.

+ + +
+
+
+

Parameters:

+
    + +
  • + + ink + + + (Array<Double>) + + + + — +
    +

    Color for pixels

    +
    + +
  • + +
  • + + x + + + (Integer) + + + + — +
    +

    DrawFlood start point

    +
    + +
  • + +
  • + + y + + + (Integer) + + + + — +
    +

    DrawFlood start point

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :test + (Vips::Image) + + + + + —
    +

    Test pixels in this image

    +
    + +
  • + +
  • + :equal + (Boolean) + + + + + —
    +

    DrawFlood while equal to edge

    +
    + +
  • + +
  • + :left + (Integer) + + + + + —
    +

    Output Left edge of modified area

    +
    + +
  • + +
  • + :top + (Integer) + + + + + —
    +

    Output top edge of modified area

    +
    + +
  • + +
  • + :width + (Integer) + + + + + —
    +

    Output width of modified area

    +
    + +
  • + +
  • + :height + (Integer) + + + + + —
    +

    Output height of modified area

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Image to draw on, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2877
+
+
+
+
+ +
+

+ + #draw_image(sub, x, y, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Paint an image into another image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sub + + + (Vips::Image) + + + + — +
    +

    Sub-image to insert into main image

    +
    + +
  • + +
  • + + x + + + (Integer) + + + + — +
    +

    Draw image here

    +
    + +
  • + +
  • + + y + + + (Integer) + + + + — +
    +

    Draw image here

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :mode + (Vips::CombineMode) + + + + + —
    +

    Combining mode

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Image to draw on

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2891
+
+
+
+
+ +
+

+ + #draw_line(ink, x1, y1, x2, y2, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Draw a line on an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + ink + + + (Array<Double>) + + + + — +
    +

    Color for pixels

    +
    + +
  • + +
  • + + x1 + + + (Integer) + + + + — +
    +

    Start of draw_line

    +
    + +
  • + +
  • + + y1 + + + (Integer) + + + + — +
    +

    Start of draw_line

    +
    + +
  • + +
  • + + x2 + + + (Integer) + + + + — +
    +

    End of draw_line

    +
    + +
  • + +
  • + + y2 + + + (Integer) + + + + — +
    +

    End of draw_line

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Image to draw on

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2857
+
+
+
+
+ +
+

+ + #draw_mask(ink, mask, x, y, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Draw a mask on an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + ink + + + (Array<Double>) + + + + — +
    +

    Color for pixels

    +
    + +
  • + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Mask of pixels to draw

    +
    + +
  • + +
  • + + x + + + (Integer) + + + + — +
    +

    Draw mask here

    +
    + +
  • + +
  • + + y + + + (Integer) + + + + — +
    +

    Draw mask here

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Image to draw on

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2848
+
+
+
+
+ +
+

+ + #draw_point(ink, left, top, **opts) ⇒ Image + + + + + +

+
+ +

Draw a point on an image.

+ +

See #draw_rect.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    modified image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+977
+978
+979
+
+
# File 'lib/vips/image.rb', line 977
+
+def draw_point ink, left, top, **opts
+  draw_rect ink, left, top, 1, 1, **opts
+end
+
+
+ +
+

+ + #draw_rect(ink, left, top, width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Paint a rectangle on an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + ink + + + (Array<Double>) + + + + — +
    +

    Color for pixels

    +
    + +
  • + +
  • + + left + + + (Integer) + + + + — +
    +

    Rect to fill

    +
    + +
  • + +
  • + + top + + + (Integer) + + + + — +
    +

    Rect to fill

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Rect to fill

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Rect to fill

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :fill + (Boolean) + + + + + —
    +

    Draw a solid object

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Image to draw on

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2837
+
+
+
+
+ +
+

+ + #draw_smudge(left, top, width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Blur a rectangle on an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + left + + + (Integer) + + + + — +
    +

    Rect to fill

    +
    + +
  • + +
  • + + top + + + (Integer) + + + + — +
    +

    Rect to fill

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Rect to fill

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Rect to fill

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Image to draw on

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2900
+
+
+
+
+ +
+

+ + #dzsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to deepzoom file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :dirname + (String) + + + + + —
    +

    Directory name to save to

    +
    + +
  • + +
  • + :basename + (String) + + + + + —
    +

    Base name to save to

    +
    + +
  • + +
  • + :layout + (Vips::ForeignDzLayout) + + + + + —
    +

    Directory layout

    +
    + +
  • + +
  • + :suffix + (String) + + + + + —
    +

    Filename suffix for tiles

    +
    + +
  • + +
  • + :overlap + (Integer) + + + + + —
    +

    Tile overlap in pixels

    +
    + +
  • + +
  • + :tile_size + (Integer) + + + + + —
    +

    Tile size in pixels

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
  • + :centre + (Boolean) + + + + + —
    +

    Center image in tile

    +
    + +
  • + +
  • + :depth + (Vips::ForeignDzDepth) + + + + + —
    +

    Pyramid depth

    +
    + +
  • + +
  • + :angle + (Vips::Angle) + + + + + —
    +

    Rotate image during save

    +
    + +
  • + +
  • + :container + (Vips::ForeignDzContainer) + + + + + —
    +

    Pyramid container type

    +
    + +
  • + +
  • + :properties + (Boolean) + + + + + —
    +

    Write a properties file to the output directory

    +
    + +
  • + +
  • + :compression + (Integer) + + + + + —
    +

    ZIP deflate compression level

    +
    + +
  • + +
  • + :region_shrink + (Vips::RegionShrink) + + + + + —
    +

    Method to shrink regions

    +
    + +
  • + +
  • + :skip_blanks + (Integer) + + + + + —
    +

    Skip tiles which are nearly equal to the background

    +
    + +
  • + +
  • + :no_strip + (Boolean) + + + + + —
    +

    Don't strip tile metadata

    +
    + +
  • + +
  • + :id + (String) + + + + + —
    +

    Resource ID

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1834
+
+
+
+
+ +
+

+ + #dzsave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image to dz buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :dirname + (String) + + + + + —
    +

    Directory name to save to

    +
    + +
  • + +
  • + :basename + (String) + + + + + —
    +

    Base name to save to

    +
    + +
  • + +
  • + :layout + (Vips::ForeignDzLayout) + + + + + —
    +

    Directory layout

    +
    + +
  • + +
  • + :suffix + (String) + + + + + —
    +

    Filename suffix for tiles

    +
    + +
  • + +
  • + :overlap + (Integer) + + + + + —
    +

    Tile overlap in pixels

    +
    + +
  • + +
  • + :tile_size + (Integer) + + + + + —
    +

    Tile size in pixels

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
  • + :centre + (Boolean) + + + + + —
    +

    Center image in tile

    +
    + +
  • + +
  • + :depth + (Vips::ForeignDzDepth) + + + + + —
    +

    Pyramid depth

    +
    + +
  • + +
  • + :angle + (Vips::Angle) + + + + + —
    +

    Rotate image during save

    +
    + +
  • + +
  • + :container + (Vips::ForeignDzContainer) + + + + + —
    +

    Pyramid container type

    +
    + +
  • + +
  • + :properties + (Boolean) + + + + + —
    +

    Write a properties file to the output directory

    +
    + +
  • + +
  • + :compression + (Integer) + + + + + —
    +

    ZIP deflate compression level

    +
    + +
  • + +
  • + :region_shrink + (Vips::RegionShrink) + + + + + —
    +

    Method to shrink regions

    +
    + +
  • + +
  • + :skip_blanks + (Integer) + + + + + —
    +

    Skip tiles which are nearly equal to the background

    +
    + +
  • + +
  • + :no_strip + (Boolean) + + + + + —
    +

    Don't strip tile metadata

    +
    + +
  • + +
  • + :id + (String) + + + + + —
    +

    Resource ID

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1861
+
+
+
+
+ +
+

+ + #embed(x, y, width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Embed an image in a larger image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + x + + + (Integer) + + + + — +
    +

    Left edge of input in output

    +
    + +
  • + +
  • + + y + + + (Integer) + + + + — +
    +

    Top edge of input in output

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :extend + (Vips::Extend) + + + + + —
    +

    How to generate the extra pixels

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Color for background pixels

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 317
+
+
+
+
+ +
+

+ + #erode(mask) ⇒ Image + + + + + +

+
+ +

Erode with a structuring element.

+ +

The structuring element must be an array with 0 for black, 255 for white and 128 for don't care.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Image, Array<Real>, Array<Array<Real>>) + + + + — +
    +

    structuring element

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    eroded image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1487
+1488
+1489
+
+
# File 'lib/vips/image.rb', line 1487
+
+def erode mask
+  morph mask, :erode
+end
+
+
+ +
+

+ + #expImage + + + + + +

+
+ +

Return e ** pixel.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    e ** pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1454
+1455
+1456
+
+
# File 'lib/vips/image.rb', line 1454
+
+def exp
+  math :exp
+end
+
+
+ +
+

+ + #exp10Image + + + + + +

+
+ +

Return 10 ** pixel.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    10 ** pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1461
+1462
+1463
+
+
# File 'lib/vips/image.rb', line 1461
+
+def exp10
+  math :exp10
+end
+
+
+ +
+

+ + #extract_area(left, top, width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Extract an area from an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + left + + + (Integer) + + + + — +
    +

    Left edge of extract area

    +
    + +
  • + +
  • + + top + + + (Integer) + + + + — +
    +

    Top edge of extract area

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Width of extract area

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Height of extract area

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 378
+
+
+
+
+ +
+

+ + #extract_band(band, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Extract band from an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + band + + + (Integer) + + + + — +
    +

    Band to extract

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :n + (Integer) + + + + + —
    +

    Number of bands to extract

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 404
+
+
+
+
+ +
+

+ + #falsecolour(**opts) ⇒ Vips::Image + + + + + +

+
+ +

False-color an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 553
+
+
+
+
+ +
+

+ + #fastcor(ref, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Fast correlation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + ref + + + (Vips::Image) + + + + — +
    +

    Input reference image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2732
+
+
+
+
+ +
+

+ + #filenameString + + + + + +

+
+ +

Get image filename, if any.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +
    +

    image filename

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+880
+881
+882
+
+
# File 'lib/vips/image.rb', line 880
+
+def filename
+  get "filename"
+end
+
+
+ +
+

+ + #fill_nearest(**opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Fill image zeros with nearest non-zero pixel.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :distance + (Vips::Image) + + + + + —
    +

    Output Distance to nearest non-zero pixel

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Value of nearest non-zero pixel, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2831
+
+
+
+
+ +
+

+ + #find_trim(**opts) ⇒ Array<Integer, Integer, Integer, Integer> + + + + + +

+
+ +

Search an image for non-edge areas.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :threshold + (Float) + + + + + —
    +

    Object threshold

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Color for background pixels

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Array<Integer, Integer, Integer, Integer>) + + + + — +
    +

    Left edge of image, Top edge of extract area, Width of extract area, Height of extract area

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 258
+
+
+
+
+ +
+

+ + #fitssave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to fits file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2136
+
+
+
+
+ +
+

+ + #flatten(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Flatten alpha out of an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :max_alpha + (Float) + + + + + —
    +

    Maximum value of alpha channel

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 486
+
+
+
+
+ +
+

+ + #flip(direction, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Flip an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + direction + + + (Vips::Direction) + + + + — +
    +

    Direction to flip image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 338
+
+
+
+
+ +
+

+ + #fliphorImage + + + + + +

+
+ +

Flip horizontally.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    image flipped horizontally

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1468
+1469
+1470
+
+
# File 'lib/vips/image.rb', line 1468
+
+def fliphor
+  flip :horizontal
+end
+
+
+ +
+

+ + #flipverImage + + + + + +

+
+ +

Flip vertically.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    image flipped vertically

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1475
+1476
+1477
+
+
# File 'lib/vips/image.rb', line 1475
+
+def flipver
+  flip :vertical
+end
+
+
+ +
+

+ + #float2rad(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform float rgb to radiance coding.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2497
+
+
+
+
+ +
+

+ + #floorImage + + + + + +

+
+ +

Return the largest integral value not greater than the argument.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    floor of image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1214
+1215
+1216
+
+
# File 'lib/vips/image.rb', line 1214
+
+def floor
+  round :floor
+end
+
+
+ +
+

+ + #formatSymbol + + + + + +

+
+ +

Get image format.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + + — +
    +

    image format

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+859
+860
+861
+
+
# File 'lib/vips/image.rb', line 859
+
+def format
+  get "format"
+end
+
+
+ +
+

+ + #freqmult(mask, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Frequency-domain filtering.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input mask image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2787
+
+
+
+
+ +
+

+ + #fwfft(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Forward fft.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2776
+
+
+
+
+ +
+

+ + #gamma(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Gamma an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :exponent + (Float) + + + + + —
    +

    Gamma factor

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 558
+
+
+
+
+ +
+

+ + #gaussblur(sigma, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Gaussian blur.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sigma + + + (Float) + + + + — +
    +

    Sigma of Gaussian

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :min_ampl + (Float) + + + + + —
    +

    Minimum amplitude of Gaussian

    +
    + +
  • + +
  • + :precision + (Vips::Precision) + + + + + —
    +

    Convolve with this precision

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2756
+
+
+
+
+ +
+

+ + #get(name) ⇒ Object + + + + + +

+
+ +

Get a metadata item from an image. Ruby types are constructed automatically from the GValue, if possible.

+ +

For example, you can read the ICC profile from an image like this:

+ +
profile = image.get "icc-profile-data"
+
+ +

and profile will be an array containing the profile.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +
    +

    Metadata field to get

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Object) + + + + — +
    +

    Value of field

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+
+
# File 'lib/vips/image.rb', line 740
+
+def get name
+  # with old libvips, we must fetch properties (as opposed to
+  # metadata) via VipsObject
+  unless Vips.at_least_libvips?(8, 5)
+    return super if parent_get_typeof(name) != 0
+  end
+
+  gvalue = GObject::GValue.alloc
+  raise Vips::Error if Vips.vips_image_get(self, name, gvalue) != 0
+  result = gvalue.get
+  gvalue.unset
+
+  result
+end
+
+
+ +
+

+ + #get_fields[String] + + + + + +

+
+ +

Get the names of all fields on an image. Use this to loop over all image metadata.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + ([String]) + + + + — +
    +

    array of field names

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+
+
# File 'lib/vips/image.rb', line 759
+
+def get_fields
+  # vips_image_get_fields() was added in libvips 8.5
+  return [] unless Vips.respond_to? :vips_image_get_fields
+
+  array = Vips.vips_image_get_fields self
+
+  names = []
+  p = array
+  until (q = p.read_pointer).null?
+    names << q.read_string
+    GLib.g_free q
+    p += FFI::Type::POINTER.size
+  end
+  GLib.g_free array
+
+  names
+end
+
+
+ +
+

+ + #get_typeof(name) ⇒ Integer + + + + + +

+
+ +

Get the GType of a metadata field. The result is 0 if no such field exists.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +
    +

    Metadata field to fetch

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    GType

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+
+
# File 'lib/vips/image.rb', line 716
+
+def get_typeof name
+  # on libvips before 8.5, property types must be searched first,
+  # since vips_image_get_typeof returned built-in enums as int
+  unless Vips.at_least_libvips?(8, 5)
+    gtype = parent_get_typeof name
+    return gtype if gtype != 0
+  end
+
+  Vips.vips_image_get_typeof self, name
+end
+
+
+ +
+

+ + #get_value(name) ⇒ Object + + + + + +

+
+ +

compatibility: old name for get

+ + +
+
+
+ + +
+ + + + +
+
+
+
+824
+825
+826
+
+
# File 'lib/vips/image.rb', line 824
+
+def get_value name
+  get name
+end
+
+
+ +
+

+ + #getpoint(x, y, **opts) ⇒ Array<Double> + + + + + +

+
+ +

Read a point from an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + x + + + (Integer) + + + + — +
    +

    Point to read

    +
    + +
  • + +
  • + + y + + + (Integer) + + + + — +
    +

    Point to read

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array<Double>) + + + + — +
    +

    Array of output values

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 251
+
+
+
+
+ +
+

+ + #globalbalance(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Global balance an image mosaic.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :gamma + (Float) + + + + + —
    +

    Image gamma

    +
    + +
  • + +
  • + :int_output + (Boolean) + + + + + —
    +

    Integer output

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2984
+
+
+
+
+ +
+

+ + #gravity(direction, width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Place an image within a larger image with a certain gravity.

+ + +
+
+
+

Parameters:

+
    + +
  • + + direction + + + (Vips::CompassDirection) + + + + — +
    +

    direction to place image within width/height

    +
    + +
  • + +
  • + + width + + + (Integer) + + + + — +
    +

    Image width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Image height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :extend + (Vips::Extend) + + + + + —
    +

    How to generate the extra pixels

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Color for background pixels

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 328
+
+
+
+
+ +
+

+ + #grid(tile_height, across, down, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Grid an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + tile_height + + + (Integer) + + + + — +
    +

    chop into tiles this high

    +
    + +
  • + +
  • + + across + + + (Integer) + + + + — +
    +

    number of tiles across

    +
    + +
  • + +
  • + + down + + + (Integer) + + + + — +
    +

    number of tiles down

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 506
+
+
+
+
+ +
+

+ + #has_alpha?Boolean + + + + + +

+
+ +

Detect if image has an alpha channel

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    true if image has an alpha channel.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+941
+942
+943
+
+
# File 'lib/vips/image.rb', line 941
+
+def has_alpha?
+  Vips.vips_image_hasalpha(self) != 0
+end
+
+
+ +
+

+ + #heifsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image in heif format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :compression + (Vips::ForeignHeifCompression) + + + + + —
    +

    Compression format

    +
    + +
  • + +
  • + :speed + (Integer) + + + + + —
    +

    CPU effort

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2154
+
+
+
+
+ +
+

+ + #heifsave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image in heif format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :compression + (Vips::ForeignHeifCompression) + + + + + —
    +

    Compression format

    +
    + +
  • + +
  • + :speed + (Integer) + + + + + —
    +

    CPU effort

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2168
+
+
+
+
+ +
+

+ + #heifsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image in heif format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :compression + (Vips::ForeignHeifCompression) + + + + + —
    +

    Compression format

    +
    + +
  • + +
  • + :speed + (Integer) + + + + + —
    +

    CPU effort

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2181
+
+
+
+
+ +
+

+ + #heightInteger + + + + + +

+
+ +

Get image height, in pixels.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    image height, in pixels

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+845
+846
+847
+
+
# File 'lib/vips/image.rb', line 845
+
+def height
+  Vips.vips_image_get_height self
+end
+
+
+ +
+

+ + #hist_cum(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Form cumulative histogram.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2630
+
+
+
+
+ +
+

+ + #hist_entropy(**opts) ⇒ Float + + + + + +

+
+ +

Estimate image entropy.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +
    +

    Output value

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2670
+
+
+
+
+ +
+

+ + #hist_equal(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Histogram equalisation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :band + (Integer) + + + + + —
    +

    Equalise with this band

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2646
+
+
+
+
+ +
+

+ + #hist_find(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Find image histogram.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :band + (Integer) + + + + + —
    +

    Find histogram of band

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output histogram

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 196
+
+
+
+
+ +
+

+ + #hist_find_indexed(index, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Find indexed image histogram.

+ + +
+
+
+

Parameters:

+
    + +
  • + + index + + + (Vips::Image) + + + + — +
    +

    Index image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :combine + (Vips::Combine) + + + + + —
    +

    Combine bins like this

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output histogram

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 208
+
+
+
+
+ +
+

+ + #hist_find_ndim(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Find n-dimensional image histogram.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :bins + (Integer) + + + + + —
    +

    Number of bins in each dimension

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output histogram

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 202
+
+
+
+
+ +
+

+ + #hist_ismonotonic(**opts) ⇒ Boolean + + + + + +

+
+ +

Test for monotonicity.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    true if in is monotonic

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2665
+
+
+
+
+ +
+

+ + #hist_local(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Local histogram equalisation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Window width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Window height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :max_slope + (Integer) + + + + + —
    +

    Maximum slope (CLAHE)

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2657
+
+
+
+
+ +
+

+ + #hist_match(ref, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Match two histograms.

+ + +
+
+
+

Parameters:

+
    + +
  • + + ref + + + (Vips::Image) + + + + — +
    +

    Reference histogram

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2635
+
+
+
+
+ +
+

+ + #hist_norm(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Normalise histogram.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2641
+
+
+
+
+ +
+

+ + #hist_plot(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Plot histogram.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2652
+
+
+
+
+ +
+

+ + #hough_circle(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Find hough circle transform.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :scale + (Integer) + + + + + —
    +

    Scale down dimensions by this factor

    +
    + +
  • + +
  • + :min_radius + (Integer) + + + + + —
    +

    Smallest radius to search for

    +
    + +
  • + +
  • + :max_radius + (Integer) + + + + + —
    +

    Largest radius to search for

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 222
+
+
+
+
+ +
+

+ + #hough_line(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Find hough line transform.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :width + (Integer) + + + + + —
    +

    horizontal size of parameter space

    +
    + +
  • + +
  • + :height + (Integer) + + + + + —
    +

    Vertical size of parameter space

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 215
+
+
+
+
+ +
+

+ + #HSV2sRGB(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform hsv to srgb.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2512
+
+
+
+
+ +
+

+ + #icc_export(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Output to device with icc profile.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :pcs + (Vips::PCS) + + + + + —
    +

    Set Profile Connection Space

    +
    + +
  • + +
  • + :intent + (Vips::Intent) + + + + + —
    +

    Rendering intent

    +
    + +
  • + +
  • + :black_point_compensation + (Boolean) + + + + + —
    +

    Enable black point compensation

    +
    + +
  • + +
  • + :output_profile + (String) + + + + + —
    +

    Filename to load output profile from

    +
    + +
  • + +
  • + :depth + (Integer) + + + + + —
    +

    Output device space depth in bits

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2527
+
+
+
+
+ +
+

+ + #icc_import(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Import from device with icc profile.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :pcs + (Vips::PCS) + + + + + —
    +

    Set Profile Connection Space

    +
    + +
  • + +
  • + :intent + (Vips::Intent) + + + + + —
    +

    Rendering intent

    +
    + +
  • + +
  • + :black_point_compensation + (Boolean) + + + + + —
    +

    Enable black point compensation

    +
    + +
  • + +
  • + :embedded + (Boolean) + + + + + —
    +

    Use embedded input profile, if available

    +
    + +
  • + +
  • + :input_profile + (String) + + + + + —
    +

    Filename to load input profile from

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2517
+
+
+
+
+ +
+

+ + #icc_transform(output_profile, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform between devices with icc profiles.

+ + +
+
+
+

Parameters:

+
    + +
  • + + output_profile + + + (String) + + + + — +
    +

    Filename to load output profile from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :pcs + (Vips::PCS) + + + + + —
    +

    Set Profile Connection Space

    +
    + +
  • + +
  • + :intent + (Vips::Intent) + + + + + —
    +

    Rendering intent

    +
    + +
  • + +
  • + :black_point_compensation + (Boolean) + + + + + —
    +

    Enable black point compensation

    +
    + +
  • + +
  • + :embedded + (Boolean) + + + + + —
    +

    Use embedded input profile, if available

    +
    + +
  • + +
  • + :input_profile + (String) + + + + + —
    +

    Filename to load input profile from

    +
    + +
  • + +
  • + :depth + (Integer) + + + + + —
    +

    Output device space depth in bits

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2537
+
+
+
+
+ +
+

+ + #ifthenelse(th, el, **opts) ⇒ Image + + + + + +

+
+ +

Select pixels from th if self is non-zero and from el if self is zero. Use the :blend option to fade smoothly between th and el.

+ + +
+
+
+

Parameters:

+
    + +
  • + + th + + + (Image, Real, Array<Real>) + + + + — +
    +

    true values

    +
    + +
  • + +
  • + + el + + + (Image, Real, Array<Real>) + + + + — +
    +

    false values

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :blend + (Boolean) + + + — default: + false + + + + —
    +

    Blend smoothly between th and el

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    merged image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+
+
# File 'lib/vips/image.rb', line 1533
+
+def ifthenelse(th, el, **opts)
+  match_image = [th, el, self].find { |x| x.is_a? Vips::Image }
+
+  unless th.is_a? Vips::Image
+    th = Operation.imageize match_image, th
+  end
+  unless el.is_a? Vips::Image
+    el = Operation.imageize match_image, el
+  end
+
+  Vips::Operation.call "ifthenelse", [self, th, el], opts
+end
+
+
+ +
+

+ + #imagImage + + + + + +

+
+ +

Return the imaginary part of a complex image.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    imaginary part of complex image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1345
+1346
+1347
+
+
# File 'lib/vips/image.rb', line 1345
+
+def imag
+  complexget :imag
+end
+
+
+ +
+

+ + #insert(sub, x, y, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Insert image @sub into @main at @x, @y.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sub + + + (Vips::Image) + + + + — +
    +

    Sub-image to insert into main image

    +
    + +
  • + +
  • + + x + + + (Integer) + + + + — +
    +

    Left edge of sub in main

    +
    + +
  • + +
  • + + y + + + (Integer) + + + + — +
    +

    Top edge of sub in main

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :expand + (Boolean) + + + + + —
    +

    Expand output to hold all of both inputs

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Color for new pixels

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 344
+
+
+
+
+ +
+

+ + #inspectObject + + + + + +

+ + + + +
+
+
+
+194
+195
+196
+
+
# File 'lib/vips/image.rb', line 194
+
+def inspect
+  "#<Image #{width}x#{height} #{format}, #{bands} bands, #{interpretation}>"
+end
+
+
+ +
+

+ + #interpretationSymbol + + + + + +

+
+ +

Get image interpretation.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Symbol) + + + + — +
    +

    image interpretation

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+866
+867
+868
+
+
# File 'lib/vips/image.rb', line 866
+
+def interpretation
+  get "interpretation"
+end
+
+
+ +
+

+ + #invert(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Invert an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 85
+
+
+
+
+ +
+

+ + #invertlut(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Build an inverted look-up table.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :size + (Integer) + + + + + —
    +

    LUT size to generate

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 817
+
+
+
+
+ +
+

+ + #invfft(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Inverse fft.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :real + (Boolean) + + + + + —
    +

    Output only the real part of the transform

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2781
+
+
+
+
+ +
+

+ + #join(in2, direction, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Join a pair of images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + in2 + + + (Vips::Image) + + + + — +
    +

    Second input image

    +
    + +
  • + +
  • + + direction + + + (Vips::Direction) + + + + — +
    +

    Join left-right or up-down

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :expand + (Boolean) + + + + + —
    +

    Expand output to hold all of both inputs

    +
    + +
  • + +
  • + :shim + (Integer) + + + + + —
    +

    Pixels between images

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Colour for new pixels

    +
    + +
  • + +
  • + :align + (Vips::Align) + + + + + —
    +

    Align on the low, centre or high coordinate edge

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 354
+
+
+
+
+ +
+

+ + #jp2ksave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image in jpeg2000 format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1793
+
+
+
+
+ +
+

+ + #jp2ksave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image in jpeg2000 format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1807
+
+
+
+
+ +
+

+ + #jp2ksave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image in jpeg2000 format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1820
+
+
+
+
+ +
+

+ + #jpegsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to jpeg file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :optimize_coding + (Boolean) + + + + + —
    +

    Compute optimal Huffman coding tables

    +
    + +
  • + +
  • + :interlace + (Boolean) + + + + + —
    +

    Generate an interlaced (progressive) jpeg

    +
    + +
  • + +
  • + :no_subsample + (Boolean) + + + + + —
    +

    Disable chroma subsample

    +
    + +
  • + +
  • + :trellis_quant + (Boolean) + + + + + —
    +

    Apply trellis quantisation to each 8x8 block

    +
    + +
  • + +
  • + :overshoot_deringing + (Boolean) + + + + + —
    +

    Apply overshooting to samples with extreme values

    +
    + +
  • + +
  • + :optimize_scans + (Boolean) + + + + + —
    +

    Split spectrum of DCT coefficients into separate scans

    +
    + +
  • + +
  • + :quant_table + (Integer) + + + + + —
    +

    Use predefined quantization table with given index

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1940
+
+
+
+
+ +
+

+ + #jpegsave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image to jpeg buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :optimize_coding + (Boolean) + + + + + —
    +

    Compute optimal Huffman coding tables

    +
    + +
  • + +
  • + :interlace + (Boolean) + + + + + —
    +

    Generate an interlaced (progressive) jpeg

    +
    + +
  • + +
  • + :no_subsample + (Boolean) + + + + + —
    +

    Disable chroma subsample

    +
    + +
  • + +
  • + :trellis_quant + (Boolean) + + + + + —
    +

    Apply trellis quantisation to each 8x8 block

    +
    + +
  • + +
  • + :overshoot_deringing + (Boolean) + + + + + —
    +

    Apply overshooting to samples with extreme values

    +
    + +
  • + +
  • + :optimize_scans + (Boolean) + + + + + —
    +

    Split spectrum of DCT coefficients into separate scans

    +
    + +
  • + +
  • + :quant_table + (Integer) + + + + + —
    +

    Use predefined quantization table with given index

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1959
+
+
+
+
+ +
+

+ + #jpegsave_mime(**opts) ⇒ nil + + + + + +

+
+ +

Save image to jpeg mime.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :optimize_coding + (Boolean) + + + + + —
    +

    Compute optimal Huffman coding tables

    +
    + +
  • + +
  • + :interlace + (Boolean) + + + + + —
    +

    Generate an interlaced (progressive) jpeg

    +
    + +
  • + +
  • + :no_subsample + (Boolean) + + + + + —
    +

    Disable chroma subsample

    +
    + +
  • + +
  • + :trellis_quant + (Boolean) + + + + + —
    +

    Apply trellis quantisation to each 8x8 block

    +
    + +
  • + +
  • + :overshoot_deringing + (Boolean) + + + + + —
    +

    Apply overshooting to samples with extreme values

    +
    + +
  • + +
  • + :optimize_scans + (Boolean) + + + + + —
    +

    Split spectrum of DCT coefficients into separate scans

    +
    + +
  • + +
  • + :quant_table + (Integer) + + + + + —
    +

    Use predefined quantization table with given index

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1996
+
+
+
+
+ +
+

+ + #jpegsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image to jpeg target.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :optimize_coding + (Boolean) + + + + + —
    +

    Compute optimal Huffman coding tables

    +
    + +
  • + +
  • + :interlace + (Boolean) + + + + + —
    +

    Generate an interlaced (progressive) jpeg

    +
    + +
  • + +
  • + :no_subsample + (Boolean) + + + + + —
    +

    Disable chroma subsample

    +
    + +
  • + +
  • + :trellis_quant + (Boolean) + + + + + —
    +

    Apply trellis quantisation to each 8x8 block

    +
    + +
  • + +
  • + :overshoot_deringing + (Boolean) + + + + + —
    +

    Apply overshooting to samples with extreme values

    +
    + +
  • + +
  • + :optimize_scans + (Boolean) + + + + + —
    +

    Split spectrum of DCT coefficients into separate scans

    +
    + +
  • + +
  • + :quant_table + (Integer) + + + + + —
    +

    Use predefined quantization table with given index

    +
    + +
  • + +
  • + :subsample_mode + (Vips::ForeignSubsample) + + + + + —
    +

    Select chroma subsample operation mode

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1977
+
+
+
+
+ +
+

+ + #jxlsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image in jpeg-xl format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to load from

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :tier + (Integer) + + + + + —
    +

    Decode speed tier

    +
    + +
  • + +
  • + :distance + (Float) + + + + + —
    +

    Target butteraugli distance

    +
    + +
  • + +
  • + :effort + (Integer) + + + + + —
    +

    Encoding effort

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Quality factor

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1752
+
+
+
+
+ +
+

+ + #jxlsave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image in jpeg-xl format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :tier + (Integer) + + + + + —
    +

    Decode speed tier

    +
    + +
  • + +
  • + :distance + (Float) + + + + + —
    +

    Target butteraugli distance

    +
    + +
  • + +
  • + :effort + (Integer) + + + + + —
    +

    Encoding effort

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Quality factor

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1766
+
+
+
+
+ +
+

+ + #jxlsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image in jpeg-xl format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :tier + (Integer) + + + + + —
    +

    Decode speed tier

    +
    + +
  • + +
  • + :distance + (Float) + + + + + —
    +

    Target butteraugli distance

    +
    + +
  • + +
  • + :effort + (Integer) + + + + + —
    +

    Encoding effort

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable lossless compression

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Quality factor

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1779
+
+
+
+
+ +
+

+ + #Lab2LabQ(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform float lab to labq coding.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2467
+
+
+
+
+ +
+

+ + #Lab2LabS(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform float lab to signed short.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2487
+
+
+
+
+ +
+

+ + #Lab2LCh(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform lab to lch.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2422
+
+
+
+
+ +
+

+ + #Lab2XYZ(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform cielab to xyz.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :temp + (Array<Double>) + + + + + —
    +

    Color temperature

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2410
+
+
+
+
+ +
+

+ + #labelregions(**opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Label regions in an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :segments + (Integer) + + + + + —
    +

    Output Number of discrete contigious regions

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Mask of region labels, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2825
+
+
+
+
+ +
+

+ + #LabQ2Lab(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Unpack a labq image to float lab.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2462
+
+
+
+
+ +
+

+ + #LabQ2LabS(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Unpack a labq image to short lab.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2472
+
+
+
+
+ +
+

+ + #LabQ2sRGB(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Convert a labq image to srgb.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2502
+
+
+
+
+ +
+

+ + #LabS2Lab(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform signed short lab to float.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2482
+
+
+
+
+ +
+

+ + #LabS2LabQ(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform short lab to labq coding.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2477
+
+
+
+
+ +
+

+ + #LCh2CMC(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform lch to cmc.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2432
+
+
+
+
+ +
+

+ + #LCh2Lab(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform lch to lab.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2427
+
+
+
+
+ +
+

+ + #linear(a, b, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Calculate (a * in + b).

+ + +
+
+
+

Parameters:

+
    + +
  • + + a + + + (Array<Double>) + + + + — +
    +

    Multiply by this

    +
    + +
  • + +
  • + + b + + + (Array<Double>) + + + + — +
    +

    Add this

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :uchar + (Boolean) + + + + + —
    +

    Output should be uchar

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 90
+
+
+
+
+ +
+

+ + #linecache(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Cache an image as a set of lines.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Expected access pattern

    +
    + +
  • + +
  • + :threaded + (Boolean) + + + + + —
    +

    Allow threaded access

    +
    + +
  • + +
  • + :persistent + (Boolean) + + + + + —
    +

    Keep cache between evaluations

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 292
+
+
+
+
+ +
+

+ + #logImage + + + + + +

+
+ +

Return the natural log of an image.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    natural log of each pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1440
+1441
+1442
+
+
# File 'lib/vips/image.rb', line 1440
+
+def log
+  math :log
+end
+
+
+ +
+

+ + #log10Image + + + + + +

+
+ +

Return the log base 10 of an image.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    base 10 log of each pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1447
+1448
+1449
+
+
# File 'lib/vips/image.rb', line 1447
+
+def log10
+  math :log10
+end
+
+
+ +
+

+ + #magicksave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save file with imagemagick.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :format + (String) + + + + + —
    +

    Format to save in

    +
    + +
  • + +
  • + :quality + (Integer) + + + + + —
    +

    Quality to use

    +
    + +
  • + +
  • + :optimize_gif_frames + (Boolean) + + + + + —
    +

    Apply GIF frames optimization

    +
    + +
  • + +
  • + :optimize_gif_transparency + (Boolean) + + + + + —
    +

    Apply GIF transparency optimization

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2195
+
+
+
+
+ +
+

+ + #magicksave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image to magick buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :format + (String) + + + + + —
    +

    Format to save in

    +
    + +
  • + +
  • + :quality + (Integer) + + + + + —
    +

    Quality to use

    +
    + +
  • + +
  • + :optimize_gif_frames + (Boolean) + + + + + —
    +

    Apply GIF frames optimization

    +
    + +
  • + +
  • + :optimize_gif_transparency + (Boolean) + + + + + —
    +

    Apply GIF transparency optimization

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2208
+
+
+
+
+ +
+

+ + #mapim(index, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Resample with a map image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + index + + + (Vips::Image) + + + + — +
    +

    Index pixels with this

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :interpolate + (Vips::Interpolate) + + + + + —
    +

    Interpolate pixels with this

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2285
+
+
+
+
+ +
+

+ + #maplut(lut, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Map an image though a lut.

+ + +
+
+
+

Parameters:

+
    + +
  • + + lut + + + (Vips::Image) + + + + — +
    +

    Look-up table image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :band + (Integer) + + + + + —
    +

    apply one-band lut to this band of in

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2600
+
+
+
+
+ +
+

+ + #match(sec, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, **opts) ⇒ Vips::Image + + + + + +

+
+ +

First-order match of two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sec + + + (Vips::Image) + + + + — +
    +

    Secondary image

    +
    + +
  • + +
  • + + xr1 + + + (Integer) + + + + — +
    +

    Position of first reference tie-point

    +
    + +
  • + +
  • + + yr1 + + + (Integer) + + + + — +
    +

    Position of first reference tie-point

    +
    + +
  • + +
  • + + xs1 + + + (Integer) + + + + — +
    +

    Position of first secondary tie-point

    +
    + +
  • + +
  • + + ys1 + + + (Integer) + + + + — +
    +

    Position of first secondary tie-point

    +
    + +
  • + +
  • + + xr2 + + + (Integer) + + + + — +
    +

    Position of second reference tie-point

    +
    + +
  • + +
  • + + yr2 + + + (Integer) + + + + — +
    +

    Position of second reference tie-point

    +
    + +
  • + +
  • + + xs2 + + + (Integer) + + + + — +
    +

    Position of second secondary tie-point

    +
    + +
  • + +
  • + + ys2 + + + (Integer) + + + + — +
    +

    Position of second secondary tie-point

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :hwindow + (Integer) + + + + + —
    +

    Half window size

    +
    + +
  • + +
  • + :harea + (Integer) + + + + + —
    +

    Half area size

    +
    + +
  • + +
  • + :search + (Boolean) + + + + + —
    +

    Search to improve tie-points

    +
    + +
  • + +
  • + :interpolate + (Vips::Interpolate) + + + + + —
    +

    Interpolate pixels with this

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2966
+
+
+
+
+ +
+

+ + #math(math, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Apply a math operation to an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + math + + + (Vips::OperationMath) + + + + — +
    +

    math to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 98
+
+
+
+
+ +
+

+ + #math2(right, math2, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Binary math operations.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + math2 + + + (Vips::OperationMath2) + + + + — +
    +

    math to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 59
+
+
+
+
+ +
+

+ + #math2_const(math2, c, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Binary math operations with a constant.

+ + +
+
+
+

Parameters:

+
    + +
  • + + math2 + + + (Vips::OperationMath2) + + + + — +
    +

    math to perform

    +
    + +
  • + +
  • + + c + + + (Array<Double>) + + + + — +
    +

    Array of constants

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 140
+
+
+
+
+ +
+

+ + #matrixinvert(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Invert an matrix.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output matrix

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2961
+
+
+
+
+ +
+

+ + #matrixprint(**opts) ⇒ nil + + + + + +

+
+ +

Print matrix.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1658
+
+
+
+
+ +
+

+ + #matrixsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to matrix.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1640
+
+
+
+
+ +
+

+ + #matrixsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image to matrix.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1649
+
+
+
+
+ +
+

+ + #max(**opts) ⇒ Float, Hash<Symbol => Object> + + + + + +

+
+ +

Find image maximum.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :size + (Integer) + + + + + —
    +

    Number of maximum values to find

    +
    + +
  • + +
  • + :x + (Integer) + + + + + —
    +

    Output Horizontal position of maximum

    +
    + +
  • + +
  • + :y + (Integer) + + + + + —
    +

    Output Vertical position of maximum

    +
    + +
  • + +
  • + :out_array + (Array<Double>) + + + + + —
    +

    Output Array of output values

    +
    + +
  • + +
  • + :x_array + (Array<Integer>) + + + + + —
    +

    Output Array of horizontal positions

    +
    + +
  • + +
  • + :y_array + (Array<Integer>) + + + + + —
    +

    Output Array of vertical positions

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Float, Hash<Symbol => Object>) + + + + — +
    +

    Output value, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 175
+
+
+
+
+ +
+

+ + #maxposReal + + + + + +

+
+ +

Return the coordinates of the image maximum.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Real, Real, Real) + + + + — +
    +

    maximum value, x coordinate of maximum, y coordinate of maximum

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1309
+1310
+1311
+1312
+1313
+1314
+
+
# File 'lib/vips/image.rb', line 1309
+
+def maxpos
+  v, opts = max x: true, y: true
+  x = opts["x"]
+  y = opts["y"]
+  [v, x, y]
+end
+
+
+ +
+

+ + #measure(h, v, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Measure a set of patches on a color chart.

+ + +
+
+
+

Parameters:

+
    + +
  • + + h + + + (Integer) + + + + — +
    +

    Number of patches across chart

    +
    + +
  • + +
  • + + v + + + (Integer) + + + + — +
    +

    Number of patches down chart

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :left + (Integer) + + + + + —
    +

    Left edge of extract area

    +
    + +
  • + +
  • + :top + (Integer) + + + + + —
    +

    Top edge of extract area

    +
    + +
  • + +
  • + :width + (Integer) + + + + + —
    +

    Width of extract area

    +
    + +
  • + +
  • + :height + (Integer) + + + + + —
    +

    Height of extract area

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output array of statistics

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 240
+
+
+
+
+ +
+

+ + #median(size = 3) ⇒ Image + + + + + +

+
+ +

a median filter

+ + +
+
+
+

Parameters:

+
    + +
  • + + size + + + (Integer) + + + (defaults to: 3) + + + — +
    +

    size of filter window

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of median filter

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1331
+1332
+1333
+
+
# File 'lib/vips/image.rb', line 1331
+
+def median size = 3
+  rank size, size, size**2 / 2
+end
+
+
+ +
+

+ + #merge(sec, direction, dx, dy, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Merge two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sec + + + (Vips::Image) + + + + — +
    +

    Secondary image

    +
    + +
  • + +
  • + + direction + + + (Vips::Direction) + + + + — +
    +

    Horizontal or vertical merge

    +
    + +
  • + +
  • + + dx + + + (Integer) + + + + — +
    +

    Horizontal displacement from sec to ref

    +
    + +
  • + +
  • + + dy + + + (Integer) + + + + — +
    +

    Vertical displacement from sec to ref

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :mblend + (Integer) + + + + + —
    +

    Maximum blend size

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2909
+
+
+
+
+ +
+

+ + #min(**opts) ⇒ Float, Hash<Symbol => Object> + + + + + +

+
+ +

Find image minimum.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :size + (Integer) + + + + + —
    +

    Number of minimum values to find

    +
    + +
  • + +
  • + :x + (Integer) + + + + + —
    +

    Output Horizontal position of minimum

    +
    + +
  • + +
  • + :y + (Integer) + + + + + —
    +

    Output Vertical position of minimum

    +
    + +
  • + +
  • + :out_array + (Array<Double>) + + + + + —
    +

    Output Array of output values

    +
    + +
  • + +
  • + :x_array + (Array<Integer>) + + + + + —
    +

    Output Array of horizontal positions

    +
    + +
  • + +
  • + :y_array + (Array<Integer>) + + + + + —
    +

    Output Array of vertical positions

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Float, Hash<Symbol => Object>) + + + + — +
    +

    Output value, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 164
+
+
+
+
+ +
+

+ + #minposReal + + + + + +

+
+ +

Return the coordinates of the image minimum.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Real, Real, Real) + + + + — +
    +

    minimum value, x coordinate of minimum, y coordinate of minimum

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1320
+1321
+1322
+1323
+1324
+1325
+
+
# File 'lib/vips/image.rb', line 1320
+
+def minpos
+  v, opts = min x: true, y: true
+  x = opts["x"]
+  y = opts["y"]
+  [v, x, y]
+end
+
+
+ +
+

+ + #morph(mask, morph, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Morphology operation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + mask + + + (Vips::Image) + + + + — +
    +

    Input matrix image

    +
    + +
  • + +
  • + + morph + + + (Vips::OperationMorphology) + + + + — +
    +

    Morphological operation to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2804
+
+
+
+
+ +
+

+ + #mosaic(sec, direction, xref, yref, xsec, ysec, **opts) ⇒ Vips::Image, Hash<Symbol => Object> + + + + + +

+
+ +

Mosaic two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sec + + + (Vips::Image) + + + + — +
    +

    Secondary image

    +
    + +
  • + +
  • + + direction + + + (Vips::Direction) + + + + — +
    +

    Horizontal or vertical mosaic

    +
    + +
  • + +
  • + + xref + + + (Integer) + + + + — +
    +

    Position of reference tie-point

    +
    + +
  • + +
  • + + yref + + + (Integer) + + + + — +
    +

    Position of reference tie-point

    +
    + +
  • + +
  • + + xsec + + + (Integer) + + + + — +
    +

    Position of secondary tie-point

    +
    + +
  • + +
  • + + ysec + + + (Integer) + + + + — +
    +

    Position of secondary tie-point

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :hwindow + (Integer) + + + + + —
    +

    Half window size

    +
    + +
  • + +
  • + :harea + (Integer) + + + + + —
    +

    Half area size

    +
    + +
  • + +
  • + :mblend + (Integer) + + + + + —
    +

    Maximum blend size

    +
    + +
  • + +
  • + :bandno + (Integer) + + + + + —
    +

    Band to search for features on

    +
    + +
  • + +
  • + :dx0 + (Integer) + + + + + —
    +

    Output Detected integer offset

    +
    + +
  • + +
  • + :dy0 + (Integer) + + + + + —
    +

    Output Detected integer offset

    +
    + +
  • + +
  • + :scale1 + (Float) + + + + + —
    +

    Output Detected scale

    +
    + +
  • + +
  • + :angle1 + (Float) + + + + + —
    +

    Output Detected rotation

    +
    + +
  • + +
  • + :dy1 + (Float) + + + + + —
    +

    Output Detected first-order displacement

    +
    + +
  • + +
  • + :dx1 + (Float) + + + + + —
    +

    Output Detected first-order displacement

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image, Hash<Symbol => Object>) + + + + — +
    +

    Output image, Hash of optional output items

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2919
+
+
+
+
+ +
+

+ + #mosaic1(sec, direction, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, **opts) ⇒ Vips::Image + + + + + +

+
+ +

First-order mosaic of two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + sec + + + (Vips::Image) + + + + — +
    +

    Secondary image

    +
    + +
  • + +
  • + + direction + + + (Vips::Direction) + + + + — +
    +

    Horizontal or vertical mosaic

    +
    + +
  • + +
  • + + xr1 + + + (Integer) + + + + — +
    +

    Position of first reference tie-point

    +
    + +
  • + +
  • + + yr1 + + + (Integer) + + + + — +
    +

    Position of first reference tie-point

    +
    + +
  • + +
  • + + xs1 + + + (Integer) + + + + — +
    +

    Position of first secondary tie-point

    +
    + +
  • + +
  • + + ys1 + + + (Integer) + + + + — +
    +

    Position of first secondary tie-point

    +
    + +
  • + +
  • + + xr2 + + + (Integer) + + + + — +
    +

    Position of second reference tie-point

    +
    + +
  • + +
  • + + yr2 + + + (Integer) + + + + — +
    +

    Position of second reference tie-point

    +
    + +
  • + +
  • + + xs2 + + + (Integer) + + + + — +
    +

    Position of second secondary tie-point

    +
    + +
  • + +
  • + + ys2 + + + (Integer) + + + + — +
    +

    Position of second secondary tie-point

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :hwindow + (Integer) + + + + + —
    +

    Half window size

    +
    + +
  • + +
  • + :harea + (Integer) + + + + + —
    +

    Half area size

    +
    + +
  • + +
  • + :search + (Boolean) + + + + + —
    +

    Search to improve tie-points

    +
    + +
  • + +
  • + :interpolate + (Vips::Interpolate) + + + + + —
    +

    Interpolate pixels with this

    +
    + +
  • + +
  • + :mblend + (Integer) + + + + + —
    +

    Maximum blend size

    +
    + +
  • + +
  • + :bandno + (Integer) + + + + + —
    +

    Band to search for features on

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2940
+
+
+
+
+ +
+

+ + #msb(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Pick most-significant byte from an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :band + (Integer) + + + + + —
    +

    Band to msb

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 542
+
+
+
+
+ +
+

+ + #multiply(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Multiply two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 27
+
+
+
+
+ +
+

+ + #mutate {|mutable| ... } ⇒ Object + + + + + +

+
+ +

Mutate an image with a block. Inside the block, you can call methods which modify the image, such as setting or removing metadata, or modifying pixels.

+ +

For example:

+ +
image = image.mutate do |x|
+  (0 ... 1).step(0.01) do |i|
+    x.draw_line! 255, x.width * i, 0, 0, x.height * (1 - i)
+  end
+end
+
+ +

See MutableImage.

+ + +
+
+
+ +

Yields:

+
    + +
  • + + + (mutable) + + + +
  • + +
+ +
+ + + + +
+
+
+
+792
+793
+794
+795
+796
+
+
# File 'lib/vips/image.rb', line 792
+
+def mutate
+  mutable = Vips::MutableImage.new self
+  yield mutable
+  mutable.image
+end
+
+
+ +
+

+ + #new_from_image(value) ⇒ Image + + + + + +

+
+ +

A new image is created with the same width, height, format, interpretation, resolution and offset as self, but with every pixel set to the specified value.

+ +

You can pass an array to make a many-band image, or a single value to make a one-band image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + value + + + (Real, Array<Real>) + + + + — +
    +

    value to put in each pixel

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    constant image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+548
+549
+550
+551
+552
+553
+
+
# File 'lib/vips/image.rb', line 548
+
+def new_from_image value
+  pixel = (Vips::Image.black(1, 1) + value).cast(format)
+  image = pixel.embed 0, 0, width, height, extend: :copy
+  image.copy interpretation: interpretation, xres: xres, yres: yres,
+    xoffset: xoffset, yoffset: yoffset
+end
+
+
+ +
+

+ + #niftisave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to nifti file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2145
+
+
+
+
+ +
+

+ + #offsetFloat + + + + + +

+
+ +

Get offset metadata.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +
    +

    image offset

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+924
+925
+926
+927
+928
+
+
# File 'lib/vips/image.rb', line 924
+
+def offset
+  return 0 if get_typeof("offset") == 0
+
+  get "offset"
+end
+
+
+ +
+

+ + #parent_get_typeofObject + + + + + +

+ + + + +
+
+
+
+79
+
+
# File 'lib/vips/image.rb', line 79
+
+alias_method :parent_get_typeof, :get_typeof
+
+
+ +
+

+ + #percent(percent, **opts) ⇒ Integer + + + + + +

+
+ +

Find threshold for percent of pixels.

+ + +
+
+
+

Parameters:

+
    + +
  • + + percent + + + (Float) + + + + — +
    +

    Percent of pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    Threshold above which lie percent of pixels

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2613
+
+
+
+
+ +
+

+ + #phasecor(in2, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Calculate phase correlation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + in2 + + + (Vips::Image) + + + + — +
    +

    Second input image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2798
+
+
+
+
+ +
+

+ + #pngsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to png file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :compression + (Integer) + + + + + —
    +

    Compression factor

    +
    + +
  • + +
  • + :interlace + (Boolean) + + + + + —
    +

    Interlace image

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :filter + (Vips::ForeignPngFilter) + + + + + —
    +

    libpng row filter flag(s)

    +
    + +
  • + +
  • + :palette + (Boolean) + + + + + —
    +

    Quantise to 8bpp palette

    +
    + +
  • + +
  • + :colours + (Integer) + + + + + —
    +

    Max number of palette colours

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Quantisation quality

    +
    + +
  • + +
  • + :dither + (Float) + + + + + —
    +

    Amount of dithering

    +
    + +
  • + +
  • + :bitdepth + (Integer) + + + + + —
    +

    Write as a 1, 2, 4 or 8 bit image

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1887
+
+
+
+
+ +
+

+ + #pngsave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image to png buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :compression + (Integer) + + + + + —
    +

    Compression factor

    +
    + +
  • + +
  • + :interlace + (Boolean) + + + + + —
    +

    Interlace image

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :filter + (Vips::ForeignPngFilter) + + + + + —
    +

    libpng row filter flag(s)

    +
    + +
  • + +
  • + :palette + (Boolean) + + + + + —
    +

    Quantise to 8bpp palette

    +
    + +
  • + +
  • + :colours + (Integer) + + + + + —
    +

    Max number of palette colours

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Quantisation quality

    +
    + +
  • + +
  • + :dither + (Float) + + + + + —
    +

    Amount of dithering

    +
    + +
  • + +
  • + :bitdepth + (Integer) + + + + + —
    +

    Write as a 1, 2, 4 or 8 bit image

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1905
+
+
+
+
+ +
+

+ + #pngsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image to target as png.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :compression + (Integer) + + + + + —
    +

    Compression factor

    +
    + +
  • + +
  • + :interlace + (Boolean) + + + + + —
    +

    Interlace image

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :filter + (Vips::ForeignPngFilter) + + + + + —
    +

    libpng row filter flag(s)

    +
    + +
  • + +
  • + :palette + (Boolean) + + + + + —
    +

    Quantise to 8bpp palette

    +
    + +
  • + +
  • + :colours + (Integer) + + + + + —
    +

    Max number of palette colours

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Quantisation quality

    +
    + +
  • + +
  • + :dither + (Float) + + + + + —
    +

    Amount of dithering

    +
    + +
  • + +
  • + :bitdepth + (Integer) + + + + + —
    +

    Write as a 1, 2, 4 or 8 bit image

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1922
+
+
+
+
+ +
+

+ + #polarImage + + + + + +

+
+ +

Return an image with rectangular pixels converted to polar.

+ +

The image can be complex, in which case the return image will also be complex, or must have an even number of bands, in which case pairs of bands are treated as (x, y) coordinates.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    image converted to polar coordinates

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+1358
+1359
+1360
+
+
# File 'lib/vips/image.rb', line 1358
+
+def polar
+  Image.run_cmplx(self) { |x| x.complex :polar }
+end
+
+
+ +
+

+ + #ppmsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to ppm file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :ascii + (Boolean) + + + + + —
    +

    save as ascii

    +
    + +
  • + +
  • + :squash + (Boolean) + + + + + —
    +

    save as one bit

    +
    + +
  • + +
  • + :bitdepth + (Integer) + + + + + —
    +

    set to 1 to write as a 1 bit image

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1702
+
+
+
+
+ +
+

+ + #ppmsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save to ppm.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :ascii + (Boolean) + + + + + —
    +

    save as ascii

    +
    + +
  • + +
  • + :squash + (Boolean) + + + + + —
    +

    save as one bit

    +
    + +
  • + +
  • + :bitdepth + (Integer) + + + + + —
    +

    set to 1 to write as a 1 bit image

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1714
+
+
+
+
+ +
+

+ + #premultiply(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Premultiply image alpha.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :max_alpha + (Float) + + + + + —
    +

    Maximum value of alpha channel

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 493
+
+
+
+
+ +
+

+ + #profile(**opts) ⇒ Array<Vips::Image, Vips::Image> + + + + + +

+
+ +

Find image profiles.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array<Vips::Image, Vips::Image>) + + + + — +
    +

    First non-zero pixel in column, First non-zero pixel in row

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 235
+
+
+
+
+ +
+

+ + #project(**opts) ⇒ Array<Vips::Image, Vips::Image> + + + + + +

+
+ +

Find image projections.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+ + +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 230
+
+
+
+
+ +
+

+ + #quadratic(coeff, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Resample an image with a quadratic transform.

+ + +
+
+
+

Parameters:

+
    + +
  • + + coeff + + + (Vips::Image) + + + + — +
    +

    Coefficient matrix

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :interpolate + (Vips::Interpolate) + + + + + —
    +

    Interpolate values with this

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2344
+
+
+
+
+ +
+

+ + #rad2float(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Unpack radiance coding to float rgb.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2492
+
+
+
+
+ +
+

+ + #radsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to radiance file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1726
+
+
+
+
+ +
+

+ + #radsave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image to radiance buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1735
+
+
+
+
+ +
+

+ + #radsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image to radiance target.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1743
+
+
+
+
+ +
+

+ + #rank(width, height, index, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Rank filter.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Window width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Window height in pixels

    +
    + +
  • + +
  • + + index + + + (Integer) + + + + — +
    +

    Select pixel at index

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2811
+
+
+
+
+ +
+

+ + #rawsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to raw file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1666
+
+
+
+
+ +
+

+ + #rawsave_fd(fd, **opts) ⇒ nil + + + + + +

+
+ +

Write raw image to file descriptor.

+ + +
+
+
+

Parameters:

+
    + +
  • + + fd + + + (Integer) + + + + — +
    +

    File descriptor to write to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1675
+
+
+
+
+ +
+

+ + #realImage + + + + + +

+
+ +

Return the real part of a complex image.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    real part of complex image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1338
+1339
+1340
+
+
# File 'lib/vips/image.rb', line 1338
+
+def real
+  complexget :real
+end
+
+
+ +
+

+ + #recomb(m, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Linear recombination with matrix.

+ + +
+
+
+

Parameters:

+
    + +
  • + + m + + + (Vips::Image) + + + + — +
    +

    matrix of coefficients

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 468
+
+
+
+
+ +
+

+ + #rectImage + + + + + +

+
+ +

Return an image with polar pixels converted to rectangular.

+ +

The image can be complex, in which case the return image will also be complex, or must have an even number of bands, in which case pairs of bands are treated as (x, y) coordinates.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    image converted to rectangular coordinates

    +
    + +
  • + +
+ +

See Also:

+ + +
+ + + + +
+
+
+
+1371
+1372
+1373
+
+
# File 'lib/vips/image.rb', line 1371
+
+def rect
+  Image.run_cmplx(self) { |x| x.complex :rect }
+end
+
+
+ +
+

+ + #reduce(hshrink, vshrink, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Reduce an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + hshrink + + + (Float) + + + + — +
    +

    Horizontal shrink factor

    +
    + +
  • + +
  • + + vshrink + + + (Float) + + + + — +
    +

    Vertical shrink factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :kernel + (Vips::Kernel) + + + + + —
    +

    Resampling kernel

    +
    + +
  • + +
  • + :centre + (Boolean) + + + + + —
    +

    Use centre sampling convention

    +
    + +
  • + +
  • + :xshrink + (Float) + + + + + —
    +

    Horizontal shrink factor

    +
    + +
  • + +
  • + :yshrink + (Float) + + + + + —
    +

    Vertical shrink factor

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2333
+
+
+
+
+ +
+

+ + #reduceh(hshrink, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Shrink an image horizontally.

+ + +
+
+
+

Parameters:

+
    + +
  • + + hshrink + + + (Float) + + + + — +
    +

    Horizontal shrink factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :xshrink + (Float) + + + + + —
    +

    Horizontal shrink factor

    +
    + +
  • + +
  • + :kernel + (Vips::Kernel) + + + + + —
    +

    Resampling kernel

    +
    + +
  • + +
  • + :centre + (Boolean) + + + + + —
    +

    Use centre sampling convention

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2315
+
+
+
+
+ +
+

+ + #reducev(vshrink, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Shrink an image vertically.

+ + +
+
+
+

Parameters:

+
    + +
  • + + vshrink + + + (Float) + + + + — +
    +

    Vertical shrink factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :yshrink + (Float) + + + + + —
    +

    Vertical shrink factor

    +
    + +
  • + +
  • + :kernel + (Vips::Kernel) + + + + + —
    +

    Resampling kernel

    +
    + +
  • + +
  • + :centre + (Boolean) + + + + + —
    +

    Use centre sampling convention

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2324
+
+
+
+
+ +
+

+ + #relational(right, relational, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Relational operation on two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + relational + + + (Vips::OperationRelational) + + + + — +
    +

    relational to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 39
+
+
+
+
+ +
+

+ + #relational_const(relational, c, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Relational operations against a constant.

+ + +
+
+
+

Parameters:

+
    + +
  • + + relational + + + (Vips::OperationRelational) + + + + — +
    +

    relational to perform

    +
    + +
  • + +
  • + + c + + + (Array<Double>) + + + + — +
    +

    Array of constants

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 120
+
+
+
+
+ +
+

+ + #remainder(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Remainder after integer division of two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 46
+
+
+
+
+ +
+

+ + #remainder_const(c, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Remainder after integer division of an image and a constant.

+ + +
+
+
+

Parameters:

+
    + +
  • + + c + + + (Array<Double>) + + + + — +
    +

    Array of constants

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 127
+
+
+
+
+ +
+

+ + #remove(name) ⇒ Object + + + + + +

+
+ +

This method is deprecated.

+ +

Please use MutableImage#remove! instead.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+819
+820
+821
+
+
# File 'lib/vips/image.rb', line 819
+
+def remove name
+  Vips.vips_image_remove self, name
+end
+
+
+ +
+

+ + #replicate(across, down, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Replicate an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + across + + + (Integer) + + + + — +
    +

    Repeat this many times horizontally

    +
    + +
  • + +
  • + + down + + + (Integer) + + + + — +
    +

    Repeat this many times vertically

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 435
+
+
+
+
+ +
+

+ + #resize(scale, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Resize an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + scale + + + (Float) + + + + — +
    +

    Scale image by this factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :interpolate + (Vips::Interpolate) + + + + + —
    +

    Interpolate pixels with this

    +
    + +
  • + +
  • + :kernel + (Vips::Kernel) + + + + + —
    +

    Resampling kernel

    +
    + +
  • + +
  • + :centre + (Boolean) + + + + + —
    +

    Use centre sampling convention

    +
    + +
  • + +
  • + :vscale + (Float) + + + + + —
    +

    Vertical scale image by this factor

    +
    + +
  • + +
  • + :idx + (Float) + + + + + —
    +

    Horizontal input displacement

    +
    + +
  • + +
  • + :idy + (Float) + + + + + —
    +

    Vertical input displacement

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2391
+
+
+
+
+ +
+

+ + #respond_to?(name, include_all = false) ⇒ Boolean + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+
+
# File 'lib/vips/image.rb', line 198
+
+def respond_to? name, include_all = false
+  # To support keyword args, we need to tell Ruby that final image
+  # arguments cannot be hashes of keywords.
+  #
+  # https://makandracards.com/makandra/
+  #   36013-heads-up-ruby-implicitly-converts-a-hash-to-keyword-arguments
+  return false if name == :to_hash
+
+  super
+end
+
+
+ +
+

+ + #respond_to_missing?(name, include_all = false) ⇒ Boolean + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+209
+210
+211
+212
+213
+214
+
+
# File 'lib/vips/image.rb', line 209
+
+def respond_to_missing? name, include_all = false
+  # respond to all vips operations by nickname
+  return true if Vips.type_find("VipsOperation", name.to_s) != 0
+
+  super
+end
+
+
+ +
+

+ + #rintImage + + + + + +

+
+ +

Return the nearest integral value.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    rint of image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1228
+1229
+1230
+
+
# File 'lib/vips/image.rb', line 1228
+
+def rint
+  round :rint
+end
+
+
+ +
+

+ + #rot(angle, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Rotate an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + angle + + + (Vips::Angle) + + + + — +
    +

    Angle to rotate image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 449
+
+
+
+
+ +
+

+ + #rot180Image + + + + + +

+
+ +

Rotate by 180 degrees clockwise.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    rotated image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1513
+1514
+1515
+
+
# File 'lib/vips/image.rb', line 1513
+
+def rot180
+  rot :d180
+end
+
+
+ +
+

+ + #rot270Image + + + + + +

+
+ +

Rotate by 270 degrees clockwise.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    rotated image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1520
+1521
+1522
+
+
# File 'lib/vips/image.rb', line 1520
+
+def rot270
+  rot :d270
+end
+
+
+ +
+

+ + #rot45(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Rotate an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :angle + (Vips::Angle45) + + + + + —
    +

    Angle to rotate image

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 455
+
+
+
+
+ +
+

+ + #rot90Image + + + + + +

+
+ +

Rotate by 90 degrees clockwise.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    rotated image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1506
+1507
+1508
+
+
# File 'lib/vips/image.rb', line 1506
+
+def rot90
+  rot :d90
+end
+
+
+ +
+

+ + #rotate(angle, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Rotate an image by a number of degrees.

+ + +
+
+
+

Parameters:

+
    + +
  • + + angle + + + (Float) + + + + — +
    +

    Rotate anticlockwise by this many degrees

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :interpolate + (Vips::Interpolate) + + + + + —
    +

    Interpolate pixels with this

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :odx + (Float) + + + + + —
    +

    Horizontal output displacement

    +
    + +
  • + +
  • + :ody + (Float) + + + + + —
    +

    Vertical output displacement

    +
    + +
  • + +
  • + :idx + (Float) + + + + + —
    +

    Horizontal input displacement

    +
    + +
  • + +
  • + :idy + (Float) + + + + + —
    +

    Vertical input displacement

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2379
+
+
+
+
+ +
+

+ + #round(round, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Perform a round function on an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + round + + + (Vips::OperationRound) + + + + — +
    +

    rounding operation to perform

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 114
+
+
+
+
+ +
+

+ + #scaleFloat + + + + + +

+
+ +

Get scale metadata.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +
    +

    image scale

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+915
+916
+917
+918
+919
+
+
# File 'lib/vips/image.rb', line 915
+
+def scale
+  return 1 if get_typeof("scale") == 0
+
+  get "scale"
+end
+
+
+ +
+

+ + #scaleimage(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Scale an image to uchar. This is the vips scale operation, but renamed to avoid a clash with the .scale property.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1551
+1552
+1553
+
+
# File 'lib/vips/image.rb', line 1551
+
+def scaleimage **opts
+  Vips::Image.scale self, **opts
+end
+
+
+ +
+

+ + #scRGB2BW(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Convert scrgb to bw.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :depth + (Integer) + + + + + —
    +

    Output device space depth in bits

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2572
+
+
+
+
+ +
+

+ + #scRGB2sRGB(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Convert an scrgb image to srgb.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :depth + (Integer) + + + + + —
    +

    Output device space depth in bits

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2578
+
+
+
+
+ +
+

+ + #scRGB2XYZ(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform scrgb to xyz.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2452
+
+
+
+
+ +
+

+ + #sequential(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Check sequential access.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :trace + (Boolean) + + + + + —
    +

    trace pixel requests

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Expected access pattern

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 301
+
+
+
+
+ +
+

+ + #set(name, value) ⇒ Object + + + + + +

+
+ +

This method is deprecated.

+ +

Please use MutableImage#set! instead.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+812
+813
+814
+
+
# File 'lib/vips/image.rb', line 812
+
+def set name, value
+  set_type get_typeof(name), name, value
+end
+
+
+ +
+

+ + #set_kill(kill) ⇒ Object + + + + + +

+
+ +

Kill computation of this time.

+ +

Set true to stop computation of this image. You can call this from a progress handler, for example.

+ + +
+
+
+

Parameters:

+
    + +
  • + + kill + + + (Boolean) + + + + — +
    +

    stop computation

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+706
+707
+708
+
+
# File 'lib/vips/image.rb', line 706
+
+def set_kill kill
+  Vips.vips_image_set_kill self, kill
+end
+
+
+ +
+

+ + #set_progress(state) ⇒ Object + + + + + +

+
+ +

Turn progress signalling on and off.

+ +

If this is on, the most-downstream image from this image will issue progress signals.

+ + +
+
+
+

Parameters:

+
    + +
  • + + state + + + (Boolean) + + + + — +
    +

    progress signalling state

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+695
+696
+697
+
+
# File 'lib/vips/image.rb', line 695
+
+def set_progress state
+  Vips.vips_image_set_progress self, state
+end
+
+
+ +
+

+ + #set_type(gtype, name, value) ⇒ Object + + + + + +

+
+ +

This method is deprecated.

+ +

Please use MutableImage#set_type! instead.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+801
+802
+803
+804
+805
+806
+807
+
+
# File 'lib/vips/image.rb', line 801
+
+def set_type gtype, name, value
+  gvalue = GObject::GValue.alloc
+  gvalue.init gtype
+  gvalue.set value
+  Vips.vips_image_set self, name, gvalue
+  gvalue.unset
+end
+
+
+ +
+

+ + #set_value(name, value) ⇒ Object + + + + + +

+
+ +

This method is deprecated.

+ +

Please use MutableImage#set! instead.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+831
+832
+833
+
+
# File 'lib/vips/image.rb', line 831
+
+def set_value name, value
+  set name, value
+end
+
+
+ +
+

+ + #sharpen(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Unsharp masking for print.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :radius + (Integer) + + + + + —
    +

    radius of Gaussian

    +
    + +
  • + +
  • + :sigma + (Float) + + + + + —
    +

    Sigma of Gaussian

    +
    + +
  • + +
  • + :x1 + (Float) + + + + + —
    +

    Flat/jaggy threshold

    +
    + +
  • + +
  • + :y2 + (Float) + + + + + —
    +

    Maximum brightening

    +
    + +
  • + +
  • + :y3 + (Float) + + + + + —
    +

    Maximum darkening

    +
    + +
  • + +
  • + :m1 + (Float) + + + + + —
    +

    Slope for flat areas

    +
    + +
  • + +
  • + :m2 + (Float) + + + + + —
    +

    Slope for jaggy areas

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2744
+
+
+
+
+ +
+

+ + #shrink(hshrink, vshrink, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Shrink an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + hshrink + + + (Float) + + + + — +
    +

    Horizontal shrink factor

    +
    + +
  • + +
  • + + vshrink + + + (Float) + + + + — +
    +

    Vertical shrink factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :xshrink + (Float) + + + + + —
    +

    Horizontal shrink factor

    +
    + +
  • + +
  • + :yshrink + (Float) + + + + + —
    +

    Vertical shrink factor

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2292
+
+
+
+
+ +
+

+ + #shrinkh(hshrink, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Shrink an image horizontally.

+ + +
+
+
+

Parameters:

+
    + +
  • + + hshrink + + + (Integer) + + + + — +
    +

    Horizontal shrink factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :xshrink + (Integer) + + + + + —
    +

    Horizontal shrink factor

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2301
+
+
+
+
+ +
+

+ + #shrinkv(vshrink, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Shrink an image vertically.

+ + +
+
+
+

Parameters:

+
    + +
  • + + vshrink + + + (Integer) + + + + — +
    +

    Vertical shrink factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :yshrink + (Integer) + + + + + —
    +

    Vertical shrink factor

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2308
+
+
+
+
+ +
+

+ + #sign(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Unit vector of pixel.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 109
+
+
+
+
+ +
+

+ + #similarity(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Similarity transform of an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :scale + (Float) + + + + + —
    +

    Scale by this factor

    +
    + +
  • + +
  • + :angle + (Float) + + + + + —
    +

    Rotate anticlockwise by this many degrees

    +
    + +
  • + +
  • + :interpolate + (Vips::Interpolate) + + + + + —
    +

    Interpolate pixels with this

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :odx + (Float) + + + + + —
    +

    Horizontal output displacement

    +
    + +
  • + +
  • + :ody + (Float) + + + + + —
    +

    Vertical output displacement

    +
    + +
  • + +
  • + :idx + (Float) + + + + + —
    +

    Horizontal input displacement

    +
    + +
  • + +
  • + :idy + (Float) + + + + + —
    +

    Vertical input displacement

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2366
+
+
+
+
+ +
+

+ + #sinImage + + + + + +

+
+ +

Return the sine of an image in degrees.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    sine of each pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1398
+1399
+1400
+
+
# File 'lib/vips/image.rb', line 1398
+
+def sin
+  math :sin
+end
+
+
+ +
+

+ + #sizeInteger + + + + + +

+
+ +

Get the image size.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer, Integer) + + + + — +
    +

    image width and height

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+933
+934
+935
+
+
# File 'lib/vips/image.rb', line 933
+
+def size
+  [width, height]
+end
+
+
+ +
+

+ + #smartcrop(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Extract an area from an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Width of extract area

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Height of extract area

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :interesting + (Vips::Interesting) + + + + + —
    +

    How to measure interestingness

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 396
+
+
+
+
+ +
+

+ + #sobel(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Sobel edge detector.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2771
+
+
+
+
+ +
+

+ + #spcor(ref, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Spatial correlation.

+ + +
+
+
+

Parameters:

+
    + +
  • + + ref + + + (Vips::Image) + + + + — +
    +

    Input reference image

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2738
+
+
+
+
+ +
+

+ + #spectrum(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Make displayable power spectrum.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2793
+
+
+
+
+ +
+

+ + #sRGB2HSV(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform srgb to hsv.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2507
+
+
+
+
+ +
+

+ + #sRGB2scRGB(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Convert an srgb image to scrgb.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2567
+
+
+
+
+ +
+

+ + #stats(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Find many image stats.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output array of statistics

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 191
+
+
+
+
+ +
+

+ + #stdif(width, height, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Statistical difference.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Window width in pixels

    +
    + +
  • + +
  • + + height + + + (Integer) + + + + — +
    +

    Window height in pixels

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :s0 + (Float) + + + + + —
    +

    New deviation

    +
    + +
  • + +
  • + :b + (Float) + + + + + —
    +

    Weight of new deviation

    +
    + +
  • + +
  • + :m0 + (Float) + + + + + —
    +

    New mean

    +
    + +
  • + +
  • + :a + (Float) + + + + + —
    +

    Weight of new mean

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2619
+
+
+
+
+ +
+

+ + #subsample(xfac, yfac, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Subsample an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + xfac + + + (Integer) + + + + — +
    +

    Horizontal subsample factor

    +
    + +
  • + +
  • + + yfac + + + (Integer) + + + + — +
    +

    Vertical subsample factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :point + (Boolean) + + + + + —
    +

    Point sample

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 534
+
+
+
+
+ +
+

+ + #subtract(right, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Subtract two images.

+ + +
+
+
+

Parameters:

+
    + +
  • + + right + + + (Vips::Image) + + + + — +
    +

    Right-hand image argument

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 21
+
+
+
+
+ +
+

+ + #tanImage + + + + + +

+
+ +

Return the tangent of an image in degrees.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    tangent of each pixel

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1412
+1413
+1414
+
+
# File 'lib/vips/image.rb', line 1412
+
+def tan
+  math :tan
+end
+
+
+ +
+

+ + #thumbnail_image(width, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Generate thumbnail from image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + width + + + (Integer) + + + + — +
    +

    Size to this width

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :height + (Integer) + + + + + —
    +

    Size to this height

    +
    + +
  • + +
  • + :size + (Vips::Size) + + + + + —
    +

    Only upsize, only downsize, or both

    +
    + +
  • + +
  • + :no_rotate + (Boolean) + + + + + —
    +

    Don't use orientation tags to rotate image upright

    +
    + +
  • + +
  • + :crop + (Vips::Interesting) + + + + + —
    +

    Reduce to fill target rectangle, then crop

    +
    + +
  • + +
  • + :linear + (Boolean) + + + + + —
    +

    Reduce in linear light

    +
    + +
  • + +
  • + :import_profile + (String) + + + + + —
    +

    Fallback import profile

    +
    + +
  • + +
  • + :export_profile + (String) + + + + + —
    +

    Fallback export profile

    +
    + +
  • + +
  • + :intent + (Vips::Intent) + + + + + —
    +

    Rendering intent

    +
    + +
  • + +
  • + :auto_rotate + (Boolean) + + + + + —
    +

    Use orientation tags to rotate image upright

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2253
+
+
+
+
+ +
+

+ + #tiffsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to tiff file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :compression + (Vips::ForeignTiffCompression) + + + + + —
    +

    Compression for this file

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :predictor + (Vips::ForeignTiffPredictor) + + + + + —
    +

    Compression prediction

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :tile + (Boolean) + + + + + —
    +

    Write a tiled tiff

    +
    + +
  • + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :pyramid + (Boolean) + + + + + —
    +

    Write a pyramidal tiff

    +
    + +
  • + +
  • + :squash + (Boolean) + + + + + —
    +

    Squash images down to 1 bit

    +
    + +
  • + +
  • + :miniswhite + (Boolean) + + + + + —
    +

    Use 0 for white in 1-bit images

    +
    + +
  • + +
  • + :bitdepth + (Integer) + + + + + —
    +

    Write as a 1, 2, 4 or 8 bit image

    +
    + +
  • + +
  • + :resunit + (Vips::ForeignTiffResunit) + + + + + —
    +

    Resolution unit

    +
    + +
  • + +
  • + :xres + (Float) + + + + + —
    +

    Horizontal resolution in pixels/mm

    +
    + +
  • + +
  • + :yres + (Float) + + + + + —
    +

    Vertical resolution in pixels/mm

    +
    + +
  • + +
  • + :bigtiff + (Boolean) + + + + + —
    +

    Write a bigtiff image

    +
    + +
  • + +
  • + :rgbjpeg + (Boolean) + + + + + —
    +

    Output RGB JPEG rather than YCbCr

    +
    + +
  • + +
  • + :properties + (Boolean) + + + + + —
    +

    Write a properties document to IMAGEDESCRIPTION

    +
    + +
  • + +
  • + :region_shrink + (Vips::RegionShrink) + + + + + —
    +

    Method to shrink regions

    +
    + +
  • + +
  • + :level + (Integer) + + + + + —
    +

    ZSTD compression level

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable WEBP lossless mode

    +
    + +
  • + +
  • + :depth + (Vips::ForeignDzDepth) + + + + + —
    +

    Pyramid depth

    +
    + +
  • + +
  • + :subifd + (Boolean) + + + + + —
    +

    Save pyr layers as sub-IFDs

    +
    + +
  • + +
  • + :premultiply + (Boolean) + + + + + —
    +

    Save with premultiplied alpha

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2073
+
+
+
+
+ +
+

+ + #tiffsave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image to tiff buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :compression + (Vips::ForeignTiffCompression) + + + + + —
    +

    Compression for this file

    +
    + +
  • + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :predictor + (Vips::ForeignTiffPredictor) + + + + + —
    +

    Compression prediction

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :tile + (Boolean) + + + + + —
    +

    Write a tiled tiff

    +
    + +
  • + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :pyramid + (Boolean) + + + + + —
    +

    Write a pyramidal tiff

    +
    + +
  • + +
  • + :squash + (Boolean) + + + + + —
    +

    Squash images down to 1 bit

    +
    + +
  • + +
  • + :miniswhite + (Boolean) + + + + + —
    +

    Use 0 for white in 1-bit images

    +
    + +
  • + +
  • + :bitdepth + (Integer) + + + + + —
    +

    Write as a 1, 2, 4 or 8 bit image

    +
    + +
  • + +
  • + :resunit + (Vips::ForeignTiffResunit) + + + + + —
    +

    Resolution unit

    +
    + +
  • + +
  • + :xres + (Float) + + + + + —
    +

    Horizontal resolution in pixels/mm

    +
    + +
  • + +
  • + :yres + (Float) + + + + + —
    +

    Vertical resolution in pixels/mm

    +
    + +
  • + +
  • + :bigtiff + (Boolean) + + + + + —
    +

    Write a bigtiff image

    +
    + +
  • + +
  • + :rgbjpeg + (Boolean) + + + + + —
    +

    Output RGB JPEG rather than YCbCr

    +
    + +
  • + +
  • + :properties + (Boolean) + + + + + —
    +

    Write a properties document to IMAGEDESCRIPTION

    +
    + +
  • + +
  • + :region_shrink + (Vips::RegionShrink) + + + + + —
    +

    Method to shrink regions

    +
    + +
  • + +
  • + :level + (Integer) + + + + + —
    +

    ZSTD compression level

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    Enable WEBP lossless mode

    +
    + +
  • + +
  • + :depth + (Vips::ForeignDzDepth) + + + + + —
    +

    Pyramid depth

    +
    + +
  • + +
  • + :subifd + (Boolean) + + + + + —
    +

    Save pyr layers as sub-IFDs

    +
    + +
  • + +
  • + :premultiply + (Boolean) + + + + + —
    +

    Save with premultiplied alpha

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2105
+
+
+
+
+ +
+

+ + #tilecache(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Cache an image as a set of tiles.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :tile_width + (Integer) + + + + + —
    +

    Tile width in pixels

    +
    + +
  • + +
  • + :tile_height + (Integer) + + + + + —
    +

    Tile height in pixels

    +
    + +
  • + +
  • + :max_tiles + (Integer) + + + + + —
    +

    Maximum number of tiles to cache

    +
    + +
  • + +
  • + :access + (Vips::Access) + + + + + —
    +

    Expected access pattern

    +
    + +
  • + +
  • + :threaded + (Boolean) + + + + + —
    +

    Allow threaded access

    +
    + +
  • + +
  • + :persistent + (Boolean) + + + + + —
    +

    Keep cache between evaluations

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 281
+
+
+
+
+ +
+

+ + #to_aArray + + + + + +

+
+ +

Convert to an Array. This will be slow for large images.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +
    +

    Array of Arrays of Arrays of Numerics

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1207
+1208
+1209
+
+
# File 'lib/vips/image.rb', line 1207
+
+def to_a
+  to_enum.to_a
+end
+
+
+ +
+

+ + #to_enumEnumerator + + + + + +

+
+ +

Convert to an Enumerator. Similar to #to_a but lazier.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Enumerator) + + + + — +
    +

    Enumerator of Enumerators of Arrays of Numerics

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+
+
# File 'lib/vips/image.rb', line 1178
+
+def to_enum
+  # make the template for unpack
+  template = {
+    char: "c",
+    uchar: "C",
+    short: "s_",
+    ushort: "S_",
+    int: "i_",
+    uint: "I_",
+    float: "f",
+    double: "d",
+    complex: "f",
+    dpcomplex: "d"
+  }[format] + "*"
+
+  # we render the image to a big string, then unpack into
+  # one-dimensional array as a Ruby array of the correct type
+  array = write_to_memory.unpack template
+
+  # gather bands of a pixel together
+  pixel_array = array.each_slice bands
+
+  # gather pixels of a row together
+  pixel_array.each_slice width
+end
+
+
+ +
+

+ + #transpose3d(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transpose3d an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :page_height + (Integer) + + + + + —
    +

    Height of each input page

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 514
+
+
+
+
+ +
+

+ + #unpremultiply(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Unpremultiply image alpha.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :max_alpha + (Float) + + + + + —
    +

    Maximum value of alpha channel

    +
    + +
  • + +
  • + :alpha_band + (Integer) + + + + + —
    +

    Unpremultiply with this alpha

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 499
+
+
+
+
+ +
+

+ + #vipssave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to file in vips format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1684
+
+
+
+
+ +
+

+ + #vipssave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image to target in vips format.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 1693
+
+
+
+
+ +
+

+ + #webpsave(filename, **opts) ⇒ nil + + + + + +

+
+ +

Save image to webp file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    Filename to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    enable lossless compression

    +
    + +
  • + +
  • + :preset + (Vips::ForeignWebpPreset) + + + + + —
    +

    Preset for lossy compression

    +
    + +
  • + +
  • + :smart_subsample + (Boolean) + + + + + —
    +

    Enable high quality chroma subsampling

    +
    + +
  • + +
  • + :near_lossless + (Boolean) + + + + + —
    +

    Enable preprocessing in lossless mode (uses Q)

    +
    + +
  • + +
  • + :alpha_q + (Integer) + + + + + —
    +

    Change alpha plane fidelity for lossy compression

    +
    + +
  • + +
  • + :min_size + (Boolean) + + + + + —
    +

    Optimise for minium size

    +
    + +
  • + +
  • + :kmin + (Integer) + + + + + —
    +

    Minimum number of frames between key frames

    +
    + +
  • + +
  • + :kmax + (Integer) + + + + + —
    +

    Maximum number of frames between key frames

    +
    + +
  • + +
  • + :reduction_effort + (Integer) + + + + + —
    +

    Level of CPU effort to reduce file size

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2014
+
+
+
+
+ +
+

+ + #webpsave_buffer(**opts) ⇒ VipsBlob + + + + + +

+
+ +

Save image to webp buffer.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    enable lossless compression

    +
    + +
  • + +
  • + :preset + (Vips::ForeignWebpPreset) + + + + + —
    +

    Preset for lossy compression

    +
    + +
  • + +
  • + :smart_subsample + (Boolean) + + + + + —
    +

    Enable high quality chroma subsampling

    +
    + +
  • + +
  • + :near_lossless + (Boolean) + + + + + —
    +

    Enable preprocessing in lossless mode (uses Q)

    +
    + +
  • + +
  • + :alpha_q + (Integer) + + + + + —
    +

    Change alpha plane fidelity for lossy compression

    +
    + +
  • + +
  • + :min_size + (Boolean) + + + + + —
    +

    Optimise for minium size

    +
    + +
  • + +
  • + :kmin + (Integer) + + + + + —
    +

    Minimum number of frames between key frames

    +
    + +
  • + +
  • + :kmax + (Integer) + + + + + —
    +

    Maximum number of frames between key frames

    +
    + +
  • + +
  • + :reduction_effort + (Integer) + + + + + —
    +

    Level of CPU effort to reduce file size

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (VipsBlob) + + + + — +
    +

    Buffer to save to

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2034
+
+
+
+
+ +
+

+ + #webpsave_target(target, **opts) ⇒ nil + + + + + +

+
+ +

Save image to webp target.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    Target to save to

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :Q + (Integer) + + + + + —
    +

    Q factor

    +
    + +
  • + +
  • + :lossless + (Boolean) + + + + + —
    +

    enable lossless compression

    +
    + +
  • + +
  • + :preset + (Vips::ForeignWebpPreset) + + + + + —
    +

    Preset for lossy compression

    +
    + +
  • + +
  • + :smart_subsample + (Boolean) + + + + + —
    +

    Enable high quality chroma subsampling

    +
    + +
  • + +
  • + :near_lossless + (Boolean) + + + + + —
    +

    Enable preprocessing in lossless mode (uses Q)

    +
    + +
  • + +
  • + :alpha_q + (Integer) + + + + + —
    +

    Change alpha plane fidelity for lossy compression

    +
    + +
  • + +
  • + :min_size + (Boolean) + + + + + —
    +

    Optimise for minium size

    +
    + +
  • + +
  • + :kmin + (Integer) + + + + + —
    +

    Minimum number of frames between key frames

    +
    + +
  • + +
  • + :kmax + (Integer) + + + + + —
    +

    Maximum number of frames between key frames

    +
    + +
  • + +
  • + :reduction_effort + (Integer) + + + + + —
    +

    Level of CPU effort to reduce file size

    +
    + +
  • + +
  • + :profile + (String) + + + + + —
    +

    ICC profile to embed

    +
    + +
  • + +
  • + :strip + (Boolean) + + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Double>) + + + + + —
    +

    Background value

    +
    + +
  • + +
  • + :page_height + (Integer) + + + + + —
    +

    Set page height for multipage save

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (nil) + + + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2053
+
+
+
+
+ +
+

+ + #widthInteger + + + + + +

+
+ +

Get image width, in pixels.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    image width, in pixels

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+838
+839
+840
+
+
# File 'lib/vips/image.rb', line 838
+
+def width
+  Vips.vips_image_get_width self
+end
+
+
+ +
+

+ + #wrap(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Wrap image origin.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :x + (Integer) + + + + + —
    +

    Left edge of input in output

    +
    + +
  • + +
  • + :y + (Integer) + + + + + —
    +

    Top edge of input in output

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 520
+
+
+
+
+ +
+

+ + #write_to_buffer(format_string, **opts) ⇒ String + + + + + +

+
+ +

Write this image to a memory buffer. Save options may be encoded in the format_string or given as a hash. For example:

+ +
buffer = image.write_to_buffer ".jpg[Q=90]"
+
+ +

or equivalently:

+ +
image.write_to_buffer ".jpg", Q: 90
+
+ +

The full set of save options depend on the selected saver. Try something like:

+ +
$ vips jpegsave
+
+ +

to see all the available options for JPEG save.

+ + +
+
+
+

Parameters:

+
    + +
  • + + format_string + + + (String) + + + + — +
    +

    save format plus options

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    set of options

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + — default: + false + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Float>) + + + — default: + 0 + + + + —
    +

    Background colour to flatten alpha against, if necessary

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (String) + + + + — +
    +

    the image saved in the specified format

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+
+
# File 'lib/vips/image.rb', line 622
+
+def write_to_buffer format_string, **opts
+  raise Vips::Error, "filename is nil" if format_string.nil?
+  filename = Vips.p2str(Vips.vips_filename_get_filename(format_string))
+  option_string = Vips.p2str(Vips.vips_filename_get_options(format_string))
+  saver = Vips.vips_foreign_find_save_buffer filename
+  raise Vips::Error if saver.nil?
+
+  buffer = Vips::Operation.call saver, [self], opts, option_string
+  raise Vips::Error if buffer.nil?
+
+  write_gc
+
+  buffer
+end
+
+
+ +
+

+ + #write_to_file(name, **opts) ⇒ Object + + + + + +

+
+ +

Write this image to a file. Save options may be encoded in the filename or given as a hash. For example:

+ +
image.write_to_file "fred.jpg[Q=90]"
+
+ +

or equivalently:

+ +
image.write_to_file "fred.jpg", Q: 90
+
+ +

The full set of save options depend on the selected saver. Try something like:

+ +
$ vips jpegsave
+
+ +

to see all the available options for JPEG save.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    set of options

    +
    + +
  • + +
  • + + name + + + (String) + + + + — +
    +

    filename to write to

    +
    + +
  • + +
+ + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + — default: + false + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Float>) + + + — default: + 0 + + + + —
    +

    Background colour to flatten alpha against, if necessary

    +
    + +
  • + +
+ + +

Raises:

+ + +
+ + + + +
+
+
+
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+
+
# File 'lib/vips/image.rb', line 584
+
+def write_to_file name, **opts
+  raise Vips::Error, "filename is nil" if name.nil?
+
+  filename = Vips.p2str(Vips.vips_filename_get_filename(name))
+  option_string = Vips.p2str(Vips.vips_filename_get_options(name))
+  saver = Vips.vips_foreign_find_save filename
+  raise Vips::Error if saver.nil?
+
+  Vips::Operation.call saver, [self, filename], opts, option_string
+
+  write_gc
+end
+
+
+ +
+

+ + #write_to_memoryString + + + + + +

+
+ +

Write this image to a large memory buffer.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + + — +
    +

    the pixels as a huge binary string

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+
+
# File 'lib/vips/image.rb', line 677
+
+def write_to_memory
+  len = Vips::SizeStruct.new
+  ptr = Vips.vips_image_write_to_memory self, len
+  raise Vips::Error if ptr.nil?
+
+  # wrap up as an autopointer
+  ptr = FFI::AutoPointer.new(ptr, GLib::G_FREE)
+
+  ptr.get_bytes 0, len[:value]
+end
+
+
+ +
+

+ + #write_to_target(target, format_string, **opts) ⇒ Object + + + + + +

+
+ +

Write this image to a target. Save options may be encoded in the format_string or given as a hash. For example:

+ +
target = Vips::Target.new_to_file "k2.jpg"
+image.write_to_target target, ".jpg[Q=90]"
+
+ +

or equivalently:

+ +
image.write_to_target target, ".jpg", Q: 90
+
+ +

The full set of save options depend on the selected saver. Try something like:

+ +
$ vips jpegsave_target
+
+ +

to see all the available options for JPEG save.

+ + +
+
+
+

Parameters:

+
    + +
  • + + target + + + (Vips::Target) + + + + — +
    +

    the target to write to

    +
    + +
  • + +
  • + + format_string + + + (String) + + + + — +
    +

    save format plus string options

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    set of options

    +
    + +
  • + +
+ + + + + + + + +

Options Hash (**opts):

+
    + +
  • + :strip + (Boolean) + + + — default: + false + + + + —
    +

    Strip all metadata from image

    +
    + +
  • + +
  • + :background + (Array<Float>) + + + — default: + 0 + + + + —
    +

    Background colour to flatten alpha against, if necessary

    +
    + +
  • + +
+ + +

Raises:

+ + +
+ + + + +
+
+
+
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+
+
# File 'lib/vips/image.rb', line 663
+
+def write_to_target target, format_string, **opts
+  raise Vips::Error, "filename is nil" if format_string.nil?
+  filename = Vips.p2str(Vips.vips_filename_get_filename(format_string))
+  option_string = Vips.p2str(Vips.vips_filename_get_options(format_string))
+  saver = Vips.vips_foreign_find_save_target filename
+  raise Vips::Error if saver.nil?
+
+  Vips::Operation.call saver, [self, target], opts, option_string
+  write_gc
+end
+
+
+ +
+

+ + #xoffsetInteger + + + + + +

+
+ +

Get image xoffset.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    image xoffset

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+887
+888
+889
+
+
# File 'lib/vips/image.rb', line 887
+
+def xoffset
+  get "xoffset"
+end
+
+
+ +
+

+ + #xresFloat + + + + + +

+
+ +

Get image x resolution.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +
    +

    image x resolution

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+901
+902
+903
+
+
# File 'lib/vips/image.rb', line 901
+
+def xres
+  get "xres"
+end
+
+
+ +
+

+ + #XYZ2CMYK(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform xyz to cmyk.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2589
+
+
+
+
+ +
+

+ + #XYZ2Lab(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform xyz to lab.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ + + + +

Options Hash (**opts):

+
    + +
  • + :temp + (Array<Double>) + + + + + —
    +

    Colour temperature

    +
    + +
  • + +
+ + +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2416
+
+
+
+
+ +
+

+ + #XYZ2scRGB(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform xyz to scrgb.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2457
+
+
+
+
+ +
+

+ + #XYZ2Yxy(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform xyz to yxy.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2442
+
+
+
+
+ +
+

+ + #yoffsetInteger + + + + + +

+
+ +

Get image yoffset.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    image yoffset

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+894
+895
+896
+
+
# File 'lib/vips/image.rb', line 894
+
+def yoffset
+  get "yoffset"
+end
+
+
+ +
+

+ + #yresFloat + + + + + +

+
+ +

Get image y resolution.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Float) + + + + — +
    +

    image y resolution

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+908
+909
+910
+
+
# File 'lib/vips/image.rb', line 908
+
+def yres
+  get "yres"
+end
+
+
+ +
+

+ + #Yxy2XYZ(**opts) ⇒ Vips::Image + + + + + +

+
+ +

Transform yxy to xyz.

+ + +
+
+
+

Parameters:

+
    + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 2447
+
+
+
+
+ +
+

+ + #zoom(xfac, yfac, **opts) ⇒ Vips::Image + + + + + +

+
+ +

Zoom an image.

+ + +
+
+
+

Parameters:

+
    + +
  • + + xfac + + + (Integer) + + + + — +
    +

    Horizontal zoom factor

    +
    + +
  • + +
  • + + yfac + + + (Integer) + + + + — +
    +

    Vertical zoom factor

    +
    + +
  • + +
  • + + opts + + + (Hash) + + + + — +
    +

    Set of options

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Vips::Image) + + + + — +
    +

    Output image

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+
+
+
# File 'lib/vips/methods.rb', line 527
+
+
+
+
+ +
+

+ + #|(other) ⇒ Image + + + + + +

+
+ +

Integer bitwise OR with an image, constant or array.

+ + +
+
+
+

Parameters:

+
    + +
  • + + other + + + (Image, Real, Array<Real>) + + + + — +
    +

    bitwise OR with this

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    result of bitwise OR

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1054
+1055
+1056
+
+
# File 'lib/vips/image.rb', line 1054
+
+def | other
+  call_enum "boolean", other, :or
+end
+
+
+ +
+

+ + #~Image + + + + + +

+
+ +

Equivalent to image ^ -1

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Image) + + + + — +
    +

    image with bits flipped

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+1084
+1085
+1086
+
+
# File 'lib/vips/image.rb', line 1084
+
+def ~
+  self ^ -1
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Image/GenericPtr.html b/Vips/Image/GenericPtr.html new file mode 100644 index 00000000..1bfcbe74 --- /dev/null +++ b/Vips/Image/GenericPtr.html @@ -0,0 +1,124 @@ + + + + + + + Class: Vips::Image::GenericPtr + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Image::GenericPtr + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/image.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Image/ImageLayout.html b/Vips/Image/ImageLayout.html new file mode 100644 index 00000000..e3fafeb1 --- /dev/null +++ b/Vips/Image/ImageLayout.html @@ -0,0 +1,196 @@ + + + + + + + Module: Vips::Image::ImageLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Image::ImageLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/image.rb
+
+ +
+ +

Overview

+
+ +

the layout of the VipsImage struct

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+90
+91
+92
+93
+94
+95
+
+
# File 'lib/vips/image.rb', line 90
+
+def self.included base
+  base.class_eval do
+    layout :parent, Vips::Object::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Image/ManagedStruct.html b/Vips/Image/ManagedStruct.html new file mode 100644 index 00000000..3fd7ff30 --- /dev/null +++ b/Vips/Image/ManagedStruct.html @@ -0,0 +1,183 @@ + + + + + + + Class: Vips::Image::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Image::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Object::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
ImageLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/image.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from ImageLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Image/Struct.html b/Vips/Image/Struct.html new file mode 100644 index 00000000..7a253010 --- /dev/null +++ b/Vips/Image/Struct.html @@ -0,0 +1,178 @@ + + + + + + + Class: Vips::Image::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Image::Struct + + + +

+
+ +
+
Inherits:
+
+ Object::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
ImageLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/image.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from ImageLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/IntStruct.html b/Vips/IntStruct.html new file mode 100644 index 00000000..f386b7aa --- /dev/null +++ b/Vips/IntStruct.html @@ -0,0 +1,124 @@ + + + + + + + Class: Vips::IntStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::IntStruct + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Interesting.html b/Vips/Interesting.html new file mode 100644 index 00000000..b62bc44e --- /dev/null +++ b/Vips/Interesting.html @@ -0,0 +1,144 @@ + + + + + + + Class: Vips::Interesting + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Interesting + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/interesting.rb
+
+ +
+ +

Overview

+
+ +

Pick the algorithm vips uses to decide image “interestingness”. This is used by Vips::Image#smartcrop, for example, to decide what parts of the image to keep.

+
  • +

    :none do nothing

    +
  • +

    :centre just take the centre

    +
  • +

    :entropy use an entropy measure

    +
  • +

    :attention look for features likely to draw human attention

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Interpolate.html b/Vips/Interpolate.html new file mode 100644 index 00000000..34b76a38 --- /dev/null +++ b/Vips/Interpolate.html @@ -0,0 +1,304 @@ + + + + + + + Class: Vips::Interpolate + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Interpolate + + + +

+
+ +
+
Inherits:
+
+ Object + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/interpolate.rb
+
+ +
+ +

Overview

+
+ +

An interpolator. One of these can be given to operations like Vips::Image#affine or Vips::Image#mapim to select the type of pixel interpolation to use.

+ +

To see all interpolators supported by your libvips, try

+ +
$ vips -l interpolate
+
+ +

But at least these should be available:

+
  • +

    :nearest Nearest-neighbour interpolation.

    +
  • +

    :bilinear Bilinear interpolation.

    +
  • +

    :bicubic Bicubic interpolation.

    +
  • +

    :lbb Reduced halo bicubic interpolation.

    +
  • +

    :nohalo Edge sharpening resampler with halo reduction.

    +
  • +

    :vsqbs B-Splines with antialiasing smoothing.

    +
+ +

For example:

+ +

ruby im = im.affine [2, 0, 0, 2], :interpolate => Vips::Interpolate.new(:bicubic)

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: InterpolateLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct

+ + +
+

Constructor Details

+ +
+

+ + #initialize(name) ⇒ Interpolate + + + + + +

+
+ +

Returns a new instance of Interpolate.

+ + +
+
+
+ +

Raises:

+ + +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+
+
# File 'lib/vips/interpolate.rb', line 50
+
+def initialize name
+  name = name.to_s if name.is_a? Symbol
+  ptr = Vips.vips_interpolate_new name
+  raise Vips::Error if ptr.nil?
+
+  super ptr
+end
+
+
+ +
+ + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Interpolate/InterpolateLayout.html b/Vips/Interpolate/InterpolateLayout.html new file mode 100644 index 00000000..c4bc1a52 --- /dev/null +++ b/Vips/Interpolate/InterpolateLayout.html @@ -0,0 +1,196 @@ + + + + + + + Module: Vips::Interpolate::InterpolateLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Interpolate::InterpolateLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/interpolate.rb
+
+ +
+ +

Overview

+
+ +

the layout of the VipsInterpolate struct

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+34
+35
+36
+37
+38
+39
+
+
# File 'lib/vips/interpolate.rb', line 34
+
+def self.included base
+  base.class_eval do
+    layout :parent, Vips::Object::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Interpolate/ManagedStruct.html b/Vips/Interpolate/ManagedStruct.html new file mode 100644 index 00000000..2818a83d --- /dev/null +++ b/Vips/Interpolate/ManagedStruct.html @@ -0,0 +1,183 @@ + + + + + + + Class: Vips::Interpolate::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Interpolate::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Object::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
InterpolateLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/interpolate.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from InterpolateLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Interpolate/Struct.html b/Vips/Interpolate/Struct.html new file mode 100644 index 00000000..31eddd77 --- /dev/null +++ b/Vips/Interpolate/Struct.html @@ -0,0 +1,178 @@ + + + + + + + Class: Vips::Interpolate::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Interpolate::Struct + + + +

+
+ +
+
Inherits:
+
+ Object::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
InterpolateLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/interpolate.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from InterpolateLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Interpretation.html b/Vips/Interpretation.html new file mode 100644 index 00000000..de713bc7 --- /dev/null +++ b/Vips/Interpretation.html @@ -0,0 +1,174 @@ + + + + + + + Class: Vips::Interpretation + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Interpretation + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/interpretation.rb
+
+ +
+ +

Overview

+
+ +

How the values in an image should be interpreted. For example, a three-band float image of type :lab should have its pixels interpreted as coordinates in CIE Lab space.

+
  • +

    :multiband generic many-band image

    +
  • +

    :b_w some kind of single-band image

    +
  • +

    :histogram a 1D image, eg. histogram or lookup table

    +
  • +

    :fourier image is in fourier space

    +
  • +

    :xyz the first three bands are CIE XYZ

    +
  • +

    :lab pixels are in CIE Lab space

    +
  • +

    :cmyk the first four bands are in CMYK space

    +
  • +

    :labq implies #VIPS_CODING_LABQ

    +
  • +

    :rgb generic RGB space

    +
  • +

    :cmc a uniform colourspace based on CMC(1:1)

    +
  • +

    :lch pixels are in CIE LCh space

    +
  • +

    :labs CIE LAB coded as three signed 16-bit values

    +
  • +

    :srgb pixels are sRGB

    +
  • +

    :hsv pixels are HSV

    +
  • +

    :scrgb pixels are scRGB

    +
  • +

    :yxy pixels are CIE Yxy

    +
  • +

    :rgb16 generic 16-bit RGB

    +
  • +

    :grey16 generic 16-bit mono

    +
  • +

    :matrix a matrix

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Introspect.html b/Vips/Introspect.html new file mode 100644 index 00000000..c42ed0a1 --- /dev/null +++ b/Vips/Introspect.html @@ -0,0 +1,1504 @@ + + + + + + + Class: Vips::Introspect + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Introspect + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operation.rb
+
+ +
+ +

Overview

+
+ +

Introspect a vips operation and return a large structure containing everything we know about it. This is used for doc generation as well as call.

+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
@@introspect_cache = + +
+
{}
+ +
+ + + + + +

Instance Attribute Summary collapse

+ + + + + + +

+ Class Method Summary + collapse +

+ + + +

+ Instance Method Summary + collapse +

+ + + + +
+

Constructor Details

+ +
+

+ + #initialize(name) ⇒ Introspect + + + + + +

+
+ +

Returns a new instance of Introspect.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+
+
# File 'lib/vips/operation.rb', line 55
+
+def initialize name
+  # if there's a trailing "!", this is a destructive version of an
+  # operation
+  if name[-1] == "!"
+    @destructive = true
+    # strip the trailing "!"
+    @vips_name = name[0...-1]
+  else
+    @destructive = false
+    @vips_name = name
+  end
+
+  @op = Operation.new @vips_name
+  @args = []
+  @required_input = []
+  @optional_input = {}
+  @required_output = []
+  @optional_output = {}
+
+  # find all the arguments the operator can take
+  @op.argument_map do |pspec, argument_class, _argument_instance|
+    flags = argument_class[:flags]
+    if (flags & ARGUMENT_CONSTRUCT) != 0
+      # names can include - as punctuation, but we always use _ in
+      # Ruby
+      arg_name = pspec[:name].tr("-", "_")
+      @args << {
+        arg_name: arg_name,
+        flags: flags,
+        gtype: pspec[:value_type]
+      }
+    end
+
+    nil
+  end
+
+  @args.each do |details|
+    arg_name = details[:arg_name]
+    flags = details[:flags]
+
+    if (flags & ARGUMENT_INPUT) != 0
+      if (flags & ARGUMENT_REQUIRED) != 0 &&
+          (flags & ARGUMENT_DEPRECATED) == 0
+        @required_input << details
+      else
+        # we allow deprecated optional args
+        @optional_input[arg_name] = details
+      end
+
+      # MODIFY INPUT args count as OUTPUT as well in non-destructive mode
+      if (flags & ARGUMENT_MODIFY) != 0 &&
+          !@destructive
+        if (flags & ARGUMENT_REQUIRED) != 0 &&
+            (flags & ARGUMENT_DEPRECATED) == 0
+          @required_output << details
+        else
+          @optional_output[arg_name] = details
+        end
+      end
+    elsif (flags & ARGUMENT_OUTPUT) != 0
+      if (flags & ARGUMENT_REQUIRED) != 0 &&
+          (flags & ARGUMENT_DEPRECATED) == 0
+        @required_output << details
+      else
+        # again, allow deprecated optional args
+        @optional_output[arg_name] = details
+      end
+    end
+  end
+
+  # in destructive mode, the first required input arg must be MODIFY and
+  # must be an image
+  if @destructive
+    if @required_input.length < 1 ||
+        @required_input[0][:flags] & ARGUMENT_MODIFY == 0 ||
+        @required_input[0][:gtype] != IMAGE_TYPE
+      raise Vips::Error, "operation #{@vips_name} is not destructive"
+    end
+  end
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #argsObject (readonly) + + + + + +

+
+ +

Returns the value of attribute args.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def args
+  @args
+end
+
+
+ + + +
+

+ + #descriptionObject (readonly) + + + + + +

+
+ +

Returns the value of attribute description.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def description
+  @description
+end
+
+
+ + + +
+

+ + #destructiveObject (readonly) + + + + + +

+
+ +

Returns the value of attribute destructive.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def destructive
+  @destructive
+end
+
+
+ + + +
+

+ + #flagsObject (readonly) + + + + + +

+
+ +

Returns the value of attribute flags.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def flags
+  @flags
+end
+
+
+ + + +
+

+ + #member_xObject (readonly) + + + + + +

+
+ +

Returns the value of attribute member_x.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def member_x
+  @member_x
+end
+
+
+ + + +
+

+ + #method_argsObject (readonly) + + + + + +

+
+ +

Returns the value of attribute method_args.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def method_args
+  @method_args
+end
+
+
+ + + +
+

+ + #nameObject (readonly) + + + + + +

+
+ +

Returns the value of attribute name.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def name
+  @name
+end
+
+
+ + + +
+

+ + #optional_inputObject (readonly) + + + + + +

+
+ +

Returns the value of attribute optional_input.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def optional_input
+  @optional_input
+end
+
+
+ + + +
+

+ + #optional_outputObject (readonly) + + + + + +

+
+ +

Returns the value of attribute optional_output.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def optional_output
+  @optional_output
+end
+
+
+ + + +
+

+ + #required_inputObject (readonly) + + + + + +

+
+ +

Returns the value of attribute required_input.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def required_input
+  @required_input
+end
+
+
+ + + +
+

+ + #required_outputObject (readonly) + + + + + +

+
+ +

Returns the value of attribute required_output.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def required_output
+  @required_output
+end
+
+
+ + + +
+

+ + #vips_nameObject (readonly) + + + + + +

+
+ +

Returns the value of attribute vips_name.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+49
+50
+51
+
+
# File 'lib/vips/operation.rb', line 49
+
+def vips_name
+  @vips_name
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .get(name) ⇒ Object + + + + + +

+ + + + +
+
+
+
+169
+170
+171
+
+
# File 'lib/vips/operation.rb', line 169
+
+def self.get name
+  @@introspect_cache[name] ||= Introspect.new name
+end
+
+
+ +
+

+ + .get_yard(name) ⇒ Object + + + + + +

+ + + + +
+
+
+
+173
+174
+175
+176
+177
+
+
# File 'lib/vips/operation.rb', line 173
+
+def self.get_yard name
+  introspect = Introspect.get name
+  introspect.add_yard_introspection name
+  introspect
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #add_yard_introspection(name) ⇒ Object + + + + + +

+
+ +

Yard comment generation needs a little more introspection. We add this extra metadata in a separate method to keep the main path as fast as we can.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+
+
# File 'lib/vips/operation.rb', line 139
+
+def add_yard_introspection name
+  @name = name
+  @description = Vips.vips_object_get_description @op
+  @flags = Vips.vips_operation_get_flags @op
+  @member_x = nil
+  @method_args = []
+
+  @args.each do |details|
+    arg_name = details[:arg_name]
+    flags = details[:flags]
+    gtype = details[:gtype]
+
+    details[:yard_name] = arg_name == "in" ? "im" : arg_name
+    pspec = @op.get_pspec arg_name
+    details[:blurb] = GObject.g_param_spec_get_blurb pspec
+
+    if (flags & ARGUMENT_INPUT) != 0 &&
+        (flags & ARGUMENT_REQUIRED) != 0 &&
+        (flags & ARGUMENT_DEPRECATED) == 0
+      # the first required input image is the thing we will be a method
+      # of
+      if @member_x.nil? && gtype == IMAGE_TYPE
+        @member_x = details
+      else
+        @method_args << details
+      end
+    end
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Kernel.html b/Vips/Kernel.html new file mode 100644 index 00000000..7914ce82 --- /dev/null +++ b/Vips/Kernel.html @@ -0,0 +1,152 @@ + + + + + + + Class: Vips::Kernel + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Kernel + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/kernel.rb
+
+ +
+ +

Overview

+
+ +

A resizing kernel. One of these can be given to operations like Image#reduceh or Image#resize to select the resizing kernel to use.

+ +

At least these should be available:

+
  • +

    :nearest Nearest-neighbour interpolation.

    +
  • +

    :linear Linear interpolation.

    +
  • +

    :cubic Cubic interpolation.

    +
  • +

    :lanczos2 Two-lobe Lanczos

    +
  • +

    :lanczos3 Three-lobe Lanczos

    +
+ +

For example:

+ +

ruby im = im.resize 3, :kernel => :lanczos2

+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/MutableImage.html b/Vips/MutableImage.html new file mode 100644 index 00000000..25f6c57f --- /dev/null +++ b/Vips/MutableImage.html @@ -0,0 +1,1094 @@ + + + + + + + Class: Vips::MutableImage + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::MutableImage + + + +

+
+ +
+
Inherits:
+
+ Object + + + show all + +
+
+ + + + +
+
Extended by:
+
Forwardable
+
+ + + + + + + + +
+
Defined in:
+
lib/vips/mutableimage.rb
+
+ +
+ +

Overview

+
+ +

This class represents a libvips image which can be modified. See Image#mutate.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: MutableImageLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + +

Instance Attribute Summary collapse

+ + + + + + +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct

+ + +
+

Constructor Details

+ +
+

+ + #initialize(image) ⇒ MutableImage + + + + + +

+
+ +

Make a Vips::MutableImage from a regular Image.

+ +

This is for internal use only. See Image#mutate for the user-facing interface.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+
+
# File 'lib/vips/mutableimage.rb', line 50
+
+def initialize(image)
+  # We take a copy of the regular Image to ensure we have an unshared
+  # (unique) object. We forward things like #width and #height to this, and
+  # it's the thing we return at the end of the mutate block.
+  copy_image = image.copy
+
+  # Use ptr since we need the raw unwrapped pointer inside the image ...
+  # and make the ref that gobject will unref when it finishes.
+  # See also the comment on set_type! before changing this.
+  pointer = copy_image.ptr
+  ::GObject.g_object_ref pointer
+  super pointer
+
+  # and save the copy ready for when we finish mutating
+  @image = copy_image
+end
+
+
+ +
+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method + +

+ +
+

+ + #method_missing(name, *args, **options) ⇒ Object + + + + + +

+
+ +

Invoke a vips operation with Operation#call, using self as the first input argument. Operation#call will only allow operations that modify self when passed a Vips::MutableImage.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +
    +

    vips operation to call

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + + + + + +
    +

    result of vips operation

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+95
+96
+97
+
+
# File 'lib/vips/mutableimage.rb', line 95
+
+def method_missing name, *args, **options
+  Vips::Operation.call name.to_s, [self, *args], options
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #imageObject (readonly) + + + + + +

+
+ +

Get the Image this Vips::MutableImage is modifying. Only use this once you have finished all modifications.

+ +

This is for internal use only. See Image#mutate for the user-facing interface.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+44
+45
+46
+
+
# File 'lib/vips/mutableimage.rb', line 44
+
+def image
+  @image
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #inspectObject + + + + + +

+ + + + +
+
+
+
+67
+68
+69
+
+
# File 'lib/vips/mutableimage.rb', line 67
+
+def inspect
+  "#<MutableImage #{width}x#{height} #{format}, #{bands} bands, #{interpretation}>"
+end
+
+
+ +
+

+ + #remove!(name) ⇒ Object + + + + + +

+
+ +

Remove a metadata item from an image.

+ +

For example:

+ +
x.remove! "icc-profile-data"
+
+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +
    +

    Metadata field to remove

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+165
+166
+167
+168
+169
+170
+171
+
+
# File 'lib/vips/mutableimage.rb', line 165
+
+def remove! name
+  # See set_type! for an explanation. Image#remove can't throw an
+  # exception, so there's no need to ensure we unref.
+  ::GObject.g_object_unref ptr
+  Vips.vips_image_remove self, name
+  ::GObject.g_object_ref ptr
+end
+
+
+ +
+

+ + #respond_to?(name, include_all = false) ⇒ Boolean + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+
+
# File 'lib/vips/mutableimage.rb', line 71
+
+def respond_to? name, include_all = false
+  # To support keyword args, we need to tell Ruby that final image
+  # arguments cannot be hashes of keywords.
+  #
+  # https://makandracards.com/makandra/
+  #   36013-heads-up-ruby-implicitly-converts-a-hash-to-keyword-arguments
+  return false if name == :to_hash
+
+  super
+end
+
+
+ +
+

+ + #respond_to_missing?(name, include_all = false) ⇒ Boolean + + + + + +

+
+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + +
  • + +
+ +
+ + + + +
+
+
+
+82
+83
+84
+85
+86
+87
+
+
# File 'lib/vips/mutableimage.rb', line 82
+
+def respond_to_missing? name, include_all = false
+  # Respond to all vips operations by nickname.
+  return true if Vips.type_find("VipsOperation", name.to_s) != 0
+
+  super
+end
+
+
+ +
+

+ + #set!(name, value) ⇒ Object + + + + + +

+
+ +

Set the value of a metadata item on an image. The metadata item must already exist. Ruby types are automatically transformed into the matching GObject::GValue, if possible.

+ +

For example, you can use this to set an image's ICC profile:

+ +
x.set! "icc-profile-data", profile
+
+ +

where profile is an ICC profile held as a binary string object.

+ + +
+
+
+

Parameters:

+
    + +
  • + + name + + + (String) + + + + — +
    +

    Metadata field to set

    +
    + +
  • + +
  • + + value + + + (Object) + + + + — +
    +

    Value to set

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+152
+153
+154
+
+
# File 'lib/vips/mutableimage.rb', line 152
+
+def set! name, value
+  set_type! get_typeof(name), name, value
+end
+
+
+ +
+

+ + #set_type!(gtype, name, value) ⇒ Object + + + + + +

+
+ +

Create a metadata item on an image of the specifed type. Ruby types are automatically transformed into the matching glib type (eg. GObject::GINT_TYPE), if possible.

+ +

For example, you can use this to set an image's ICC profile:

+ +
x.set_type! Vips::BLOB_TYPE, "icc-profile-data", profile
+
+ +

where profile is an ICC profile held as a binary string object.

+ + +
+
+
+

Parameters:

+
    + +
  • + + gtype + + + (Integer) + + + + — +
    +

    GType of item

    +
    + +
  • + +
  • + + name + + + (String) + + + + — +
    +

    Metadata field to set

    +
    + +
  • + +
  • + + value + + + (Object) + + + + — +
    +

    Value to set

    +
    + +
  • + +
+ + +

See Also:

+ + +
+ + + + +
+
+
+
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+
+
# File 'lib/vips/mutableimage.rb', line 115
+
+def set_type! gtype, name, value
+  gvalue = GObject::GValue.alloc
+  gvalue.init gtype
+  gvalue.set value
+
+  # libvips 8.9.1 had a terrible misfeature which would block metadata
+  # modification unless the object had a ref_count of 1. MutableImage
+  # will always have a ref_count of at least 2 (the parent gobject keeps a
+  # ref, and we keep a ref to the copy ready to return to our caller),
+  # so we must temporarily drop the refs to 1 around metadata changes.
+  #
+  # See https://github.com/libvips/ruby-vips/issues/291
+  begin
+    ::GObject.g_object_unref ptr
+    Vips.vips_image_set self, name, gvalue
+  ensure
+    ::GObject.g_object_ref ptr
+  end
+
+  gvalue.unset
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/MutableImage/ManagedStruct.html b/Vips/MutableImage/ManagedStruct.html new file mode 100644 index 00000000..6d9e969c --- /dev/null +++ b/Vips/MutableImage/ManagedStruct.html @@ -0,0 +1,183 @@ + + + + + + + Class: Vips::MutableImage::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::MutableImage::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Object::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
MutableImageLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/mutableimage.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from MutableImageLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/MutableImage/MutableImageLayout.html b/Vips/MutableImage/MutableImageLayout.html new file mode 100644 index 00000000..9a2b1c17 --- /dev/null +++ b/Vips/MutableImage/MutableImageLayout.html @@ -0,0 +1,196 @@ + + + + + + + Module: Vips::MutableImage::MutableImageLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::MutableImage::MutableImageLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/mutableimage.rb
+
+ +
+ +

Overview

+
+ +

layout is exactly as Image (since we are also wrapping a VipsImage object)

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+23
+24
+25
+26
+27
+28
+
+
# File 'lib/vips/mutableimage.rb', line 23
+
+def self.included base
+  base.class_eval do
+    layout :parent, Vips::Object::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/MutableImage/Struct.html b/Vips/MutableImage/Struct.html new file mode 100644 index 00000000..d80faa86 --- /dev/null +++ b/Vips/MutableImage/Struct.html @@ -0,0 +1,178 @@ + + + + + + + Class: Vips::MutableImage::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::MutableImage::Struct + + + +

+
+ +
+
Inherits:
+
+ Object::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
MutableImageLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/mutableimage.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from MutableImageLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Object.html b/Vips/Object.html new file mode 100644 index 00000000..5886857d --- /dev/null +++ b/Vips/Object.html @@ -0,0 +1,754 @@ + + + + + + + Class: Vips::Object + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Object + + + +

+
+ +
+
Inherits:
+
+ GObject::GObject + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ +
+

Direct Known Subclasses

+

Connection, Image, Interpolate, MutableImage, Operation, Region

+
+

Defined Under Namespace

+

+ + + Modules: ObjectLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Class Method Summary + collapse +

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct, #initialize

+ + +
+

Constructor Details

+ +

This class inherits a constructor from GObject::GObject

+ +
+ + +
+

Class Method Details

+ + +
+
+
+ +

print all active VipsObjects, with their reference counts. Handy for debugging ruby-vips.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+168
+169
+170
+171
+
+
# File 'lib/vips/object.rb', line 168
+
+def self.print_all
+  GC.start
+  Vips.vips_object_print_all
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #get(name) ⇒ Object + + + + + +

+ + + + +
+
+
+
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+
+
# File 'lib/vips/object.rb', line 233
+
+def get name
+  gtype = get_typeof_error name
+  gvalue = GObject::GValue.alloc
+  gvalue.init gtype
+  GObject.g_object_get_property self, name, gvalue
+  result = gvalue.get
+  gvalue.unset
+
+  GLib.logger.debug("Vips::Object.get") { "#{name} == #{result}" }
+
+  result
+end
+
+
+ +
+

+ + #get_pspec(name) ⇒ Object + + + + + +

+
+ +

return a pspec, or nil … nil wil leave a message in the error log which you must clear

+ + +
+
+
+ + +
+ + + + +
+
+
+
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+
+
# File 'lib/vips/object.rb', line 202
+
+def get_pspec name
+  ppspec = GObject::GParamSpecPtr.new
+  argument_class = Vips::ArgumentClassPtr.new
+  argument_instance = Vips::ArgumentInstancePtr.new
+
+  result = Vips.vips_object_get_argument self, name,
+    ppspec, argument_class, argument_instance
+  return nil if result != 0
+
+  ppspec[:value]
+end
+
+
+ +
+

+ + #get_typeof(name) ⇒ Object + + + + + +

+
+ +

return a gtype, 0 on not found

+ + +
+
+
+ + +
+ + + + +
+
+
+
+223
+224
+225
+226
+227
+228
+229
+230
+231
+
+
# File 'lib/vips/object.rb', line 223
+
+def get_typeof name
+  pspec = get_pspec name
+  unless pspec
+    Vips.vips_error_clear
+    return 0
+  end
+
+  pspec[:value_type]
+end
+
+
+ +
+

+ + #get_typeof_error(name) ⇒ Object + + + + + +

+
+ +

return a gtype, raise an error on not found

+ + +
+
+
+ +

Raises:

+ + +
+ + + + +
+
+
+
+215
+216
+217
+218
+219
+220
+
+
# File 'lib/vips/object.rb', line 215
+
+def get_typeof_error name
+  pspec = get_pspec name
+  raise Vips::Error unless pspec
+
+  pspec[:value_type]
+end
+
+
+ +
+

+ + #set(name, value) ⇒ Object + + + + + +

+ + + + +
+
+
+
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+
+
# File 'lib/vips/object.rb', line 246
+
+def set name, value
+  GLib.logger.debug("Vips::Object.set") { "#{name} = #{value}" }
+
+  gtype = get_typeof_error name
+  gvalue = GObject::GValue.alloc
+  gvalue.init gtype
+  gvalue.set value
+  GObject.g_object_set_property self, name, gvalue
+  gvalue.unset
+end
+
+
+ +
+

+ + #signal_connect(name, handler = nil, &block) ⇒ Object + + + + + +

+
+ + +
+
+
+ +

Raises:

+ + +
+ + + + +
+
+
+
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+
+
# File 'lib/vips/object.rb', line 257
+
+def signal_connect name, handler = nil, &block
+  marshal = MARSHAL_ALL[name.to_sym]
+  raise Vips::Error, "unsupported signal #{name}" if marshal.nil?
+
+  if block
+    # our block as a Proc
+    prc = block
+  elsif handler
+    # We assume the hander is a Proc (perhaps we should test)
+    prc = handler
+  else
+    raise Vips::Error, "must supply either block or handler"
+  end
+
+  # The marshal function will make a closure with the right type signature
+  # for the selected signal
+  callback = marshal.call(prc)
+
+  # we need to make sure this is not GCd while self is alive
+  @references << callback
+
+  GObject.g_signal_connect_data(self, name.to_s, callback, nil, nil, 0)
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Object/ManagedStruct.html b/Vips/Object/ManagedStruct.html new file mode 100644 index 00000000..b50aae04 --- /dev/null +++ b/Vips/Object/ManagedStruct.html @@ -0,0 +1,168 @@ + + + + + + + Class: Vips::Object::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Object::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ GObject::GObject::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
ObjectLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Object/ObjectLayout.html b/Vips/Object/ObjectLayout.html new file mode 100644 index 00000000..b89979a5 --- /dev/null +++ b/Vips/Object/ObjectLayout.html @@ -0,0 +1,214 @@ + + + + + + + Module: Vips::Object::ObjectLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Object::ObjectLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ +

Overview

+
+ +

the layout of the VipsObject struct

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+
+
# File 'lib/vips/object.rb', line 175
+
+def self.included base
+  base.class_eval do
+    # don't actually need most of these
+    layout :parent, GObject::GObject::Struct,
+      :constructed, :int,
+      :static_object, :int,
+      :argument_table, :pointer,
+      :nickname, :string,
+      :description, :string,
+      :preclose, :int,
+      :close, :int,
+      :postclose, :int,
+      :local_memory, :size_t
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Object/Struct.html b/Vips/Object/Struct.html new file mode 100644 index 00000000..dcc031a2 --- /dev/null +++ b/Vips/Object/Struct.html @@ -0,0 +1,163 @@ + + + + + + + Class: Vips::Object::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Object::Struct + + + +

+
+ +
+
Inherits:
+
+ GObject::GObject::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
ObjectLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/ObjectClass.html b/Vips/ObjectClass.html new file mode 100644 index 00000000..de042d17 --- /dev/null +++ b/Vips/ObjectClass.html @@ -0,0 +1,124 @@ + + + + + + + Class: Vips::ObjectClass + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::ObjectClass + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Operation.html b/Vips/Operation.html new file mode 100644 index 00000000..6c6dd615 --- /dev/null +++ b/Vips/Operation.html @@ -0,0 +1,1106 @@ + + + + + + + Class: Vips::Operation + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Operation + + + +

+
+ +
+
Inherits:
+
+ Object + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operation.rb
+
+ +
+ +

Defined Under Namespace

+

+ + + Modules: OperationLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Class Method Summary + collapse +

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct

+ + +
+

Constructor Details

+ +
+

+ + #initialize(value) ⇒ Operation + + + + + +

+
+ +

Returns a new instance of Operation.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+
+
# File 'lib/vips/operation.rb', line 199
+
+def initialize value
+  # allow init with a pointer so we can wrap the return values from
+  # things like _build
+  if value.is_a? String
+    value = Vips.vips_operation_new value
+    raise Vips::Error if value.null?
+  end
+
+  super value
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + .call(name, supplied, optional = {}, option_string = "") ⇒ Object + + + + + +

+
+ +

This is the public entry point for the vips binding. call will run any vips operation, for example:

+ +
out = Vips::Operation.call "black", [100, 100], {:bands => 12}
+
+ +

will call the C function

+ +
vips_black( &out, 100, 100, "bands", 12, NULL );
+
+ +

There are Image#method_missing hooks which will run call for you on Image for undefined instance or class methods. So you can also write:

+ +
out = Vips::Image.black 100, 100, bands: 12
+
+ +

Or perhaps:

+ +
x = Vips::Image.black 100, 100
+y = x.invert
+
+ +

to run the vips_invert() operator.

+ +

There are also a set of operator overloads and some convenience functions, see Image.

+ +

If the operator needs a vector constant, call will turn a scalar into a vector for you. So for x.linear a, b, which calculates x * a + b where a and b are vector constants, you can write:

+ +
x = Vips::Image.black 100, 100, bands: 3
+y = x.linear 1, 2
+y = x.linear [1], 4
+y = x.linear [1, 2, 3], 4
+
+ +

or any other combination. The operator overloads use this facility to support all the variations on:

+ +
x = Vips::Image.black 100, 100, bands: 3
+y = x * 2
+y = x + [1,2,3]
+y = x % [1]
+
+ +

Similarly, wherever an image is required, you can use a constant. The constant will be expanded to an image matching the first input image argument. For example, you can write:

+ +
x = Vips::Image.black 100, 100, bands: 3
+y = x.bandjoin 255
+
+ +

to add an extra band to the image where each pixel in the new band has the constant value 255.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+
+
# File 'lib/vips/operation.rb', line 344
+
+def self.call name, supplied, optional = {}, option_string = ""
+  GLib.logger.debug("Vips::VipsOperation.call") {
+    "name = #{name}, supplied = #{supplied}, " \
+      "optional = #{optional}, option_string = #{option_string}"
+  }
+
+  introspect = Introspect.get name
+  required_input = introspect.required_input
+  required_output = introspect.required_output
+  optional_input = introspect.optional_input
+  optional_output = introspect.optional_output
+  destructive = introspect.destructive
+
+  unless supplied.is_a? Array
+    raise Vips::Error, "unable to call #{name}: " \
+      "argument array is not an array"
+  end
+  unless optional.is_a? Hash
+    raise Vips::Error, "unable to call #{name}: " \
+      "optional arguments are not a hash"
+  end
+
+  if supplied.length != required_input.length
+    raise Vips::Error, "unable to call #{name}: " \
+      "you supplied #{supplied.length} arguments, " \
+      "but operation needs #{required_input.length}."
+  end
+
+  # all supplied_optional keys should be in optional_input or
+  # optional_output
+  optional.each do |key, _value|
+    arg_name = key.to_s
+
+    unless optional_input.has_key?(arg_name) ||
+        optional_output.has_key?(arg_name)
+      raise Vips::Error, "unable to call #{name}: " \
+        "unknown option #{arg_name}"
+    end
+  end
+
+  # the first image arg is the thing we expand constants to match ...
+  # we need to find it
+  #
+  # look inside array and hash arguments, since we may be passing an
+  # array of images
+  #
+  # also enforce the rules around mutable and non-mutable images
+  match_image = nil
+  flat_find(supplied) do |value|
+    if match_image
+      # no non-first image arg can ever be mutable
+      if value.is_a?(MutableImage)
+        raise Vips::Error, "unable to call #{name}: " \
+          "only the first image argument can be mutable"
+      end
+    elsif destructive
+      if value.is_a?(Image)
+        raise Vips::Error, "unable to call #{name}: " \
+          "first image argument to a destructive " \
+          "operation must be mutable"
+      elsif value.is_a?(MutableImage)
+        match_image = value
+      end
+    elsif value.is_a?(MutableImage)
+      # non destructive operation, so no mutable images
+      raise Vips::Error, "unable to call #{name}: " \
+        "must not pass mutable images to " \
+        "non-destructive operations"
+    elsif value.is_a?(Image)
+      match_image = value
+    end
+
+    # keep looping
+    false
+  end
+
+  op = Operation.new introspect.vips_name
+
+  # set any string args first so they can't be overridden
+  unless option_string.nil?
+    if Vips.vips_object_set_from_string(op, option_string) != 0
+      raise Vips::Error
+    end
+  end
+
+  # collect a list of all input references here
+  references = Set.new
+
+  add_reference = lambda do |x|
+    if x.is_a?(Vips::Image)
+      x.references.each do |i|
+        references << i
+      end
+    end
+    false
+  end
+
+  # set all required inputs
+  required_input.each_index do |i|
+    details = required_input[i]
+    arg_name = details[:arg_name]
+    flags = details[:flags]
+    gtype = details[:gtype]
+    value = supplied[i]
+
+    flat_find value, &add_reference
+    op.set arg_name, value, match_image, flags, gtype, destructive
+  end
+
+  # set all optional inputs
+  optional.each do |key, value|
+    next if value.nil?
+
+    arg_name = key.to_s
+
+    if optional_input.has_key? arg_name
+      details = optional_input[arg_name]
+      flags = details[:flags]
+      gtype = details[:gtype]
+
+      flat_find value, &add_reference
+      op.set arg_name, value, match_image, flags, gtype, destructive
+    end
+  end
+
+  op = op.build
+
+  # attach all input refs to output x
+  set_reference = lambda do |x|
+    if x.is_a? Vips::Image
+      x.references += references
+    end
+    false
+  end
+
+  # get all required results
+  result = []
+  required_output.each do |details|
+    value = details[:arg_name]
+    flat_find value, &set_reference
+    result << op.get(value)
+  end
+
+  # fetch all optional ones
+  optional_results = {}
+  optional.each do |key, _value|
+    arg_name = key.to_s
+
+    if optional_output.has_key? arg_name
+      value = op.get arg_name
+      flat_find value, &set_reference
+      optional_results[arg_name] = value
+    end
+  end
+
+  result << optional_results if optional_results != {}
+
+  if result.length == 1
+    result = result.first
+  elsif result.length == 0
+    result = nil
+  end
+
+  GLib.logger.debug("Vips::Operation.call") { "result = #{result}" }
+
+  Vips.vips_object_unref_outputs op
+
+  result
+end
+
+
+ +
+

+ + .flat_find(object, &block) ⇒ Object + + + + + +

+
+ +

Search an object for the first element to match a predicate. Search inside subarrays and sub-hashes. Equlvalent to x.flatten.find{}.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+
+
# File 'lib/vips/operation.rb', line 229
+
+def self.flat_find object, &block
+  if object.respond_to? :each
+    object.each do |x|
+      result = flat_find x, &block
+      return result unless result.nil?
+    end
+  elsif yield object
+    return object
+  end
+
+  nil
+end
+
+
+ +
+

+ + .imageize(match_image, value) ⇒ Object + + + + + +

+
+ +

expand a constant into an image

+ + +
+
+
+ + +
+ + + + +
+
+
+
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+
+
# File 'lib/vips/operation.rb', line 243
+
+def self.imageize match_image, value
+  return value if value.is_a?(Image) || value.is_a?(MutableImage)
+
+  # 2D array values become tiny 2D images
+  # if there's nothing to match to, we also make a 2D image
+  if (value.is_a?(Array) && value[0].is_a?(Array)) || match_image.nil?
+    Image.new_from_array value
+  else
+    # we have a 1D array ... use that as a pixel constant and
+    # expand to match match_image
+    match_image.new_from_image value
+  end
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + #argument_map(&block) ⇒ Object + + + + + +

+ + + + +
+
+
+
+220
+221
+222
+223
+224
+225
+
+
# File 'lib/vips/operation.rb', line 220
+
+def argument_map &block
+  fn = proc do |_op, pspec, argument_class, argument_instance, _a, _b|
+    block.call pspec, argument_class, argument_instance
+  end
+  Vips.vips_argument_map self, fn, nil, nil
+end
+
+
+ +
+

+ + #buildObject + + + + + +

+ + + + +
+
+
+
+210
+211
+212
+213
+214
+215
+216
+217
+218
+
+
# File 'lib/vips/operation.rb', line 210
+
+def build
+  op = Vips.vips_cache_operation_build self
+  if op.null?
+    Vips.vips_object_unref_outputs self
+    raise Vips::Error
+  end
+
+  Operation.new op
+end
+
+
+ +
+

+ + #set(name, value, match_image, flags, gtype, destructive) ⇒ Object + + + + + +

+
+ +

set an operation argument, expanding constants and copying images as required

+ + +
+
+
+ + +
+ + + + +
+
+
+
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+
+
# File 'lib/vips/operation.rb', line 259
+
+def set name, value, match_image, flags, gtype, destructive
+  if gtype == IMAGE_TYPE
+    value = Operation.imageize match_image, value
+
+    # in non-destructive mode, make sure we have a unique copy
+    if (flags & ARGUMENT_MODIFY) != 0 &&
+        !destructive
+      value = value.copy.copy_memory
+    end
+  elsif gtype == ARRAY_IMAGE_TYPE
+    value = value.map { |x| Operation.imageize match_image, x }
+  end
+
+  super name, value
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Operation/ManagedStruct.html b/Vips/Operation/ManagedStruct.html new file mode 100644 index 00000000..c15dcc1a --- /dev/null +++ b/Vips/Operation/ManagedStruct.html @@ -0,0 +1,183 @@ + + + + + + + Class: Vips::Operation::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Operation::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Vips::Object::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
OperationLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/operation.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from OperationLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Vips::Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Operation/OperationLayout.html b/Vips/Operation/OperationLayout.html new file mode 100644 index 00000000..98043160 --- /dev/null +++ b/Vips/Operation/OperationLayout.html @@ -0,0 +1,196 @@ + + + + + + + Module: Vips::Operation::OperationLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Operation::OperationLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/operation.rb
+
+ +
+ +

Overview

+
+ +

the layout of the VipsOperation struct

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+183
+184
+185
+186
+187
+188
+
+
# File 'lib/vips/operation.rb', line 183
+
+def self.included base
+  base.class_eval do
+    layout :parent, Object::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Operation/Struct.html b/Vips/Operation/Struct.html new file mode 100644 index 00000000..dbf850ce --- /dev/null +++ b/Vips/Operation/Struct.html @@ -0,0 +1,178 @@ + + + + + + + Class: Vips::Operation::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Operation::Struct + + + +

+
+ +
+
Inherits:
+
+ Vips::Object::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
OperationLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/operation.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from OperationLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Vips::Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/OperationBoolean.html b/Vips/OperationBoolean.html new file mode 100644 index 00000000..fa50c739 --- /dev/null +++ b/Vips/OperationBoolean.html @@ -0,0 +1,146 @@ + + + + + + + Class: Vips::OperationBoolean + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::OperationBoolean + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operationboolean.rb
+
+ +
+ +

Overview

+
+ +

The type of boolean operation to perform on an image. See Image#boolean.

+
  • +

    ':and' bitwise and

    +
  • +

    ':or' bitwise or

    +
  • +

    ':eor' bitwise eor

    +
  • +

    ':lshift' shift left n bits

    +
  • +

    ':rshift' shift right n bits

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/OperationComplex.html b/Vips/OperationComplex.html new file mode 100644 index 00000000..70527ba0 --- /dev/null +++ b/Vips/OperationComplex.html @@ -0,0 +1,142 @@ + + + + + + + Class: Vips::OperationComplex + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::OperationComplex + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operationcomplex.rb
+
+ +
+ +

Overview

+
+ +

The type of complex operation to perform on an image. See Image#complex.

+
  • +

    ':polar' to polar coordinates

    +
  • +

    ':rect' to rectangular coordinates

    +
  • +

    ':conj' complex conjugate

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/OperationComplex2.html b/Vips/OperationComplex2.html new file mode 100644 index 00000000..035f53a9 --- /dev/null +++ b/Vips/OperationComplex2.html @@ -0,0 +1,138 @@ + + + + + + + Class: Vips::OperationComplex2 + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::OperationComplex2 + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operationcomplex2.rb
+
+ +
+ +

Overview

+
+ +

The type of binary complex operation to perform on an image. See Image#complex2.

+
  • +

    ':cross_phase' cross phase

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/OperationComplexget.html b/Vips/OperationComplexget.html new file mode 100644 index 00000000..bc2d5175 --- /dev/null +++ b/Vips/OperationComplexget.html @@ -0,0 +1,140 @@ + + + + + + + Class: Vips::OperationComplexget + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::OperationComplexget + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operationcomplexget.rb
+
+ +
+ +

Overview

+
+ +

The type of complex projection operation to perform on an image. See Image#complexget.

+
  • +

    ':real' get real part

    +
  • +

    ':imag' get imaginary part

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/OperationMath.html b/Vips/OperationMath.html new file mode 100644 index 00000000..45c93b7b --- /dev/null +++ b/Vips/OperationMath.html @@ -0,0 +1,156 @@ + + + + + + + Class: Vips::OperationMath + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::OperationMath + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operationmath.rb
+
+ +
+ +

Overview

+
+ +

The math operation to perform on an image. See Image#math.

+
  • +

    ':sin' sin(), angles in degrees

    +
  • +

    ':cos' cos(), angles in degrees

    +
  • +

    ':tan' tan(), angles in degrees

    +
  • +

    ':asin' asin(), angles in degrees

    +
  • +

    ':acos' acos(), angles in degrees

    +
  • +

    ':atan' atan(), angles in degrees

    +
  • +

    ':log' log base e

    +
  • +

    ':log10' log base 10

    +
  • +

    ':exp' e to the something

    +
  • +

    ':exp10' 10 to the something

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/OperationMath2.html b/Vips/OperationMath2.html new file mode 100644 index 00000000..e08c5954 --- /dev/null +++ b/Vips/OperationMath2.html @@ -0,0 +1,140 @@ + + + + + + + Class: Vips::OperationMath2 + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::OperationMath2 + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operationmath2.rb
+
+ +
+ +

Overview

+
+ +

The binary math operation to perform on an image. See Image#math2.

+
  • +

    ':pow' pow()

    +
  • +

    ':wop' pow(), but with the arguments reversed

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/OperationRelational.html b/Vips/OperationRelational.html new file mode 100644 index 00000000..1aae981a --- /dev/null +++ b/Vips/OperationRelational.html @@ -0,0 +1,148 @@ + + + + + + + Class: Vips::OperationRelational + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::OperationRelational + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operationrelational.rb
+
+ +
+ +

Overview

+
+ +

The type of relational operation to perform on an image. See Image#relational.

+
  • +

    ':more' more than

    +
  • +

    ':less' less than

    +
  • +

    ':moreeq' more than or equal to

    +
  • +

    ':lesseq' less than or equal to

    +
  • +

    ':equal' equal to

    +
  • +

    ':noteq' not equal to

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/OperationRound.html b/Vips/OperationRound.html new file mode 100644 index 00000000..0c256fb9 --- /dev/null +++ b/Vips/OperationRound.html @@ -0,0 +1,142 @@ + + + + + + + Class: Vips::OperationRound + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::OperationRound + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/operationround.rb
+
+ +
+ +

Overview

+
+ +

The type of rounding to perform on an image. See Image#round.

+
  • +

    ':ceil' round up

    +
  • +

    ':floor' round down

    +
  • +

    ':rint' round to nearest integer

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Progress.html b/Vips/Progress.html new file mode 100644 index 00000000..57d20a19 --- /dev/null +++ b/Vips/Progress.html @@ -0,0 +1,124 @@ + + + + + + + Class: Vips::Progress + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Progress + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Region.html b/Vips/Region.html new file mode 100644 index 00000000..4e8a75e1 --- /dev/null +++ b/Vips/Region.html @@ -0,0 +1,484 @@ + + + + + + + Class: Vips::Region + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Region + + + +

+
+ +
+
Inherits:
+
+ Object + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/region.rb
+
+ +
+ +

Overview

+
+ +

A region on an image. Create one, then use fetch to quickly get a region of pixels.

+ +

For example:

+ +

ruby region = Vips::Region.new(image) pixels = region.fetch(10, 10, 100, 100)

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: RegionLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct

+ + +
+

Constructor Details

+ +
+

+ + #initialize(name) ⇒ Region + + + + + +

+
+ +

Returns a new instance of Region.

+ + +
+
+
+ +

Raises:

+ + +
+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/vips/region.rb', line 46
+
+def initialize(name)
+  ptr = Vips.vips_region_new name
+  raise Vips::Error if ptr.null?
+
+  super ptr
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #fetch(left, top, width, height) ⇒ Object + + + + + +

+
+ +

Fetch a region filled with pixel data.

+ + +
+
+
+ +

Raises:

+ + +
+ + + + +
+
+
+
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+
+
# File 'lib/vips/region.rb', line 62
+
+def fetch(left, top, width, height)
+  len = Vips::SizeStruct.new
+  ptr = Vips.vips_region_fetch self, left, top, width, height, len
+  raise Vips::Error if ptr.null?
+
+  # wrap up as an autopointer
+  ptr = FFI::AutoPointer.new(ptr, GLib::G_FREE)
+
+  ptr.get_bytes 0, len[:value]
+end
+
+
+ +
+

+ + #heightObject + + + + + +

+ + + + +
+
+
+
+57
+58
+59
+
+
# File 'lib/vips/region.rb', line 57
+
+def height
+  Vips.vips_region_height self
+end
+
+
+ +
+

+ + #widthObject + + + + + +

+ + + + +
+
+
+
+53
+54
+55
+
+
# File 'lib/vips/region.rb', line 53
+
+def width
+  Vips.vips_region_width self
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Region/ManagedStruct.html b/Vips/Region/ManagedStruct.html new file mode 100644 index 00000000..8cf0730a --- /dev/null +++ b/Vips/Region/ManagedStruct.html @@ -0,0 +1,183 @@ + + + + + + + Class: Vips::Region::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Region::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Object::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
RegionLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/region.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from RegionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Region/RegionLayout.html b/Vips/Region/RegionLayout.html new file mode 100644 index 00000000..1cf52a96 --- /dev/null +++ b/Vips/Region/RegionLayout.html @@ -0,0 +1,196 @@ + + + + + + + Module: Vips::Region::RegionLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Region::RegionLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/region.rb
+
+ +
+ +

Overview

+
+ +

The layout of the VipsRegion struct.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+
+
# File 'lib/vips/region.rb', line 30
+
+def self.included(base)
+  base.class_eval do
+    layout :parent, Vips::Object::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Region/Struct.html b/Vips/Region/Struct.html new file mode 100644 index 00000000..9b305541 --- /dev/null +++ b/Vips/Region/Struct.html @@ -0,0 +1,178 @@ + + + + + + + Class: Vips::Region::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Region::Struct + + + +

+
+ +
+
Inherits:
+
+ Object::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
RegionLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/region.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from RegionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Size.html b/Vips/Size.html new file mode 100644 index 00000000..d6019ce9 --- /dev/null +++ b/Vips/Size.html @@ -0,0 +1,144 @@ + + + + + + + Class: Vips::Size + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Size + + + +

+
+ +
+
Inherits:
+
+ Symbol + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/size.rb
+
+ +
+ +

Overview

+
+ +

Controls whether an operation should upsize, downsize, or both up and downsize.

+
  • +

    :both size both up and down

    +
  • +

    :up only upsize

    +
  • +

    :down only downsize

    +
  • +

    :force change aspect ratio

    +
+ + +
+
+
+ + +
+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/SizeStruct.html b/Vips/SizeStruct.html new file mode 100644 index 00000000..a863eed9 --- /dev/null +++ b/Vips/SizeStruct.html @@ -0,0 +1,124 @@ + + + + + + + Class: Vips::SizeStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::SizeStruct + + + +

+
+ +
+
Inherits:
+
+ FFI::Struct + +
    +
  • Object
  • + + + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/object.rb
+
+ +
+ + + + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Source.html b/Vips/Source.html new file mode 100644 index 00000000..15120bf5 --- /dev/null +++ b/Vips/Source.html @@ -0,0 +1,601 @@ + + + + + + + Class: Vips::Source + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Source + + + +

+
+ +
+
Inherits:
+
+ Connection + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/source.rb
+
+ +
+ +

Overview

+
+ +

A source. For example:

+ +
source = Vips::Source.new_from_file("k2.jpg")
+image = Vips::Image.new_from_source(source)
+
+ + +
+
+
+ + +
+

Direct Known Subclasses

+

SourceCustom

+
+

Defined Under Namespace

+

+ + + Modules: SourceLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Class Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Connection

+

#filename, #nick

+ + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct, #initialize

+ + +
+

Constructor Details

+ +

This class inherits a constructor from GObject::GObject

+ +
+ + +
+

Class Method Details

+ + +
+

+ + .new_from_descriptor(descriptor) ⇒ Source + + + + + +

+
+ +

Create a new source from a file descriptor. File descriptors are small integers, for example 0 is stdin.

+ +

Pass sources to Image.new_from_source to load images from them.

+ + +
+
+
+

Parameters:

+
    + +
  • + + descriptor + + + (Integer) + + + + — +
    +

    the file descriptor

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Source) + + + + — +
    +

    the new Vips::Source

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+48
+49
+50
+51
+52
+53
+
+
# File 'lib/vips/source.rb', line 48
+
+def self.new_from_descriptor(descriptor)
+  ptr = Vips.vips_source_new_from_descriptor descriptor
+  raise Vips::Error if ptr.null?
+
+  Vips::Source.new ptr
+end
+
+
+ +
+

+ + .new_from_file(filename) ⇒ Source + + + + + +

+
+ +

Create a new source from a file name.

+ +

Pass sources to Image.new_from_source to load images from them.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    the name of the file

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Source) + + + + — +
    +

    the new Vips::Source

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+62
+63
+64
+65
+66
+67
+68
+
+
# File 'lib/vips/source.rb', line 62
+
+def self.new_from_file(filename)
+  raise Vips::Error, "filename is nil" if filename.nil?
+  ptr = Vips.vips_source_new_from_file filename
+  raise Vips::Error if ptr.null?
+
+  Vips::Source.new ptr
+end
+
+
+ +
+

+ + .new_from_memory(data) ⇒ Source + + + + + +

+
+ +

Create a new source from an area of memory. Memory areas can be strings, arrays and so forth – anything that supports bytesize.

+ +

Pass sources to Image.new_from_source to load images from them.

+ + +
+
+
+

Parameters:

+
    + +
  • + + data + + + (String) + + + + — +
    +

    memory area

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Source) + + + + — +
    +

    the new Vips::Source

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+78
+79
+80
+81
+82
+83
+84
+85
+86
+
+
# File 'lib/vips/source.rb', line 78
+
+def self.new_from_memory(data)
+  ptr = Vips.vips_source_new_from_memory data, data.bytesize
+  raise Vips::Error if ptr.null?
+
+  # FIXME do we need to keep a ref to the underlying memory area? what
+  # about Image.new_from_buffer? Does that need a secret ref too?
+
+  Vips::Source.new ptr
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Source/ManagedStruct.html b/Vips/Source/ManagedStruct.html new file mode 100644 index 00000000..38f6d79f --- /dev/null +++ b/Vips/Source/ManagedStruct.html @@ -0,0 +1,206 @@ + + + + + + + Class: Vips::Source::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Source::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Connection::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
SourceLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/source.rb
+
+ +
+ +
+

Direct Known Subclasses

+

Vips::SourceCustom::ManagedStruct

+
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from SourceLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Connection::ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Source/SourceLayout.html b/Vips/Source/SourceLayout.html new file mode 100644 index 00000000..cc1ead2d --- /dev/null +++ b/Vips/Source/SourceLayout.html @@ -0,0 +1,185 @@ + + + + + + + Module: Vips::Source::SourceLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Source::SourceLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/source.rb
+
+ +
+ + + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+24
+25
+26
+27
+28
+29
+
+
# File 'lib/vips/source.rb', line 24
+
+def self.included(base)
+  base.class_eval do
+    layout :parent, Vips::Connection::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Source/Struct.html b/Vips/Source/Struct.html new file mode 100644 index 00000000..b90ff0fa --- /dev/null +++ b/Vips/Source/Struct.html @@ -0,0 +1,201 @@ + + + + + + + Class: Vips::Source::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Source::Struct + + + +

+
+ +
+
Inherits:
+
+ Connection::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
SourceLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/source.rb
+
+ +
+ +
+

Direct Known Subclasses

+

Vips::SourceCustom::Struct

+
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from SourceLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Connection::ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/SourceCustom.html b/Vips/SourceCustom.html new file mode 100644 index 00000000..9936f4f7 --- /dev/null +++ b/Vips/SourceCustom.html @@ -0,0 +1,564 @@ + + + + + + + Class: Vips::SourceCustom + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::SourceCustom + + + +

+
+ +
+
Inherits:
+
+ Source + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/sourcecustom.rb
+
+ +
+ +

Overview

+
+ +

A source you can attach action signal handlers to to implement custom input types.

+ +

For example:

+ +
file = File.open "some/file/name", "rb"
+source = Vips::SourceCustom.new
+source.on_read { |length| file.read length }
+image = Vips::Image.new_from_source source
+
+ +

(just an example – of course in practice you'd use Vips::Source.new_from_file to read from a named file)

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: SourceCustomLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Source

+

new_from_descriptor, new_from_file, new_from_memory

+ + + + + + + + + +

Methods inherited from Connection

+

#filename, #nick

+ + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct

+ + +
+

Constructor Details

+ +
+

+ + #initializeSourceCustom + + + + + +

+
+ +

Returns a new instance of SourceCustom.

+ + +
+
+
+ +

Raises:

+ + +
+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/vips/sourcecustom.rb', line 46
+
+def initialize
+  pointer = Vips.vips_source_custom_new
+  raise Vips::Error if pointer.null?
+
+  super pointer
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #on_read {|length| ... } ⇒ Object + + + + + +

+
+ +

The block is executed to read data from the source. The interface is exactly as IO::read, ie. it takes a maximum number of bytes to read and returns a string of bytes from the source, or nil if the source is already at end of file.

+ + +
+
+
+ +

Yield Parameters:

+
    + +
  • + + length + + + (Integer) + + + + — +
    +

    Read and return up to this many bytes

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (String) + + + + — +
    +

    Up to length bytes of data, or nil for EOF

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+
+
# File 'lib/vips/sourcecustom.rb', line 60
+
+def on_read &block
+  signal_connect "read" do |buf, len|
+    chunk = block.call len
+    return 0 if chunk.nil?
+    bytes_read = chunk.bytesize
+    buf.put_bytes(0, chunk, 0, bytes_read)
+    chunk.clear
+
+    bytes_read
+  end
+end
+
+
+ +
+

+ + #on_seek {|offset, whence| ... } ⇒ Object + + + + + +

+
+ +

The block is executed to seek the source. The interface is exactly as IO::seek, ie. it should take an offset and whence, and return the new read position.

+ +

This handler is optional – if you do not attach a seek handler, Vips::Source will treat your source like an unseekable pipe object and do extra caching.

+ + +
+
+
+ +

Yield Parameters:

+
    + +
  • + + offset + + + (Integer) + + + + — +
    +

    Seek offset

    +
    + +
  • + +
  • + + whence + + + (Integer) + + + + — +
    +

    Seek whence

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    the new read position, or -1 on error

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+83
+84
+85
+86
+87
+
+
# File 'lib/vips/sourcecustom.rb', line 83
+
+def on_seek &block
+  signal_connect "seek" do |offset, whence|
+    block.call offset, whence
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/SourceCustom/ManagedStruct.html b/Vips/SourceCustom/ManagedStruct.html new file mode 100644 index 00000000..e4806ec6 --- /dev/null +++ b/Vips/SourceCustom/ManagedStruct.html @@ -0,0 +1,221 @@ + + + + + + + Class: Vips::SourceCustom::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::SourceCustom::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Vips::Source::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
SourceCustomLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/sourcecustom.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from SourceCustomLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Vips::Source::SourceLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Connection::ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/SourceCustom/SourceCustomLayout.html b/Vips/SourceCustom/SourceCustomLayout.html new file mode 100644 index 00000000..8dfc7e53 --- /dev/null +++ b/Vips/SourceCustom/SourceCustomLayout.html @@ -0,0 +1,185 @@ + + + + + + + Module: Vips::SourceCustom::SourceCustomLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::SourceCustom::SourceCustomLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/sourcecustom.rb
+
+ +
+ + + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+
+
# File 'lib/vips/sourcecustom.rb', line 30
+
+def self.included(base)
+  base.class_eval do
+    layout :parent, Vips::Source::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/SourceCustom/Struct.html b/Vips/SourceCustom/Struct.html new file mode 100644 index 00000000..4275fbd3 --- /dev/null +++ b/Vips/SourceCustom/Struct.html @@ -0,0 +1,216 @@ + + + + + + + Class: Vips::SourceCustom::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::SourceCustom::Struct + + + +

+
+ +
+
Inherits:
+
+ Vips::Source::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
SourceCustomLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/sourcecustom.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from SourceCustomLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Vips::Source::SourceLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Connection::ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Target.html b/Vips/Target.html new file mode 100644 index 00000000..69cca42b --- /dev/null +++ b/Vips/Target.html @@ -0,0 +1,562 @@ + + + + + + + Class: Vips::Target + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Target + + + +

+
+ +
+
Inherits:
+
+ Connection + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/target.rb
+
+ +
+ +

Overview

+
+ +

A target. For example:

+ +
target = Vips::Target.new_to_file('k2.jpg')
+image.write_to_target(target, '.jpg')
+
+ + +
+
+
+ + +
+

Direct Known Subclasses

+

TargetCustom

+
+

Defined Under Namespace

+

+ + + Modules: TargetLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Class Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Connection

+

#filename, #nick

+ + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct, #initialize

+ + +
+

Constructor Details

+ +

This class inherits a constructor from GObject::GObject

+ +
+ + +
+

Class Method Details

+ + +
+

+ + .new_to_descriptor(descriptor) ⇒ Target + + + + + +

+
+ +

Create a new target to a file descriptor. File descriptors are small integers, for example 1 is stdout.

+ +

Pass targets to Image#write_to_target to write images to them.

+ + +
+
+
+

Parameters:

+
    + +
  • + + descriptor + + + (Integer) + + + + — +
    +

    the file descriptor

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Target) + + + + — +
    +

    the new Vips::Target

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+49
+50
+51
+52
+53
+54
+
+
# File 'lib/vips/target.rb', line 49
+
+def self.new_to_descriptor(descriptor)
+  ptr = Vips.vips_target_new_to_descriptor descriptor
+  raise Vips::Error if ptr.null?
+
+  Vips::Target.new ptr
+end
+
+
+ +
+

+ + .new_to_file(filename) ⇒ Target + + + + + +

+
+ +

Create a new target to a file name.

+ +

Pass targets to Image#write_to_target to write images to them.

+ + +
+
+
+

Parameters:

+
    + +
  • + + filename + + + (String) + + + + — +
    +

    the name of the file

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Target) + + + + — +
    +

    the new Vips::Target

    +
    + +
  • + +
+

Raises:

+ + +
+ + + + +
+
+
+
+63
+64
+65
+66
+67
+68
+69
+
+
# File 'lib/vips/target.rb', line 63
+
+def self.new_to_file(filename)
+  raise Vips::Error, "filename is nil" if filename.nil?
+  ptr = Vips.vips_target_new_to_file filename
+  raise Vips::Error if ptr.null?
+
+  Vips::Target.new ptr
+end
+
+
+ +
+

+ + .new_to_memoryTarget + + + + + +

+
+ +

Create a new target to an area of memory.

+ +

Pass targets to Image#write_to_target to write images to them.

+ +

Once the image has been written, use Object#get("blob") to read out the data.

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Target) + + + + — +
    +

    the new Vips::Target

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+80
+81
+82
+83
+84
+
+
# File 'lib/vips/target.rb', line 80
+
+def self.new_to_memory
+  ptr = Vips.vips_target_new_to_memory
+
+  Vips::Target.new ptr
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Target/ManagedStruct.html b/Vips/Target/ManagedStruct.html new file mode 100644 index 00000000..9d3b0fa1 --- /dev/null +++ b/Vips/Target/ManagedStruct.html @@ -0,0 +1,206 @@ + + + + + + + Class: Vips::Target::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Target::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Connection::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
TargetLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/target.rb
+
+ +
+ +
+

Direct Known Subclasses

+

Vips::TargetCustom::ManagedStruct

+
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from TargetLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Connection::ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Target/Struct.html b/Vips/Target/Struct.html new file mode 100644 index 00000000..df9cc275 --- /dev/null +++ b/Vips/Target/Struct.html @@ -0,0 +1,201 @@ + + + + + + + Class: Vips::Target::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::Target::Struct + + + +

+
+ +
+
Inherits:
+
+ Connection::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
TargetLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/target.rb
+
+ +
+ +
+

Direct Known Subclasses

+

Vips::TargetCustom::Struct

+
+ + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from TargetLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Connection::ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Target/TargetLayout.html b/Vips/Target/TargetLayout.html new file mode 100644 index 00000000..493237dc --- /dev/null +++ b/Vips/Target/TargetLayout.html @@ -0,0 +1,196 @@ + + + + + + + Module: Vips::Target::TargetLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Target::TargetLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/target.rb
+
+ +
+ +

Overview

+
+ +

The layout of the VipsRegion struct.

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+25
+26
+27
+28
+29
+30
+
+
# File 'lib/vips/target.rb', line 25
+
+def self.included(base)
+  base.class_eval do
+    layout :parent, Vips::Connection::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/TargetCustom.html b/Vips/TargetCustom.html new file mode 100644 index 00000000..2654c50c --- /dev/null +++ b/Vips/TargetCustom.html @@ -0,0 +1,504 @@ + + + + + + + Class: Vips::TargetCustom + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::TargetCustom + + + +

+
+ +
+
Inherits:
+
+ Target + + + show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/targetcustom.rb
+
+ +
+ +

Overview

+
+ +

A target you can attach action signal handlers to to implememt custom output types.

+ +

For example:

+ +
file = File.open "some/file/name", "wb"
+target = Vips::TargetCustom.new
+target.on_write { |bytes| file.write bytes }
+image.write_to_target target, ".png"
+
+ +

(just an example – of course in practice you'd use Vips::Target.new_to_file to write to a named file)

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + Modules: TargetCustomLayout + + + + Classes: ManagedStruct, Struct + + +

+ + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from GObject::GObject

+

#ptr, #references

+ + + +

+ Instance Method Summary + collapse +

+ + + + + + + + + + + + + +

Methods inherited from Target

+

new_to_descriptor, new_to_file, new_to_memory

+ + + + + + + + + +

Methods inherited from Connection

+

#filename, #nick

+ + + + + + + + + +

Methods inherited from Object

+

#get, #get_pspec, #get_typeof, #get_typeof_error, print_all, #set, #signal_connect

+ + + + + + + + + +

Methods inherited from GObject::GObject

+

#ffi_managed_struct, ffi_managed_struct, #ffi_struct, ffi_struct

+ + +
+

Constructor Details

+ +
+

+ + #initializeTargetCustom + + + + + +

+
+ +

Returns a new instance of TargetCustom.

+ + +
+
+
+ +

Raises:

+ + +
+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+
+
# File 'lib/vips/targetcustom.rb', line 46
+
+def initialize
+  pointer = Vips.vips_target_custom_new
+  raise Vips::Error if pointer.null?
+
+  super pointer
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #on_finish(&block) ⇒ Object + + + + + +

+
+ +

The block is executed at the end of write. It should do any necessary finishing action, such as closing a file.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+71
+72
+73
+74
+75
+
+
# File 'lib/vips/targetcustom.rb', line 71
+
+def on_finish &block
+  signal_connect "finish" do
+    block.call
+  end
+end
+
+
+ +
+

+ + #on_write {|bytes| ... } ⇒ Object + + + + + +

+
+ +

The block is executed to write data to the source. The interface is exactly as IO::write, ie. it should write the string and return the number of bytes written.

+ + +
+
+
+ +

Yield Parameters:

+
    + +
  • + + bytes + + + (String) + + + + — +
    +

    Write these bytes to the file

    +
    + +
  • + +
+

Yield Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    The number of bytes written, or -1 on error

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+59
+60
+61
+62
+63
+64
+65
+66
+67
+
+
# File 'lib/vips/targetcustom.rb', line 59
+
+def on_write &block
+  signal_connect "write" do |p, len|
+    chunk = p.get_bytes(0, len)
+    bytes_written = block.call chunk
+    chunk.clear
+
+    bytes_written
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/TargetCustom/ManagedStruct.html b/Vips/TargetCustom/ManagedStruct.html new file mode 100644 index 00000000..cbe752a4 --- /dev/null +++ b/Vips/TargetCustom/ManagedStruct.html @@ -0,0 +1,221 @@ + + + + + + + Class: Vips::TargetCustom::ManagedStruct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::TargetCustom::ManagedStruct + + + +

+
+ +
+
Inherits:
+
+ Vips::Target::ManagedStruct + + + show all + +
+
+ + + + + + +
+
Includes:
+
TargetCustomLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/targetcustom.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from TargetCustomLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Vips::Target::TargetLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Connection::ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + +

Methods inherited from GObject::GObject::ManagedStruct

+

release

+ + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/TargetCustom/Struct.html b/Vips/TargetCustom/Struct.html new file mode 100644 index 00000000..998f946f --- /dev/null +++ b/Vips/TargetCustom/Struct.html @@ -0,0 +1,216 @@ + + + + + + + Class: Vips::TargetCustom::Struct + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Vips::TargetCustom::Struct + + + +

+
+ +
+
Inherits:
+
+ Vips::Target::Struct + + + show all + +
+
+ + + + + + +
+
Includes:
+
TargetCustomLayout
+
+ + + + + + +
+
Defined in:
+
lib/vips/targetcustom.rb
+
+ +
+ + + + + + + + + + + + + + + +

Method Summary

+ +

Methods included from TargetCustomLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Vips::Target::TargetLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Connection::ConnectionLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from Object::ObjectLayout

+

included

+ + + + + + + + + + + + + + + +

Methods included from GObject::GObject::GObjectLayout

+

included

+ + + +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/TargetCustom/TargetCustomLayout.html b/Vips/TargetCustom/TargetCustomLayout.html new file mode 100644 index 00000000..dddb518e --- /dev/null +++ b/Vips/TargetCustom/TargetCustomLayout.html @@ -0,0 +1,185 @@ + + + + + + + Module: Vips::TargetCustom::TargetCustomLayout + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::TargetCustom::TargetCustomLayout + + + +

+
+ + + + + + + + + +
+
Included in:
+
ManagedStruct, Struct
+
+ + + +
+
Defined in:
+
lib/vips/targetcustom.rb
+
+ +
+ + + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .included(base) ⇒ Object + + + + + +

+ + + + +
+
+
+
+30
+31
+32
+33
+34
+35
+
+
# File 'lib/vips/targetcustom.rb', line 30
+
+def self.included(base)
+  base.class_eval do
+    layout :parent, Vips::Target::Struct
+    # rest opaque
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/Vips/Yard.html b/Vips/Yard.html new file mode 100644 index 00000000..68b70e30 --- /dev/null +++ b/Vips/Yard.html @@ -0,0 +1,603 @@ + + + + + + + Module: Vips::Yard + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Vips::Yard + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/vips/image.rb
+
+ +
+ +

Overview

+
+ +

This module generates yard comments for all the dynamically bound vips operations.

+ +

Regenerate with something like:

+ +
$ ruby > methods.rb
+require "vips"; Vips::Yard.generate
+^D
+
+ + +
+
+
+ + +
+ +

+ Constant Summary + collapse +

+ +
+ +
MAP_GO_TO_RUBY = +
+
+ +

map gobject's type names to Ruby

+ + +
+
+
+ + +
+
+
{
+  "gboolean" => "Boolean",
+  "gint" => "Integer",
+  "gdouble" => "Float",
+  "gfloat" => "Float",
+  "gchararray" => "String",
+  "VipsImage" => "Vips::Image",
+  "VipsInterpolate" => "Vips::Interpolate",
+  "VipsConnection" => "Vips::Connection",
+  "VipsSource" => "Vips::Source",
+  "VipsTarget" => "Vips::Target",
+  "VipsSourceCustom" => "Vips::SourceCustom",
+  "VipsTargetCustom" => "Vips::TargetCustom",
+  "VipsArrayDouble" => "Array<Double>",
+  "VipsArrayInt" => "Array<Integer>",
+  "VipsArrayImage" => "Array<Image>",
+  "VipsArrayString" => "Array<String>"
+}
+ +
NO_GENERATE = +
+
+ +

these have hand-written methods, see above

+ + +
+
+
+ + +
+
+
["scale", "bandjoin", "composite", "ifthenelse"]
+ +
ALIAS = +
+
+ +

these are aliased (appear under several names)

+ + +
+
+
+ + +
+
+
["crop"]
+ +
+ + + + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .generateObject + + + + + +

+ + + + +
+
+
+
+1680
+1681
+1682
+1683
+1684
+1685
+1686
+1687
+1688
+1689
+1690
+1691
+1692
+1693
+1694
+1695
+1696
+1697
+1698
+1699
+1700
+1701
+1702
+1703
+1704
+1705
+1706
+1707
+1708
+1709
+1710
+1711
+1712
+1713
+1714
+1715
+1716
+
+
# File 'lib/vips/image.rb', line 1680
+
+def self.generate
+  alias_gtypes = {}
+  ALIAS.each do |name|
+    gtype = Vips.type_find "VipsOperation", name
+    alias_gtypes[gtype] = name
+  end
+
+  generate_class = lambda do |gtype, _|
+    name = if alias_gtypes.key? gtype
+      alias_gtypes[gtype]
+    else
+      Vips.nickname_find gtype
+    end
+
+    if name
+      begin
+        # can fail for abstract types
+        introspect = Vips::Introspect.get_yard name
+      rescue Vips::Error
+        nil
+      end
+
+      generate_operation(introspect) if introspect
+    end
+
+    Vips.vips_type_map gtype, generate_class, nil
+  end
+
+  puts "module Vips"
+  puts "  class Image"
+  puts ""
+
+  generate_class.call(GObject.g_type_from_name("VipsOperation"), nil)
+
+  puts "  end"
+  puts "end"
+end
+
+
+ +
+

+ + .generate_operation(introspect) ⇒ Object + + + + + +

+ + + + +
+
+
+
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+1634
+1635
+1636
+1637
+1638
+1639
+1640
+1641
+1642
+1643
+1644
+1645
+1646
+1647
+1648
+1649
+1650
+1651
+1652
+1653
+1654
+1655
+1656
+1657
+1658
+1659
+1660
+1661
+1662
+1663
+1664
+1665
+1666
+1667
+1668
+1669
+1670
+1671
+1672
+1673
+1674
+1675
+1676
+1677
+1678
+
+
# File 'lib/vips/image.rb', line 1613
+
+def self.generate_operation introspect
+  return if (introspect.flags & OPERATION_DEPRECATED) != 0
+  return if NO_GENERATE.include? introspect.name
+
+  method_args = introspect.method_args
+  required_output = introspect.required_output
+  optional_input = introspect.optional_input
+  optional_output = introspect.optional_output
+
+  print "# @!method "
+  print "self." unless introspect.member_x
+  print "#{introspect.name}("
+  print method_args.map { |x| x[:yard_name] }.join(", ")
+  print ", " if method_args.length > 0
+  puts "**opts)"
+
+  puts "#   #{introspect.description.capitalize}."
+
+  method_args.each do |details|
+    yard_name = details[:yard_name]
+    gtype = details[:gtype]
+    blurb = details[:blurb]
+
+    puts "#   @param #{yard_name} [#{gtype_to_ruby(gtype)}] #{blurb}"
+  end
+
+  puts "#   @param opts [Hash] Set of options"
+  optional_input.each do |arg_name, details|
+    yard_name = details[:yard_name]
+    gtype = details[:gtype]
+    blurb = details[:blurb]
+
+    puts "#   @option opts [#{gtype_to_ruby(gtype)}] :#{yard_name} #{blurb}"
+  end
+  optional_output.each do |arg_name, details|
+    yard_name = details[:yard_name]
+    gtype = details[:gtype]
+    blurb = details[:blurb]
+
+    print "#   @option opts [#{gtype_to_ruby(gtype)}] :#{yard_name}"
+    puts " Output #{blurb}"
+  end
+
+  print "#   @return ["
+  if required_output.length == 0
+    print "nil"
+  elsif required_output.length == 1
+    print gtype_to_ruby(required_output.first[:gtype])
+  else
+    print "Array<"
+    print required_output.map { |x| gtype_to_ruby(x[:gtype]) }.join(", ")
+    print ">"
+  end
+  if optional_output.length > 0
+    print ", Hash<Symbol => Object>"
+  end
+  print "] "
+  print required_output.map { |x| x[:blurb] }.join(", ")
+  if optional_output.length > 0
+    print ", " if required_output.length > 0
+    print "Hash of optional output items"
+  end
+  puts ""
+
+  puts ""
+end
+
+
+ +
+

+ + .gtype_to_ruby(gtype) ⇒ Object + + + + + +

+
+ +

turn a gtype into a ruby type name

+ + +
+
+
+ + +
+ + + + +
+
+
+
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+
+
# File 'lib/vips/image.rb', line 1597
+
+def self.gtype_to_ruby gtype
+  fundamental = GObject.g_type_fundamental gtype
+  type_name = GObject.g_type_name gtype
+
+  if MAP_GO_TO_RUBY.include? type_name
+    type_name = MAP_GO_TO_RUBY[type_name]
+  end
+
+  if fundamental == GObject::GFLAGS_TYPE ||
+      fundamental == GObject::GENUM_TYPE
+    type_name = "Vips::" + type_name[/Vips(.*)/, 1]
+  end
+
+  type_name
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/_index.html b/_index.html new file mode 100644 index 00000000..e85c9f36 --- /dev/null +++ b/_index.html @@ -0,0 +1,847 @@ + + + + + + + Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Documentation by YARD 0.9.25

+
+

Alphabetic Index

+ +

File Listing

+ + +
+

Namespace Listing A-Z

+ + + + + + + + + + +
+ + + + + + + + + + + + + + +
    +
  • E
  • +
      + +
    • + Error + + (Vips) + +
    • + +
    • + Extend + + (Vips) + +
    • + +
    +
+ + + + + + + + +
+ + +
    +
  • K
  • +
      + +
    • + Kernel + + (Vips) + +
    • + +
    +
+ + + + + + + + +
    +
  • P
  • + +
+ + + + + +
    +
  • S
  • +
      + +
    • + Size + + (Vips) + +
    • + +
    • + SizeStruct + + (Vips) + +
    • + +
    • + Source + + (Vips) + +
    • + +
    • + SourceCustom + + (Vips) + +
    • + +
    • + SourceCustomLayout + + (Vips::SourceCustom) + +
    • + +
    • + SourceLayout + + (Vips::Source) + +
    • + +
    • + Struct + + (Vips::Image) + +
    • + +
    • + Struct + + (Vips::Object) + +
    • + +
    • + Struct + + (Vips::Region) + +
    • + +
    • + Struct + + (Vips::Source) + +
    • + +
    • + Struct + + (Vips::Target) + +
    • + +
    • + Struct + + (GObject::GObject) + +
    • + +
    • + Struct + + (Vips::Operation) + +
    • + +
    • + Struct + + (Vips::Connection) + +
    • + +
    • + Struct + + (Vips::Interpolate) + +
    • + +
    • + Struct + + (Vips::MutableImage) + +
    • + +
    • + Struct + + (Vips::SourceCustom) + +
    • + +
    • + Struct + + (Vips::TargetCustom) + +
    • + +
    +
+ + + + + +
    +
  • V
  • +
      + +
    • + Vips + +
    • + +
    +
+ + +
+ + +
    +
  • Y
  • +
      + +
    • + Yard + + (Vips) + +
    • + +
    +
+ +
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/class_list.html b/class_list.html new file mode 100644 index 00000000..e3952d27 --- /dev/null +++ b/class_list.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + Class List + + + +
+
+

Class List

+ + + +
+ + +
+ + diff --git a/css/common.css b/css/common.css new file mode 100644 index 00000000..cf25c452 --- /dev/null +++ b/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/css/full_list.css b/css/full_list.css new file mode 100644 index 00000000..fa359824 --- /dev/null +++ b/css/full_list.css @@ -0,0 +1,58 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; + background: #fafafa; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +.fixed_header { position: fixed; background: #fff; width: 100%; padding-bottom: 10px; margin-top: 0; top: 0; z-index: 9999; height: 70px; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; margin-top: 80px; font-size: 1.1em; } +#full_list ul { padding: 0; } +#full_list li { padding: 0; margin: 0; list-style: none; } +#full_list li .item { padding: 5px 5px 5px 12px; } +#noresults { padding: 7px 12px; background: #fff; } +#content.insearch #noresults { margin-left: 7px; } +li.collapsed ul { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.odd { background: #f0f0f0; } +li.even { background: #fafafa; } +.item:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a, a:visited { text-decoration: none; color: #05a; } +li.clicked > .item { background: #05a; color: #ccc; } +li.clicked > .item a, li.clicked > .item a:visited { color: #eee; } +li.clicked > .item a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; border-radius: 3px; } +#full_list_nav { margin-left: 10px; font-size: 0.9em; display: block; color: #aaa; } +#full_list_nav a, #nav a:visited { color: #358; } +#full_list_nav a:hover { background: transparent; color: #5af; } +#full_list_nav span:after { content: ' | '; } +#full_list_nav span:last-child:after { content: ''; } + +#content h1 { margin-top: 0; } +li { white-space: nowrap; cursor: normal; } +li small { display: block; font-size: 0.8em; } +li small:before { content: ""; } +li small:after { content: ""; } +li small.search_info { display: none; } +#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +#content.insearch #search { background-position: center right; } +#search input { width: 110px; } + +#full_list.insearch ul { display: block; } +#full_list.insearch .item { display: none; } +#full_list.insearch .found { display: block; padding-left: 11px !important; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/css/style.css b/css/style.css new file mode 100644 index 00000000..62f4349d --- /dev/null +++ b/css/style.css @@ -0,0 +1,496 @@ +html { + width: 100%; + height: 100%; +} +body { + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + width: 100%; + margin: 0; + padding: 0; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} + +#nav { + position: relative; + width: 100%; + height: 100%; + border: 0; + border-right: 1px dotted #eee; + overflow: auto; +} +.nav_wrap { + margin: 0; + padding: 0; + width: 20%; + height: 100%; + position: relative; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; + flex-shrink: 0; + -webkit-flex-shrink: 0; + -ms-flex: 1 0; +} +#resizer { + position: absolute; + right: -5px; + top: 0; + width: 10px; + height: 100%; + cursor: col-resize; + z-index: 9999; +} +#main { + flex: 5 1; + -webkit-flex: 5 1; + -ms-flex: 5 1; + outline: none; + position: relative; + background: #fff; + padding: 1.2em; + padding-top: 0.2em; +} + +@media (max-width: 920px) { + .nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; } + #resizer { display: none; } + #nav { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 40px; + right: 12px; + width: 500px; + max-width: 80%; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + box-shadow: -7px 5px 25px #aaa; + border-radius: 2px; + } +} + +@media (min-width: 920px) { + body { height: 100%; overflow: hidden; } + #main { height: 100%; overflow: auto; } + #search { display: none; } +} + +#main img { max-width: 100%; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; + position: relative; +} +h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; } +h2 small a { + display: block; + height: 20px; + border: 1px solid #aaa; + border-bottom: 0; + border-top-left-radius: 5px; + background: #f8f8f8; + position: relative; + padding: 2px 7px; +} +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; } +.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt { + color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link a, .docstring .object_link a { + font-family: monospace; font-size: 1.05em; + color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } +.summary_desc pre.code .object_link a, .docstring pre.code .object_link a { + padding: 0px; background: inherit; color: inherit; border-radius: inherit; +} + +/* style for */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + +/* style for
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/lib/ruby-vips.rb b/lib/ruby-vips.rb deleted file mode 100644 index eb58e7f7..00000000 --- a/lib/ruby-vips.rb +++ /dev/null @@ -1 +0,0 @@ -require "vips" diff --git a/lib/vips.rb b/lib/vips.rb deleted file mode 100644 index 334b1c00..00000000 --- a/lib/vips.rb +++ /dev/null @@ -1,737 +0,0 @@ -# This module provides an interface to the vips image processing library -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" -require "logger" - -# This module uses FFI to make a simple layer over the glib and gobject -# libraries. - -# Generate a library name for ffi. -# -# Platform notes: -# linux: -# Some distros allow "libvips.so", but only if the -dev headers have been -# installed. To work everywhere, you must include the ABI number. -# Confusingly, the file extension is not at the end. ffi adds the "lib" -# prefix. -# mac: -# As linux, but the extension is at the end and is added by ffi. -# windows: -# The ABI number must be included, but with a hyphen. ffi does not add a -# "lib" prefix or a ".dll" suffix. -def library_name(name, abi_number) - if FFI::Platform.windows? - "lib#{name}-#{abi_number}.dll" - elsif FFI::Platform.mac? - "#{name}.#{abi_number}" - else - "#{name}.so.#{abi_number}" - end -end - -module GLib - class << self - attr_accessor :logger - end - @logger = Logger.new($stdout) - @logger.level = Logger::WARN - - extend FFI::Library - - ffi_lib library_name("glib-2.0", 0) - - attach_function :g_malloc, [:size_t], :pointer - - # save the FFI::Function that attach will return ... we can use it directly - # as a param for callbacks - G_FREE = attach_function :g_free, [:pointer], :void - - callback :g_log_func, [:string, :int, :string, :pointer], :void - attach_function :g_log_set_handler, - [:string, :int, :g_log_func, :pointer], :int - attach_function :g_log_remove_handler, [:string, :int], :void - - # log flags - LOG_FLAG_RECURSION = 1 << 0 - LOG_FLAG_FATAL = 1 << 1 - - # GLib log levels - LOG_LEVEL_ERROR = 1 << 2 # always fatal - LOG_LEVEL_CRITICAL = 1 << 3 - LOG_LEVEL_WARNING = 1 << 4 - LOG_LEVEL_MESSAGE = 1 << 5 - LOG_LEVEL_INFO = 1 << 6 - LOG_LEVEL_DEBUG = 1 << 7 - - # map glib levels to Logger::Severity - GLIB_TO_SEVERITY = { - LOG_LEVEL_ERROR => Logger::ERROR, - LOG_LEVEL_CRITICAL => Logger::FATAL, - LOG_LEVEL_WARNING => Logger::WARN, - LOG_LEVEL_MESSAGE => Logger::UNKNOWN, - LOG_LEVEL_INFO => Logger::INFO, - LOG_LEVEL_DEBUG => Logger::DEBUG - } - GLIB_TO_SEVERITY.default = Logger::UNKNOWN - - # nil being the default - @glib_log_domain = nil - @glib_log_handler_id = 0 - - # module-level, so it's not GCd away - LOG_HANDLER = proc { |domain, level, message, _user_data| - @logger.log(GLIB_TO_SEVERITY[level], message, domain) - } - - def self.remove_log_handler - if @glib_log_handler_id != 0 && @glib_log_domain - g_log_remove_handler @glib_log_domain, @glib_log_handler_id - @glib_log_handler_id = nil - end - end - - def self.set_log_domain domain - GLib.remove_log_handler - - @glib_log_domain = domain - - # forward all glib logging output from this domain to a Ruby logger - if @glib_log_domain - # disable this feature for now - # - # libvips background worker threads can issue warnings, and - # since the main thread is blocked waiting for libvips to come back - # from an ffi call, you get a deadlock on the GIL - # - # to fix this, we need a way for g_log() calls from libvips workers - # to be returned via the main thread - # - - # @glib_log_handler_id = g_log_set_handler @glib_log_domain, - # LOG_LEVEL_DEBUG | - # LOG_LEVEL_INFO | - # LOG_LEVEL_MESSAGE | - # LOG_LEVEL_WARNING | - # LOG_LEVEL_ERROR | - # LOG_LEVEL_CRITICAL | - # LOG_FLAG_FATAL | LOG_FLAG_RECURSION, - # LOG_HANDLER, nil - - # we must remove any handlers on exit, since libvips may log stuff - # on shutdown and we don't want LOG_HANDLER to be invoked - # after Ruby has gone - at_exit { - GLib.remove_log_handler - } - end - end -end - -module GObject - extend FFI::Library - - ffi_lib library_name("gobject-2.0", 0) - - # we can't just use ulong, windows has different int sizing rules - if FFI::Platform::ADDRESS_SIZE == 64 - typedef :uint64, :GType - else - typedef :uint32, :GType - end - - attach_function :g_type_init, [], :void - attach_function :g_type_name, [:GType], :string - attach_function :g_type_from_name, [:string], :GType - attach_function :g_type_fundamental, [:GType], :GType - - # glib before 2.36 needed this, does nothing in current glib - g_type_init - - # look up some common gtypes - GBOOL_TYPE = g_type_from_name "gboolean" - GINT_TYPE = g_type_from_name "gint" - GUINT64_TYPE = g_type_from_name "guint64" - GDOUBLE_TYPE = g_type_from_name "gdouble" - GENUM_TYPE = g_type_from_name "GEnum" - GFLAGS_TYPE = g_type_from_name "GFlags" - GSTR_TYPE = g_type_from_name "gchararray" - GOBJECT_TYPE = g_type_from_name "GObject" -end - -require "vips/gobject" -require "vips/gvalue" - -# This module provides a binding for the [libvips image processing -# library](https://libvips.github.io/libvips/). -# -# # Example -# -# ```ruby -# require 'vips' -# -# if ARGV.length < 2 -# raise "usage: #{$PROGRAM_NAME}: input-file output-file" -# end -# -# im = Vips::Image.new_from_file ARGV[0], access: :sequential -# -# im *= [1, 2, 1] -# -# mask = Vips::Image.new_from_array [ -# [-1, -1, -1], -# [-1, 16, -1], -# [-1, -1, -1] -# ], 8 -# im = im.conv mask, precision: :integer -# -# im.write_to_file ARGV[1] -# ``` -# -# This example loads a file, boosts the green channel (I'm not sure why), -# sharpens the image, and saves it back to disc again. -# -# Reading this example line by line, we have: -# -# ```ruby -# im = Vips::Image.new_from_file ARGV[0], access: :sequential -# ``` -# -# {Image.new_from_file} can load any image file supported by vips. In this -# example, we will be accessing pixels top-to-bottom as we sweep through the -# image reading and writing, so `:sequential` access mode is best for us. The -# default mode is `:random`: this allows for full random access to image pixels, -# but is slower and needs more memory. See {Access} -# for full details -# on the various modes available. -# -# You can also load formatted images from memory buffers, create images that -# wrap C-style memory arrays, or make images from constants. Use {Source} -# and {Image.new_from_source} to load images from any data source, for -# example URIs. -# -# The next line: -# -# ```ruby -# im *= [1, 2, 1] -# ``` -# -# Multiplying the image by an array constant uses one array element for each -# image band. This line assumes that the input image has three bands and will -# double the middle band. For RGB images, that's doubling green. -# -# Next we have: -# -# ```ruby -# mask = Vips::Image.new_from_array [ -# [-1, -1, -1], -# [-1, 16, -1], -# [-1, -1, -1] -# ], 8 -# im = im.conv mask, precision: :integer -# ``` -# -# {Image.new_from_array} creates an image from an array constant. The 8 at -# the end sets the scale: the amount to divide the image by after -# integer convolution. -# -# See the libvips API docs for `vips_conv()` (the operation -# invoked by {Image#conv}) for details on the convolution operator. By default, -# it computes with a float mask, but `:integer` is fine for this case, and is -# much faster. -# -# Finally: -# -# ```ruby -# im.write_to_file ARGV[1] -# ``` -# -# {Image#write_to_file} writes an image back to the filesystem. It can -# write any format supported by vips: the file type is set from the filename -# suffix. You can also write formatted images to memory buffers, or dump -# image data to a raw memory array. -# -# Use {Target} and {Image#write_to_target} to write formatted images to -# any data sink, for example URIs. -# -# # How it works -# -# The binding uses [ruby-ffi](https://github.com/ffi/ffi) to open the libvips -# shared library. When you call a method on the image class, it uses libvips -# introspection system (based on GObject) to search the -# library for an operation of that name, transforms the arguments to a form -# libvips can digest, and runs the operation. -# -# This means ruby-vips always presents the API implemented by the libvips shared -# library. It should update itself as new features are added. -# -# # Automatic wrapping -# -# `ruby-vips` adds a {Image.method_missing} handler to {Image} and uses -# it to look up vips operations. For example, the libvips operation `add`, which -# appears in C as `vips_add()`, appears in Ruby as {Image#add}. -# -# The operation's list of required arguments is searched and the first input -# image is set to the value of `self`. Operations which do not take an input -# image, such as {Image.black}, appear as class methods. The remainder of -# the arguments you supply in the function call are used to set the other -# required input arguments. Any trailing keyword arguments are used to set -# options on the operation. -# -# The result is the required output -# argument if there is only one result, or an array of values if the operation -# produces several results. If the operation has optional output objects, they -# are returned as a final hash. -# -# For example, {Image#min}, the vips operation that searches an image for -# the minimum value, has a large number of optional arguments. You can use it to -# find the minimum value like this: -# -# ```ruby -# min_value = image.min -# ``` -# -# You can ask it to return the position of the minimum with `:x` and `:y`. -# -# ```ruby -# min_value, opts = min x: true, y: true -# x_pos = opts['x'] -# y_pos = opts['y'] -# ``` -# -# Now `x_pos` and `y_pos` will have the coordinates of the minimum value. -# There's actually a convenience method for this, {Image#minpos}. -# -# You can also ask for the top *n* minimum, for example: -# -# ```ruby -# min_value, opts = min size: 10, x_array: true, y_array: true -# x_pos = opts['x_array'] -# y_pos = opts['y_array'] -# ``` -# -# Now `x_pos` and `y_pos` will be 10-element arrays. -# -# Because operations are member functions and return the result image, you can -# chain them. For example, you can write: -# -# ```ruby -# result_image = image.real.cos -# ``` -# -# to calculate the cosine of the real part of a complex image. -# There are also a full set -# of arithmetic operator overloads, see below. -# -# libvips types are also automatically wrapped. The override looks at the type -# of argument required by the operation and converts the value you supply, -# when it can. For example, {Image#linear} takes a `VipsArrayDouble` as -# an argument -# for the set of constants to use for multiplication. You can supply this -# value as an integer, a float, or some kind of compound object and it -# will be converted for you. You can write: -# -# ```ruby -# result_image = image.linear 1, 3 -# result_image = image.linear 12.4, 13.9 -# result_image = image.linear [1, 2, 3], [4, 5, 6] -# result_image = image.linear 1, [4, 5, 6] -# ``` -# -# And so on. A set of overloads are defined for {Image#linear}, see below. -# -# It does a couple of more ambitious conversions. It will automatically convert -# to and from the various vips types, like `VipsBlob` and `VipsArrayImage`. For -# example, you can read the ICC profile out of an image like this: -# -# ```ruby -# profile = im.get_value "icc-profile-data" -# ``` -# -# and profile will be a byte array. -# -# If an operation takes several input images, you can use a constant for all but -# one of them and the wrapper will expand the constant to an image for you. For -# example, {Image#ifthenelse} uses a condition image to pick pixels -# between a then and an else image: -# -# ```ruby -# result_image = condition_image.ifthenelse then_image, else_image -# ``` -# -# You can use a constant instead of either the then or the else parts and it -# will be expanded to an image for you. If you use a constant for both then and -# else, it will be expanded to match the condition image. For example: -# -# ```ruby -# result_image = condition_image.ifthenelse [0, 255, 0], [255, 0, 0] -# ``` -# -# Will make an image where true pixels are green and false pixels are red. -# -# This is useful for {Image#bandjoin}, the thing to join two or more -# images up bandwise. You can write: -# -# ```ruby -# rgba = rgb.bandjoin 255 -# ``` -# -# to append a constant 255 band to an image, perhaps to add an alpha channel. Of -# course you can also write: -# -# ```ruby -# result_image = image1.bandjoin image2 -# result_image = image1.bandjoin [image2, image3] -# result_image = Vips::Image.bandjoin [image1, image2, image3] -# result_image = image1.bandjoin [image2, 255] -# ``` -# -# and so on. -# -# # Logging -# -# Libvips uses g_log() to log warning, debug, info and (some) error messages. -# -# https://developer.gnome.org/glib/stable/glib-Message-Logging.html -# -# You can disable warnings by defining the `VIPS_WARNING` environment variable. -# You can enable info output by defining `VIPS_INFO`. -# -# # Exceptions -# -# The wrapper spots errors from vips operations and raises the {Vips::Error} -# exception. You can catch it in the usual way. -# -# # Automatic YARD documentation -# -# The bulk of these API docs are generated automatically by {Yard#generate}. -# It examines libvips and writes a summary of each operation and the arguments -# and options that that operation expects. -# -# Use the [C API # docs](https://libvips.github.io/libvips/API/current) -# for more detail. -# -# # Enums -# -# The libvips enums, such as `VipsBandFormat` appear in ruby-vips as Symbols -# like `:uchar`. They are documented as a set of classes for convenience, see -# {Vips::BandFormat}, for example. -# -# # Draw operations -# -# There are two ways of calling the libvips draw operations, like -# {Image#draw_circle} and {Image#draw_line}. -# -# First, you can use them like functions. For example: -# -# ```ruby -# y = x.draw_line 255, 0, 0, x.width, x.height -# ``` -# -# This will make a new image, `y`, which is a copy of `x` but with a line -# drawn across it. `x` is unchanged. -# -# This is simple, but will be slow if you want to draw many lines, since -# ruby-vips will make a copy of the whole image each time. -# -# You can use {Image#mutate} to make a {MutableImage}. This is an image which -# is unshared and is only available inside the {Image#mutate} block. Within -# this block, you can use `!` versions of the draw operations to modify images -# and avoid the copy. For example: -# -# ```ruby -# image = image.mutate do |mutable| -# (0 ... 1).step(0.01) do |i| -# mutable.draw_line! 255, mutable.width * i, 0, 0, mutable.height * (1 - i) -# end -# end -# ``` -# -# Now each {Image#draw_line} will directly modify the mutable image, saving -# the copy. This is much faster and needs much less memory. -# -# # Metadata read -# -# Use {Image#get_fields} to get a list of the metadata fields that an image -# supports. ICC profiles, for example, are in a field called -# `icc-profile-data`. Use `vipsheader -a something.jpg` at the command-line -# to see all the fields on an image. -# -# Use {Image#get_typeof} to get the type of a field. Types are integers, with -# 0 meaning "no such field". Constants like {GObject::GINT_TYPE} are useful for -# testing field types. -# -# You can read image metadata using {Image#get}. The field value is converted -# to a Ruby value in the obvious way. -# -# # Metadata write -# -# You can also set and remove image metadata fields. Images are immutable, so -# you must make any changes inside a {Image#mutate} block. For example: -# -# ```ruby -# image = image.mutate do |mutable| -# image.get_fields.each do |field| -# mutable.remove! field unless field == "icc-profile-data" -# end -# end -# ``` -# -# To remove all metadata except the icc profile. -# -# You can use {MutableImage#set!} to change the value of an existing field, -# and {MutableImage#set_type!} to create a new field with a specified type. -# -# # Progress -# -# You can attach signal handlers to images to watch computation progress. For -# example: -# -# ```ruby -# image = Vips::Image.black 1, 100000 -# image.set_progress true -# -# def progress_to_s(name, progress) -# puts "#{name}:" -# puts " run = #{progress[:run]}" -# puts " eta = #{progress[:eta]}" -# puts " tpels = #{progress[:tpels]}" -# puts " npels = #{progress[:npels]}" -# puts " percent = #{progress[:percent]}" -# end -# -# image.signal_connect :preeval do |progress| -# progress_to_s("preeval", progress) -# end -# -# image.signal_connect :eval do |progress| -# progress_to_s("eval", progress) -# image.set_kill(true) if progress[:percent] > 50 -# end -# -# image.signal_connect :posteval do |progress| -# progress_to_s("posteval", progress) -# end -# -# image.avg -# ``` -# -# The `:eval` signal will fire for every tile that is processed. You can stop -# progress with {Image#set_kill} and processing will end with an exception. -# -# User streams -# -# You can make your own input and output stream objects with {SourceCustom} and -# {TargetCustom}. For example: -# -# ```ruby -# file = File.open "some/file", "rb" -# source = Vips::SourceCustom.new -# source.on_read { |length| file.read length } -# image = Vips::Image.new_from_source source, "", access: "sequential" -# ``` -# -# # Overloads -# -# The wrapper defines the usual set of arithmetic, boolean and relational -# overloads on image. You can mix images, constants and lists of constants -# (almost) freely. For example, you can write: -# -# ```ruby -# result_image = ((image * [1, 2, 3]).abs < 128) | 4 -# ``` -# -# # Expansions -# -# Some vips operators take an enum to select an action, for example -# {Image#math} can be used to calculate sine of every pixel like this: -# -# ```ruby -# result_image = image.math :sin -# ``` -# -# This is annoying, so the wrapper expands all these enums into separate members -# named after the enum. So you can write: -# -# ```ruby -# result_image = image.sin -# ``` -# -# # Convenience functions -# -# The wrapper defines a few extra useful utility functions: -# {Image#get_value}, {Image#set_value}, {Image#bandsplit}, -# {Image#maxpos}, {Image#minpos}, -# {Image#median}. - -module Vips - extend FFI::Library - - ffi_lib library_name("vips", 42) - - LOG_DOMAIN = "VIPS" - GLib.set_log_domain LOG_DOMAIN - - # we can't just use ulong, windows has different int sizing rules - if FFI::Platform::ADDRESS_SIZE == 64 - typedef :uint64, :GType - else - typedef :uint32, :GType - end - - attach_function :vips_error_buffer, [], :string - attach_function :vips_error_clear, [], :void - - # The ruby-vips error class. - class Error < RuntimeError - # @param msg [String] The error message. If this is not supplied, grab - # and clear the vips error buffer and use that. - def initialize msg = nil - if msg - @details = msg - elsif Vips.vips_error_buffer != "" - @details = Vips.vips_error_buffer - Vips.vips_error_clear - else - @details = nil - end - end - - # Pretty-print a {Vips::Error}. - # - # @return [String] The error message - def to_s - if !@details.nil? - @details - else - super.to_s - end - end - end - - attach_function :vips_init, [:string], :int - - if Vips.vips_init($0) != 0 - throw Vips.get_error - end - - # don't use at_exit to call vips_shutdown, it causes problems with fork, and - # in any case libvips does this for us - - attach_function :vips_leak_set, [:int], :void - attach_function :vips_vector_set_enabled, [:int], :void - attach_function :vips_concurrency_set, [:int], :void - - # vips_foreign_get_suffixes was added in libvips 8.8 - begin - attach_function :vips_foreign_get_suffixes, [], :pointer - rescue FFI::NotFoundError - nil - end - - # Turn libvips leak testing on and off. Handy for debugging ruby-vips, not - # very useful for user code. - def self.leak_set leak - vips_leak_set((leak ? 1 : 0)) - end - - attach_function :vips_cache_set_max, [:int], :void - attach_function :vips_cache_set_max_mem, [:int], :void - attach_function :vips_cache_set_max_files, [:int], :void - - # Set the maximum number of operations that libvips should cache. Set 0 to - # disable the operation cache. The default is 1000. - def self.cache_set_max size - vips_cache_set_max size - end - - # Set the maximum amount of memory that libvips should use for the operation - # cache. Set 0 to disable the operation cache. The default is 100mb. - def self.cache_set_max_mem size - vips_cache_set_max_mem size - end - - # Set the maximum number of files libvips should keep open in the - # operation cache. Set 0 to disable the operation cache. The default is - # 100. - def self.cache_set_max_files size - vips_cache_set_max_files size - end - - # Set the size of the libvips worker pool. This defaults to the number of - # hardware threads on your computer. Set to 1 to disable threading. - def self.concurrency_set n - vips_concurrency_set n - end - - # Enable or disable SIMD and the run-time compiler. This can give a nice - # speed-up, but can also be unstable on some systems or with some versions - # of the run-time compiler. - def self.vector_set enabled - vips_vector_set_enabled(enabled ? 1 : 0) - end - - # Deprecated compatibility function. - # - # Don't use this, instead change GLib::logger.level. - def self.set_debug debug - if debug - GLib.logger.level = Logger::DEBUG - end - end - - attach_function :version, :vips_version, [:int], :int - attach_function :version_string, :vips_version_string, [], :string - - # True if this is at least libvips x.y - def self.at_least_libvips?(x, y) - major = version(0) - minor = version(1) - - major > x || (major == x && minor >= y) - end - - # Get a list of all supported file suffixes. - # - # @return [[String]] array of supported suffixes - def self.get_suffixes - # vips_foreign_get_suffixes() was added in libvips 8.8 - return [] unless Vips.respond_to? :vips_foreign_get_suffixes - - array = Vips.vips_foreign_get_suffixes - - names = [] - p = array - until (q = p.read_pointer).null? - suff = q.read_string - GLib.g_free q - names << suff unless names.include? suff - p += FFI::Type::POINTER.size - end - GLib.g_free array - - names - end - - LIBRARY_VERSION = Vips.version_string - - # libvips has this arbitrary number as a sanity-check upper bound on image - # size. It's sometimes useful to know when calculating scale factors. - MAX_COORD = 10000000 -end - -require "vips/object" -require "vips/operation" -require "vips/image" -require "vips/mutableimage" -require "vips/interpolate" -require "vips/region" -require "vips/version" -require "vips/connection" -require "vips/source" -require "vips/sourcecustom" -require "vips/target" -require "vips/targetcustom" diff --git a/lib/vips/access.rb b/lib/vips/access.rb deleted file mode 100644 index 551a6990..00000000 --- a/lib/vips/access.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Vips - # The type of access an operation has to supply. - # - # * `:random` means requests can come in any order. - # - # * `:sequential` means requests will be top-to-bottom, but with some - # amount of buffering behind the read point for small non-local - # accesses. - class Access < Symbol - end -end diff --git a/lib/vips/align.rb b/lib/vips/align.rb deleted file mode 100644 index 297b4c26..00000000 --- a/lib/vips/align.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Vips - # Various types of alignment. See {Image#join}, for example. - # - # * `:low` Align on the low coordinate edge - # * `:centre` Align on the centre - # * `:high` Align on the high coordinate edge - - class Align < Symbol - end -end diff --git a/lib/vips/angle.rb b/lib/vips/angle.rb deleted file mode 100644 index 08f7b01d..00000000 --- a/lib/vips/angle.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Vips - # Various fixed 90 degree rotation angles. See {Image#rot}. - # - # * `:d0` no rotate - # * `:d90` 90 degrees clockwise - # * `:d180` 180 degrees - # * `:d270` 90 degrees anti-clockwise - - class Angle < Symbol - end -end diff --git a/lib/vips/angle45.rb b/lib/vips/angle45.rb deleted file mode 100644 index 9cef55c8..00000000 --- a/lib/vips/angle45.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Vips - # Various fixed 45 degree rotation angles. See {Image#rot45}. - # - # * `:d0` no rotate - # * `:d45` 45 degrees clockwise - # * `:d90` 90 degrees clockwise - # * `:d135` 135 degrees clockwise - # * `:d180` 180 degrees - # * `:d225` 135 degrees anti-clockwise - # * `:d270` 90 degrees anti-clockwise - # * `:d315` 45 degrees anti-clockwise - - class Angle45 < Symbol - end -end diff --git a/lib/vips/bandformat.rb b/lib/vips/bandformat.rb deleted file mode 100644 index eb0caf43..00000000 --- a/lib/vips/bandformat.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Vips - # The format used for each band element. Each corresponds to a native C type - # for the current machine. - # - # * `:notset` invalid setting - # * `:uchar` unsigned char format - # * `:char` char format - # * `:ushort` unsigned short format - # * `:short` short format - # * `:uint` unsigned int format - # * `:int` int format - # * `:float` float format - # * `:complex` complex (two floats) format - # * `:double` double float format - # * `:dpcomplex` double complex (two double) format - class BandFormat < Symbol - end -end diff --git a/lib/vips/blend_mode.rb b/lib/vips/blend_mode.rb deleted file mode 100644 index 822d5d60..00000000 --- a/lib/vips/blend_mode.rb +++ /dev/null @@ -1,36 +0,0 @@ -module Vips - # Blend mode to use when compositing images. See {Image#composite}. - # - # * `:clear` where the second object is drawn, the first is removed - # * `:source` the second object is drawn as if nothing were below - # * `:over` the image shows what you would expect if you held two - # semi-transparent slides on top of each other - # * `:in` the first object is removed completely, the second is only - # drawn where the first was - # * `:out` the second is drawn only where the first isn't - # * `:atop` this leaves the first object mostly intact, but mixes both - # objects in the overlapping area - # * `:dest` leaves the first object untouched, the second is discarded - # completely - # * `:dest_over` like `:over`, but swaps the arguments - # * `:dest_in` like `:in`, but swaps the arguments - # * `:dest_out` like `:out`, but swaps the arguments - # * `:dest_atop` like `:atop`, but swaps the arguments - # * `:xor` something like a difference operator - # * `:add` a bit like adding the two images - # * `:saturate` a bit like the darker of the two - # * `:multiply` at least as dark as the darker of the two inputs - # * `:screen` at least as light as the lighter of the inputs - # * `:overlay` multiplies or screens colors, depending on the lightness - # * `:darken` the darker of each component - # * `:lighten` the lighter of each component - # * `:colour_dodge` brighten first by a factor second - # * `:colour_burn` darken first by a factor of second - # * `:hard_light` multiply or screen, depending on lightness - # * `:soft_light` darken or lighten, depending on lightness - # * `:difference` difference of the two - # * `:exclusion` somewhat like `:difference`, but lower-contrast - - class BlendMode < Symbol - end -end diff --git a/lib/vips/coding.rb b/lib/vips/coding.rb deleted file mode 100644 index dba174ee..00000000 --- a/lib/vips/coding.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Vips - # How pixels are coded. - # - # Normally, pixels are uncoded and can be manipulated as you would expect. - # However some file formats code pixels for compression, and sometimes it's - # useful to be able to manipulate images in the coded format. - # - # * `:none` pixels are not coded - # * `:labq` pixels encode 3 float CIELAB values as 4 uchar - # * `:rad` pixels encode 3 float RGB as 4 uchar (Radiance coding) - class Coding < Symbol - end -end diff --git a/lib/vips/compass_direction.rb b/lib/vips/compass_direction.rb deleted file mode 100644 index cbbbbcb8..00000000 --- a/lib/vips/compass_direction.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Vips - # A direction on a compass used for placing images. See {Image#gravity}. - # - # * `:centre` - # * `:north` - # * `:east` - # * `:south` - # * `:west` - # * `:"north-east"` - # * `:"south-east"` - # * `:"south-west"` - # * `:"north-west"` - - class CompassDirection < Symbol - end -end diff --git a/lib/vips/connection.rb b/lib/vips/connection.rb deleted file mode 100644 index 51b9ba6f..00000000 --- a/lib/vips/connection.rb +++ /dev/null @@ -1,46 +0,0 @@ -# This module provides an interface to the top level bits of libvips -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module Vips - if Vips.at_least_libvips?(8, 9) - attach_function :vips_connection_filename, [:pointer], :string - attach_function :vips_connection_nick, [:pointer], :string - end - - # Abstract base class for connections. - class Connection < Vips::Object - # The layout of the VipsRegion struct. - module ConnectionLayout - def self.included(base) - base.class_eval do - layout :parent, Vips::Object::Struct - # rest opaque - end - end - end - - class Struct < Vips::Object::Struct - include ConnectionLayout - end - - class ManagedStruct < Vips::Object::ManagedStruct - include ConnectionLayout - end - - # Get any filename associated with a connection, or nil. - def filename - Vips.vips_connection_filename self - end - - # Get a nickname (short description) of a connection that could be shown to - # the user. - def nick - Vips.vips_connection_nick self - end - end -end diff --git a/lib/vips/direction.rb b/lib/vips/direction.rb deleted file mode 100644 index 732f71b4..00000000 --- a/lib/vips/direction.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Vips - # Operations like {Image#flip} need to be told whether to flip - # left-right or top-bottom. - # - # * `:horizontal` left-right - # * `:vertical` top-bottom - - class Direction < Symbol - end -end diff --git a/lib/vips/extend.rb b/lib/vips/extend.rb deleted file mode 100644 index 93319d45..00000000 --- a/lib/vips/extend.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Vips - # When the edges of an image are extended, you can specify - # how you want the extension done. - # See {Image#embed}, {Image#conv}, {Image#affine} and - # so on. - # - # * `:black` new pixels are black, ie. all bits are zero. - # * `:copy` each new pixel takes the value of the nearest edge pixel - # * `:repeat` the image is tiled to fill the new area - # * `:mirror` the image is reflected and tiled to reduce hash edges - # * `:white` new pixels are white, ie. all bits are set - # * `:background` colour set from the @background property - - class Extend < Symbol - end -end diff --git a/lib/vips/gobject.rb b/lib/vips/gobject.rb deleted file mode 100644 index 07005215..00000000 --- a/lib/vips/gobject.rb +++ /dev/null @@ -1,133 +0,0 @@ -# This module provides an interface to the top level bits of GObject -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" -require "forwardable" - -module GObject - # we have a number of things we need to inherit in different ways: - # - # - we want to be able to subclass GObject in Ruby in a simple way - # - the layouts of the nested structs need to inherit - # - we need to be able to cast between structs which share a base struct - # without creating new wrappers or messing up refcounting - # - we need automatic gobject refcounting - # - # the solution is to split the class into four areas which we treat - # differently: - # - # - we have a "wrapper" Ruby class to allow easy subclassing ... this has a - # @struct member which holds the actual pointer - # - we use "forwardable" to forward the various ffi methods on to the - # @struct member ... we arrange things so that subclasses do not need to - # do the forwarding themselves - # - we have two versions of the struct: a plain one which we can use for - # casting that will not change the refcounts - # - and a managed one with an unref which we just use for .new - # - we separate the struct layout into a separate module to avoid repeating - # ourselves - - class GObject - extend Forwardable - extend SingleForwardable - - def_instance_delegators :@struct, :[], :to_ptr - def_single_delegators :ffi_struct, :ptr - - attr_reader :references - - # the layout of the GObject struct - module GObjectLayout - def self.included base - base.class_eval do - layout :g_type_instance, :pointer, - :ref_count, :uint, - :qdata, :pointer - end - end - end - - # the struct with unref ... manage object lifetime with this - class ManagedStruct < FFI::ManagedStruct - include GObjectLayout - - def self.release ptr - # GLib::logger.debug("GObject::GObject::ManagedStruct.release") { - # "unreffing #{ptr}" - # } - ::GObject.g_object_unref ptr - end - end - - # the plain struct ... cast with this - class Struct < FFI::Struct - include GObjectLayout - end - - # don't allow ptr == nil, we never want to allocate a GObject struct - # ourselves, we just want to wrap GLib-allocated GObjects - # - # here we use ManagedStruct, not Struct, since this is the ref that will - # need the unref - def initialize ptr - # GLib::logger.debug("GObject::GObject.initialize") {"ptr = #{ptr}"} - @ptr = ptr - @struct = ffi_managed_struct.new ptr - - # sometimes we need to keep refs across C calls ... hide them here - @references = [] - end - - # access to the casting struct for this class - def ffi_struct - self.class.ffi_struct - end - - # get the pointer we were built from ... #to_ptr gets the pointer after we - # have wrapped it up with an auto unref - attr_reader :ptr - - class << self - def ffi_struct - const_get :Struct - end - end - - # access to the managed struct for this class - def ffi_managed_struct - self.class.ffi_managed_struct - end - - class << self - def ffi_managed_struct - const_get :ManagedStruct - end - end - end - - class GParamSpec < FFI::Struct - # the first few public fields - layout :g_type_instance, :pointer, - :name, :string, - :flags, :uint, - :value_type, :GType, - :owner_type, :GType - end - - class GParamSpecPtr < FFI::Struct - layout :value, GParamSpec.ptr - end - - attach_function :g_param_spec_get_blurb, [:pointer], :string - - attach_function :g_object_ref, [:pointer], :void - attach_function :g_object_unref, [:pointer], :void - - # we just use one gcallback type for every signal, hopefully this is OK - callback :gcallback, [:pointer], :void - attach_function :g_signal_connect_data, - [:pointer, :string, :gcallback, :pointer, :pointer, :int], :long -end diff --git a/lib/vips/gvalue.rb b/lib/vips/gvalue.rb deleted file mode 100644 index c6a1cb8a..00000000 --- a/lib/vips/gvalue.rb +++ /dev/null @@ -1,287 +0,0 @@ -# This module provides an interface GValue via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module GObject - # Represent a GValue. Example use: - # - # ```ruby - # gvalue = GValue::alloc - # gvalue.init GObject::GDOUBLE_TYPE - # gvalue.set 3.1415 - # value = gvalue.get - # # optional -- drop any ref the gvalue had - # gvalue.unset - # ``` - # - # Lifetime is managed automatically. It doesn't know about all GType values, - # but it does know the ones that libvips uses. - - class GValue < FFI::ManagedStruct - layout :gtype, :GType, - :data, [:ulong_long, 2] - - # convert an enum value (str/symb/int) into an int ready for libvips - def self.from_nick(gtype, value) - value = value.to_s if value.is_a? Symbol - - if value.is_a? String - # libvips expects "-" as a separator in enum names, but "_" is more - # convenient for ruby, eg. :b_w - value = Vips.vips_enum_from_nick "ruby-vips", gtype, value.tr("_", "-") - if value == -1 - raise Vips::Error - end - end - - value - end - - # convert an int enum back into a symbol - def self.to_nick(gtype, enum_value) - enum_name = Vips.vips_enum_nick gtype, enum_value - if enum_name.nil? - raise Vips::Error - end - - enum_name.to_sym - end - - def self.release ptr - # GLib::logger.debug("GObject::GValue::release") {"ptr = #{ptr}"} - ::GObject.g_value_unset ptr - end - - # Allocate memory for a GValue and return a class wrapper. Memory will - # be freed automatically when it goes out of scope. The GValue is inited - # to 0, use {GValue.init} to set a type. - # - # @return [GValue] a new gvalue set to 0 - def self.alloc - # allocate memory - memory = FFI::MemoryPointer.new GValue - - # make this alloc autorelease ... we mustn't release in - # GValue::release, since we are used to wrap GValue pointers - # made by other people - pointer = FFI::Pointer.new GValue, memory - - # ... and wrap in a GValue - GValue.new pointer - end - - # Set the type of thing a gvalue can hold. - # - # @param gtype [GType] the type of thing this GValue can hold. - def init gtype - ::GObject.g_value_init self, gtype - end - - # Set the value of a GValue. The value is converted to the type of the - # GValue, if possible. - # - # @param value [Any] The value to set - def set value - # GLib::logger.debug("GObject::GValue.set") { - # "value = #{value.inspect[0..50]}" - # } - - gtype = self[:gtype] - fundamental = ::GObject.g_type_fundamental gtype - - case gtype - when GBOOL_TYPE - ::GObject.g_value_set_boolean self, (value ? 1 : 0) - - when GINT_TYPE - ::GObject.g_value_set_int self, value - - when GUINT64_TYPE - ::GObject.g_value_set_uint64 self, value - - when GDOUBLE_TYPE - ::GObject.g_value_set_double self, value - - when GSTR_TYPE - ::GObject.g_value_set_string self, value - - when Vips::REFSTR_TYPE - ::Vips.vips_value_set_ref_string self, value - - when Vips::ARRAY_INT_TYPE - value = [value] unless value.is_a? Array - - Vips.vips_value_set_array_int self, nil, value.length - ptr = Vips.vips_value_get_array_int self, nil - ptr.write_array_of_int32 value - - when Vips::ARRAY_DOUBLE_TYPE - value = [value] unless value.is_a? Array - - # this will allocate an array in the gvalue - Vips.vips_value_set_array_double self, nil, value.length - - # pull the array out and fill it - ptr = Vips.vips_value_get_array_double self, nil - - ptr.write_array_of_double value - - when Vips::ARRAY_IMAGE_TYPE - value = [value] unless value.is_a? Array - - Vips.vips_value_set_array_image self, value.length - ptr = Vips.vips_value_get_array_image self, nil - ptr.write_array_of_pointer value - - # the gvalue needs a ref on each of the images - value.each { |image| ::GObject.g_object_ref image } - - when Vips::BLOB_TYPE - len = value.bytesize - ptr = GLib.g_malloc len - Vips.vips_value_set_blob self, GLib::G_FREE, ptr, len - ptr.write_bytes value - - else - case fundamental - when GFLAGS_TYPE - ::GObject.g_value_set_flags self, value - - when GENUM_TYPE - enum_value = GValue.from_nick(self[:gtype], value) - ::GObject.g_value_set_enum self, enum_value - - when GOBJECT_TYPE - ::GObject.g_value_set_object self, value - - else - raise Vips::Error, "unimplemented gtype for set: " \ - "#{::GObject.g_type_name gtype} (#{gtype})" - end - end - end - - # Get the value of a GValue. The value is converted to a Ruby type in - # the obvious way. - # - # @return [Any] the value held by the GValue - def get - gtype = self[:gtype] - fundamental = ::GObject.g_type_fundamental gtype - result = nil - - case gtype - when GBOOL_TYPE - result = ::GObject.g_value_get_boolean(self) != 0 - - when GINT_TYPE - result = ::GObject.g_value_get_int self - - when GUINT64_TYPE - result = ::GObject.g_value_get_uint64 self - - when GDOUBLE_TYPE - result = ::GObject.g_value_get_double self - - when GSTR_TYPE - result = ::GObject.g_value_get_string self - - when Vips::REFSTR_TYPE - len = Vips::SizeStruct.new - result = ::Vips.vips_value_get_ref_string self, len - - when Vips::ARRAY_INT_TYPE - len = Vips::IntStruct.new - array = Vips.vips_value_get_array_int self, len - result = array.get_array_of_int32 0, len[:value] - - when Vips::ARRAY_DOUBLE_TYPE - len = Vips::IntStruct.new - array = Vips.vips_value_get_array_double self, len - result = array.get_array_of_double 0, len[:value] - - when Vips::ARRAY_IMAGE_TYPE - len = Vips::IntStruct.new - array = Vips.vips_value_get_array_image self, len - result = array.get_array_of_pointer 0, len[:value] - result.map! do |pointer| - ::GObject.g_object_ref pointer - Vips::Image.new pointer - end - - when Vips::BLOB_TYPE - len = Vips::SizeStruct.new - array = Vips.vips_value_get_blob self, len - result = array.get_bytes 0, len[:value] - - else - case fundamental - when GFLAGS_TYPE - result = ::GObject.g_value_get_flags self - - when GENUM_TYPE - enum_value = ::GObject.g_value_get_enum(self) - result = GValue.to_nick self[:gtype], enum_value - - when GOBJECT_TYPE - obj = ::GObject.g_value_get_object self - # g_value_get_object() does not add a ref ... we need to add - # one to match the unref in gobject release - ::GObject.g_object_ref obj - result = Vips::Image.new obj - - else - raise Vips::Error, "unimplemented gtype for get: " \ - "#{::GObject.g_type_name gtype} (#{gtype})" - end - end - - # GLib::logger.debug("GObject::GValue.get") { - # "result = #{result.inspect[0..50]}" - # } - - result - end - - # Clear the thing held by a GValue. - # - # This happens automatically when a GValue is GCed, but this method can be - # handy if you need to drop a reference explicitly for some reason. - def unset - ::GObject.g_value_unset self - end - end - - attach_function :g_value_init, [GValue.ptr, :GType], :void - - # we must use a plain :pointer here, since we call this from #release, which - # just gives us the unwrapped pointer, not the ruby class - attach_function :g_value_unset, [:pointer], :void - - attach_function :g_value_set_boolean, [GValue.ptr, :int], :void - attach_function :g_value_set_int, [GValue.ptr, :int], :void - attach_function :g_value_set_uint64, [GValue.ptr, :uint64], :void - attach_function :g_value_set_double, [GValue.ptr, :double], :void - attach_function :g_value_set_enum, [GValue.ptr, :int], :void - attach_function :g_value_set_flags, [GValue.ptr, :uint], :void - attach_function :g_value_set_string, [GValue.ptr, :string], :void - attach_function :g_value_set_object, [GValue.ptr, :pointer], :void - - attach_function :g_value_get_boolean, [GValue.ptr], :int - attach_function :g_value_get_int, [GValue.ptr], :int - attach_function :g_value_get_uint64, [GValue.ptr], :uint64 - attach_function :g_value_get_double, [GValue.ptr], :double - attach_function :g_value_get_enum, [GValue.ptr], :int - attach_function :g_value_get_flags, [GValue.ptr], :int - attach_function :g_value_get_string, [GValue.ptr], :string - attach_function :g_value_get_object, [GValue.ptr], :pointer - - # use :pointer rather than GObject.ptr to avoid casting later - attach_function :g_object_set_property, - [:pointer, :string, GValue.ptr], :void - attach_function :g_object_get_property, - [:pointer, :string, GValue.ptr], :void -end diff --git a/lib/vips/image.rb b/lib/vips/image.rb deleted file mode 100644 index 1b800d1e..00000000 --- a/lib/vips/image.rb +++ /dev/null @@ -1,1718 +0,0 @@ -# This module provides an interface to the vips image processing library -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module Vips - private - - attach_function :vips_image_new_matrix_from_array, - [:int, :int, :pointer, :int], :pointer - - attach_function :vips_image_copy_memory, [:pointer], :pointer - - attach_function :vips_image_set_progress, [:pointer, :bool], :void - attach_function :vips_image_set_kill, [:pointer, :bool], :void - - attach_function :vips_filename_get_filename, [:string], :pointer - attach_function :vips_filename_get_options, [:string], :pointer - - attach_function :vips_foreign_find_load, [:string], :string - attach_function :vips_foreign_find_save, [:string], :string - attach_function :vips_foreign_find_load_buffer, [:pointer, :size_t], :string - attach_function :vips_foreign_find_save_buffer, [:string], :string - - if Vips.at_least_libvips?(8, 9) - attach_function :vips_foreign_find_load_source, [:pointer], :string - attach_function :vips_foreign_find_save_target, [:string], :string - end - - attach_function :vips_image_write_to_memory, - [:pointer, SizeStruct.ptr], :pointer - - attach_function :vips_image_get_typeof, [:pointer, :string], :GType - attach_function :vips_image_get, - [:pointer, :string, GObject::GValue.ptr], :int - - attach_function :vips_image_get_width, [:pointer], :int - attach_function :vips_image_get_height, [:pointer], :int - attach_function :vips_image_get_bands, [:pointer], :int - - if Vips.at_least_libvips?(8, 5) - attach_function :vips_image_get_fields, [:pointer], :pointer - attach_function :vips_image_hasalpha, [:pointer], :int - end - - if Vips.at_least_libvips?(8, 6) - attach_function :vips_addalpha, [:pointer, :pointer, :varargs], :int - end - - # move these three lines to mutableimage when we finally remove set and - # remove in this class - attach_function :vips_image_set, - [:pointer, :string, GObject::GValue.ptr], :void - attach_function :vips_image_remove, [:pointer, :string], :void - - attach_function :vips_band_format_iscomplex, [:int], :int - attach_function :vips_band_format_isfloat, [:int], :int - - attach_function :nickname_find, :vips_nickname_find, [:GType], :string - - attach_function :vips_image_new_from_memory, [:pointer, :size_t, :int, :int, :int, :int], :pointer - attach_function :vips_image_new_from_memory_copy, [:pointer, :size_t, :int, :int, :int, :int], :pointer - - # turn a raw pointer that must be freed into a self-freeing Ruby string - def self.p2str(pointer) - pointer = FFI::AutoPointer.new(pointer, GLib::G_FREE) - pointer.read_string - end - - public - - # This class represents a libvips image. See the {Vips} module documentation - # for an introduction to using this class. - - class Image < Vips::Object - alias_method :parent_get_typeof, :get_typeof - - # FFI sets a pointer's size to this magic value if the size of the memory - # chunk the pointer points to is unknown to FFI. - UNKNOWN_POINTER_SIZE = FFI::Pointer.new(1).size - private_constant :UNKNOWN_POINTER_SIZE - - private - - # the layout of the VipsImage struct - module ImageLayout - def self.included base - base.class_eval do - layout :parent, Vips::Object::Struct - # rest opaque - end - end - end - - class Struct < Vips::Object::Struct - include ImageLayout - end - - class ManagedStruct < Vips::Object::ManagedStruct - include ImageLayout - end - - class GenericPtr < FFI::Struct - layout :value, :pointer - end - - # handy for overloads ... want to be able to apply a function to an - # array or to a scalar - def self.smap x, &block - x.is_a?(Array) ? x.map { |y| smap(y, &block) } : block.call(x) - end - - def self.complex? format - format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format - Vips.vips_band_format_iscomplex(format_number) != 0 - end - - def self.float? format - format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format - Vips.vips_band_format_isfloat(format_number) != 0 - end - - # run a complex operation on a complex image, or an image with an even - # number of bands ... handy for things like running .polar on .index - # images - def self.run_cmplx image, &block - original_format = image.format - - unless Image.complex? image.format - if image.bands % 2 != 0 - raise Vips::Error, "not an even number of bands" - end - - unless Image.float? image.format - image = image.cast :float - end - - new_format = image.format == :double ? :dpcomplex : :complex - image = image.copy format: new_format, bands: image.bands / 2 - end - - image = block.call(image) - - unless Image.complex? original_format - new_format = image.format == :dpcomplex ? :double : :float - image = image.copy format: new_format, bands: image.bands * 2 - end - - image - end - - # handy for expanding enum operations - def call_enum(name, other, enum) - if other.is_a?(Vips::Image) - Vips::Operation.call name.to_s, [self, other, enum] - else - Vips::Operation.call name.to_s + "_const", [self, enum, other] - end - end - - # Write can fail due to no file descriptors and memory can fill if - # large objects are not collected fairly soon. We can't try a - # write and GC and retry on fail, since the write may take a - # long time and may not be repeatable. - # - # GCing before every write would have a horrible effect on - # performance, so as a compromise we GC every @@gc_interval writes. - # - # ruby2.1 introduced a generational GC which is fast enough to be - # able to GC on every write. - - @@generational_gc = RUBY_ENGINE == "ruby" && RUBY_VERSION.to_f >= 2.1 - - @@gc_interval = 100 - @@gc_countdown = @@gc_interval - - def write_gc - if @@generational_gc - GC.start full_mark: false - else - @@gc_countdown -= 1 - if @@gc_countdown < 0 - @@gc_countdown = @@gc_interval - GC.start - end - end - end - - public - - def inspect - "#" - end - - def respond_to? name, include_all = false - # To support keyword args, we need to tell Ruby that final image - # arguments cannot be hashes of keywords. - # - # https://makandracards.com/makandra/ - # 36013-heads-up-ruby-implicitly-converts-a-hash-to-keyword-arguments - return false if name == :to_hash - - super - end - - def respond_to_missing? name, include_all = false - # respond to all vips operations by nickname - return true if Vips.type_find("VipsOperation", name.to_s) != 0 - - super - end - - def self.respond_to_missing? name, include_all = false - # respond to all vips operations by nickname - return true if Vips.type_find("VipsOperation", name.to_s) != 0 - - super - end - - # Invoke a vips operation with {Vips::Operation.call}, using self as - # the first input argument. - # - # @param name [String] vips operation to call - # @return result of vips operation - def method_missing name, *args, **options - Vips::Operation.call name.to_s, [self, *args], options - end - - # Invoke a vips operation with {Vips::Operation.call}. - def self.method_missing name, *args, **options - Vips::Operation.call name.to_s, args, options - end - - # Return a new {Image} for a file on disc. This method can load - # images in any format supported by vips. The filename can include - # load options, for example: - # - # ``` - # image = Vips::Image.new_from_file "fred.jpg[shrink=2]" - # ``` - # - # You can also supply options as a hash, for example: - # - # ``` - # image = Vips::Image.new_from_file "fred.jpg", shrink: 2 - # ``` - # - # The full set of options available depend upon the load operation that - # will be executed. Try something like: - # - # ``` - # $ vips jpegload - # ``` - # - # at the command-line to see a summary of the available options for the - # JPEG loader. - # - # Loading is fast: only enough of the image is loaded to be able to fill - # out the header. Pixels will only be decompressed when they are needed. - # - # @!macro [new] vips.loadopts - # @param opts [Hash] set of options - # @option opts [Boolean] :disc (true) Open large images via a - # temporary disc file - # @option opts [Vips::Access] :access (:random) Access mode for file - # - # @param name [String] the filename to load from - # @macro vips.loadopts - # @return [Image] the loaded image - def self.new_from_file name, **opts - # very common, and Vips::vips_filename_get_filename will segv if we - # pass this - raise Vips::Error, "filename is nil" if name.nil? - - filename = Vips.p2str(Vips.vips_filename_get_filename(name)) - option_string = Vips.p2str(Vips.vips_filename_get_options(name)) - loader = Vips.vips_foreign_find_load filename - raise Vips::Error if loader.nil? - - Operation.call loader, [filename], opts, option_string - end - - # Create a new {Image} for an image encoded in a format such as - # JPEG in a binary string. Load options may be passed as - # strings or appended as a hash. For example: - # - # ``` - # image = Vips::Image.new_from_buffer memory_buffer, "shrink=2" - # ``` - # - # or alternatively: - # - # ``` - # image = Vips::Image.new_from_buffer memory_buffer, "", shrink: 2 - # ``` - # - # The options available depend on the file format. Try something like: - # - # ``` - # $ vips jpegload_buffer - # ``` - # - # at the command-line to see the available options. Not all loaders - # support load from buffer, but at least JPEG, PNG and - # TIFF images will work. - # - # Loading is fast: only enough of the image is loaded to be able to fill - # out the header. Pixels will only be decompressed when they are needed. - # - # @param data [String] the data to load from - # @param option_string [String] load options as a string - # @macro vips.loadopts - # @return [Image] the loaded image - def self.new_from_buffer data, option_string, **opts - loader = Vips.vips_foreign_find_load_buffer data, data.bytesize - raise Vips::Error if loader.nil? - - Vips::Operation.call loader, [data], opts, option_string - end - - # Create a new {Image} from a C-style array held in memory. For example: - # - # ``` - # image = Vips::Image.black(16, 16) + 128 - # data = image.write_to_memory - # - # x = Vips::Image.new_from_memory data, - # image.width, image.height, image.bands, image.format - # ``` - # - # Creating a new image from a memory pointer: - # - # ``` - # ptr = FFI::MemoryPointer.new(:uchar, 10*10) - # # => # - # x = Vips::Image.new_from_memory(ptr, 10, 10, 1, :uchar) - # ``` - # - # Creating a new image from an address only pointer: - # - # ``` - # ptr = call_to_external_c_library(w: 10, h: 10) - # # => # - # ptr_slice = ptr.slice(0, 10*10) - # # => # - # x = Vips::Image.new_from_memory(ptr_slice, 10, 10, 1, :uchar) - # ``` - # - # {new_from_memory} keeps a reference to the array of pixels you pass in - # to try to prevent that memory from being freed by the Ruby GC while it - # is being used. - # - # See {new_from_memory_copy} for a version of this method which does not - # keep a reference. - # - # @param data [String, FFI::Pointer] the data to load from - # @param width [Integer] width in pixels - # @param height [Integer] height in pixels - # @param bands [Integer] number of bands - # @param format [Symbol] band format - # @return [Image] the loaded image - def self.new_from_memory data, width, height, bands, format - # prevent data from being freed with JRuby FFI - if defined?(JRUBY_VERSION) && !data.is_a?(FFI::Pointer) - data = ::FFI::MemoryPointer.new(:char, data.bytesize).write_bytes data - end - - if data.is_a?(FFI::Pointer) - # A pointer needs to know about the size of the memory it points to. - # If you have an address-only pointer, use the .slice method to wrap - # the pointer in a size aware pointer. - if data.size == UNKNOWN_POINTER_SIZE - raise Vips::Error, "size of memory is unknown" - end - size = data.size - else - size = data.bytesize - end - - format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format - vi = Vips.vips_image_new_from_memory data, size, - width, height, bands, format_number - raise Vips::Error if vi.null? - image = new(vi) - - # keep a secret ref to the underlying object .. this reference will be - # inherited by things that in turn depend on us, so the memory we are - # using will not be freed - image.references << data - - image - end - - # Create a new {Image} from memory and copies the memory area. See - # {new_from_memory} for a version of this method which does not copy the - # memory area. - # - # @param data [String, FFI::Pointer] the data to load from - # @param width [Integer] width in pixels - # @param height [Integer] height in pixels - # @param bands [Integer] number of bands - # @param format [Symbol] band format - # @return [Image] the loaded image - def self.new_from_memory_copy data, width, height, bands, format - format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format - - if data.is_a?(FFI::Pointer) - if data.size == UNKNOWN_POINTER_SIZE - raise Vips::Error, "size of memory is unknown" - end - size = data.size - else - size = data.bytesize - end - - vi = Vips.vips_image_new_from_memory_copy data, size, - width, height, bands, format_number - raise Vips::Error if vi.null? - new(vi) - end - - # Create a new {Image} from a source. Load options may be passed as - # strings or appended as a hash. For example: - # - # ``` - # source = Vips::Source.new_from_file("k2.jpg") - # image = Vips::Image.new_from_source source, "shrink=2" - # ``` - # - # or alternatively: - # - # ``` - # image = Vips::Image.new_from_source source, "", shrink: 2 - # ``` - # - # The options available depend on the file format. Try something like: - # - # ``` - # $ vips jpegload_source - # ``` - # - # at the command-line to see the available options. Not all loaders - # support load from source, but at least JPEG, PNG and - # TIFF images will work. - # - # Loading is fast: only enough data is read to be able to fill - # out the header. Pixels will only be read and decompressed when they are - # needed. - # - # @param source [Vips::Source] the source to load from - # @param option_string [String] load options as a string - # @macro vips.loadopts - # @return [Image] the loaded image - def self.new_from_source source, option_string, **opts - loader = Vips.vips_foreign_find_load_source source - raise Vips::Error if loader.nil? - - Vips::Operation.call loader, [source], opts, option_string - end - - def self.matrix_from_array width, height, array - ptr = FFI::MemoryPointer.new :double, array.length - ptr.write_array_of_double array - image = Vips.vips_image_new_matrix_from_array width, height, - ptr, array.length - Vips::Image.new image - end - - # Create a new Image from a 1D or 2D array. A 1D array becomes an - # image with height 1. Use `scale` and `offset` to set the scale and - # offset fields in the header. These are useful for integer - # convolutions. - # - # For example: - # - # ``` - # image = Vips::Image.new_from_array [1, 2, 3] - # ``` - # - # or - # - # ``` - # image = Vips::Image.new_from_array [ - # [-1, -1, -1], - # [-1, 16, -1], - # [-1, -1, -1]], 8 - # ``` - # - # for a simple sharpening mask. - # - # @param array [Array] the pixel data as an array of numbers - # @param scale [Real] the convolution scale - # @param offset [Real] the convolution offset - # @return [Image] the image - def self.new_from_array array, scale = 1, offset = 0 - # we accept a 1D array and assume height == 1, or a 2D array - # and check all lines are the same length - unless array.is_a? Array - raise Vips::Error, "Argument is not an array." - end - - if array[0].is_a? Array - height = array.length - width = array[0].length - unless array.all? { |x| x.is_a? Array } - raise Vips::Error, "Not a 2D array." - end - unless array.all? { |x| x.length == width } - raise Vips::Error, "Array not rectangular." - end - - array = array.flatten - else - height = 1 - width = array.length - end - - unless array.length == width * height - raise Vips::Error, "Bad array dimensions." - end - - unless array.all? { |x| x.is_a? Numeric } - raise Vips::Error, "Not all array elements are Numeric." - end - - image = Vips::Image.matrix_from_array width, height, array - raise Vips::Error if image.nil? - - image.mutate do |mutable| - # be careful to set them as double - mutable.set_type! GObject::GDOUBLE_TYPE, "scale", scale.to_f - mutable.set_type! GObject::GDOUBLE_TYPE, "offset", offset.to_f - end - end - - # A new image is created with the same width, height, format, - # interpretation, resolution and offset as self, but with every pixel - # set to the specified value. - # - # You can pass an array to make a many-band image, or a single value to - # make a one-band image. - # - # @param value [Real, Array] value to put in each pixel - # @return [Image] constant image - def new_from_image value - pixel = (Vips::Image.black(1, 1) + value).cast(format) - image = pixel.embed 0, 0, width, height, extend: :copy - image.copy interpretation: interpretation, xres: xres, yres: yres, - xoffset: xoffset, yoffset: yoffset - end - - # Write this image to a file. Save options may be encoded in the - # filename or given as a hash. For example: - # - # ``` - # image.write_to_file "fred.jpg[Q=90]" - # ``` - # - # or equivalently: - # - # ``` - # image.write_to_file "fred.jpg", Q: 90 - # ``` - # - # The full set of save options depend on the selected saver. Try - # something like: - # - # ``` - # $ vips jpegsave - # ``` - # - # to see all the available options for JPEG save. - # - # @!macro [new] vips.saveopts - # @param opts [Hash] set of options - # @option opts [Boolean] :strip (false) Strip all metadata from image - # @option opts [Array] :background (0) Background colour to - # flatten alpha against, if necessary - # - # @param name [String] filename to write to - def write_to_file name, **opts - raise Vips::Error, "filename is nil" if name.nil? - - filename = Vips.p2str(Vips.vips_filename_get_filename(name)) - option_string = Vips.p2str(Vips.vips_filename_get_options(name)) - saver = Vips.vips_foreign_find_save filename - raise Vips::Error if saver.nil? - - Vips::Operation.call saver, [self, filename], opts, option_string - - write_gc - end - - # Write this image to a memory buffer. Save options may be encoded in - # the format_string or given as a hash. For example: - # - # ``` - # buffer = image.write_to_buffer ".jpg[Q=90]" - # ``` - # - # or equivalently: - # - # ``` - # image.write_to_buffer ".jpg", Q: 90 - # ``` - # - # The full set of save options depend on the selected saver. Try - # something like: - # - # ``` - # $ vips jpegsave - # ``` - # - # to see all the available options for JPEG save. - # - # @param format_string [String] save format plus options - # @macro vips.saveopts - # @return [String] the image saved in the specified format - def write_to_buffer format_string, **opts - raise Vips::Error, "filename is nil" if format_string.nil? - filename = Vips.p2str(Vips.vips_filename_get_filename(format_string)) - option_string = Vips.p2str(Vips.vips_filename_get_options(format_string)) - saver = Vips.vips_foreign_find_save_buffer filename - raise Vips::Error if saver.nil? - - buffer = Vips::Operation.call saver, [self], opts, option_string - raise Vips::Error if buffer.nil? - - write_gc - - buffer - end - - # Write this image to a target. Save options may be encoded in - # the format_string or given as a hash. For example: - # - # ```ruby - # target = Vips::Target.new_to_file "k2.jpg" - # image.write_to_target target, ".jpg[Q=90]" - # ``` - # - # or equivalently: - # - # ```ruby - # image.write_to_target target, ".jpg", Q: 90 - # ``` - # - # The full set of save options depend on the selected saver. Try - # something like: - # - # ``` - # $ vips jpegsave_target - # ``` - # - # to see all the available options for JPEG save. - # - # @param target [Vips::Target] the target to write to - # @param format_string [String] save format plus string options - # @macro vips.saveopts - def write_to_target target, format_string, **opts - raise Vips::Error, "filename is nil" if format_string.nil? - filename = Vips.p2str(Vips.vips_filename_get_filename(format_string)) - option_string = Vips.p2str(Vips.vips_filename_get_options(format_string)) - saver = Vips.vips_foreign_find_save_target filename - raise Vips::Error if saver.nil? - - Vips::Operation.call saver, [self, target], opts, option_string - write_gc - end - - # Write this image to a large memory buffer. - # - # @return [String] the pixels as a huge binary string - def write_to_memory - len = Vips::SizeStruct.new - ptr = Vips.vips_image_write_to_memory self, len - raise Vips::Error if ptr.nil? - - # wrap up as an autopointer - ptr = FFI::AutoPointer.new(ptr, GLib::G_FREE) - - ptr.get_bytes 0, len[:value] - end - - # Turn progress signalling on and off. - # - # If this is on, the most-downstream image from this image will issue - # progress signals. - # - # @see Object#signal_connect - # @param state [Boolean] progress signalling state - def set_progress state - Vips.vips_image_set_progress self, state - end - - # Kill computation of this time. - # - # Set true to stop computation of this image. You can call this from a - # progress handler, for example. - # - # @see Object#signal_connect - # @param kill [Boolean] stop computation - def set_kill kill - Vips.vips_image_set_kill self, kill - end - - # Get the `GType` of a metadata field. The result is 0 if no such field - # exists. - # - # @see get - # @param name [String] Metadata field to fetch - # @return [Integer] GType - def get_typeof name - # on libvips before 8.5, property types must be searched first, - # since vips_image_get_typeof returned built-in enums as int - unless Vips.at_least_libvips?(8, 5) - gtype = parent_get_typeof name - return gtype if gtype != 0 - end - - Vips.vips_image_get_typeof self, name - end - - # Get a metadata item from an image. Ruby types are constructed - # automatically from the `GValue`, if possible. - # - # For example, you can read the ICC profile from an image like this: - # - # ``` - # profile = image.get "icc-profile-data" - # ``` - # - # and profile will be an array containing the profile. - # - # @param name [String] Metadata field to get - # @return [Object] Value of field - def get name - # with old libvips, we must fetch properties (as opposed to - # metadata) via VipsObject - unless Vips.at_least_libvips?(8, 5) - return super if parent_get_typeof(name) != 0 - end - - gvalue = GObject::GValue.alloc - raise Vips::Error if Vips.vips_image_get(self, name, gvalue) != 0 - result = gvalue.get - gvalue.unset - - result - end - - # Get the names of all fields on an image. Use this to loop over all - # image metadata. - # - # @return [[String]] array of field names - def get_fields - # vips_image_get_fields() was added in libvips 8.5 - return [] unless Vips.respond_to? :vips_image_get_fields - - array = Vips.vips_image_get_fields self - - names = [] - p = array - until (q = p.read_pointer).null? - names << q.read_string - GLib.g_free q - p += FFI::Type::POINTER.size - end - GLib.g_free array - - names - end - - # Mutate an image with a block. Inside the block, you can call methods - # which modify the image, such as setting or removing metadata, or - # modifying pixels. - # - # For example: - # - # ```ruby - # image = image.mutate do |x| - # (0 ... 1).step(0.01) do |i| - # x.draw_line! 255, x.width * i, 0, 0, x.height * (1 - i) - # end - # end - # ``` - # - # See {MutableImage}. - def mutate - mutable = Vips::MutableImage.new self - yield mutable - mutable.image - end - - # This method is deprecated. - # - # Please use {MutableImage#set_type!} instead. - def set_type gtype, name, value - gvalue = GObject::GValue.alloc - gvalue.init gtype - gvalue.set value - Vips.vips_image_set self, name, gvalue - gvalue.unset - end - - # This method is deprecated. - # - # Please use {MutableImage#set!} instead. - def set name, value - set_type get_typeof(name), name, value - end - - # This method is deprecated. - # - # Please use {MutableImage#remove!} instead. - def remove name - Vips.vips_image_remove self, name - end - - # compatibility: old name for get - def get_value name - get name - end - - # This method is deprecated. - # - # Please use {MutableImage#set!} instead. - def set_value name, value - set name, value - end - - # Get image width, in pixels. - # - # @return [Integer] image width, in pixels - def width - Vips.vips_image_get_width self - end - - # Get image height, in pixels. - # - # @return [Integer] image height, in pixels - def height - Vips.vips_image_get_height self - end - - # Get number of image bands. - # - # @return [Integer] number of image bands - def bands - Vips.vips_image_get_bands self - end - - # Get image format. - # - # @return [Symbol] image format - def format - get "format" - end - - # Get image interpretation. - # - # @return [Symbol] image interpretation - def interpretation - get "interpretation" - end - - # Get image coding. - # - # @return [Symbol] image coding - def coding - get "coding" - end - - # Get image filename, if any. - # - # @return [String] image filename - def filename - get "filename" - end - - # Get image xoffset. - # - # @return [Integer] image xoffset - def xoffset - get "xoffset" - end - - # Get image yoffset. - # - # @return [Integer] image yoffset - def yoffset - get "yoffset" - end - - # Get image x resolution. - # - # @return [Float] image x resolution - def xres - get "xres" - end - - # Get image y resolution. - # - # @return [Float] image y resolution - def yres - get "yres" - end - - # Get scale metadata. - # - # @return [Float] image scale - def scale - return 1 if get_typeof("scale") == 0 - - get "scale" - end - - # Get offset metadata. - # - # @return [Float] image offset - def offset - return 0 if get_typeof("offset") == 0 - - get "offset" - end - - # Get the image size. - # - # @return [Integer, Integer] image width and height - def size - [width, height] - end - - if Vips.at_least_libvips?(8, 5) - # Detect if image has an alpha channel - # - # @return [Boolean] true if image has an alpha channel. - def has_alpha? - Vips.vips_image_hasalpha(self) != 0 - end - end - - # vips_addalpha was added in libvips 8.6 - if Vips.at_least_libvips?(8, 6) - # Append an alpha channel to an image. - # - # @return [Image] new image - def add_alpha - ptr = GenericPtr.new - result = Vips.vips_addalpha self, ptr - raise Vips::Error if result != 0 - - Vips::Image.new ptr[:value] - end - end - - # Copy an image to a memory area. - # - # This can be useful for reusing results, but can obviously use a lot of - # memory for large images. See {Image#tilecache} for a way of caching - # parts of an image. - # - # @return [Image] new memory image - def copy_memory - new_image = Vips.vips_image_copy_memory self - Vips::Image.new new_image - end - - # Draw a point on an image. - # - # See {Image#draw_rect}. - # - # @return [Image] modified image - def draw_point ink, left, top, **opts - draw_rect ink, left, top, 1, 1, **opts - end - - # Add an image, constant or array. - # - # @param other [Image, Real, Array] Thing to add to self - # @return [Image] result of addition - def + other - other.is_a?(Vips::Image) ? - add(other) : linear(1, other) - end - - # Subtract an image, constant or array. - # - # @param other [Image, Real, Array] Thing to subtract from self - # @return [Image] result of subtraction - def - other - other.is_a?(Vips::Image) ? - subtract(other) : linear(1, Image.smap(other) { |x| x * -1 }) - end - - # Multiply an image, constant or array. - # - # @param other [Image, Real, Array] Thing to multiply by self - # @return [Image] result of multiplication - def * other - other.is_a?(Vips::Image) ? - multiply(other) : linear(other, 0) - end - - # Divide an image, constant or array. - # - # @param other [Image, Real, Array] Thing to divide self by - # @return [Image] result of division - def / other - other.is_a?(Vips::Image) ? - divide(other) : linear(Image.smap(other) { |x| 1.0 / x }, 0) - end - - # Remainder after integer division with an image, constant or array. - # - # @param other [Image, Real, Array] self modulo this - # @return [Image] result of modulo - def % other - other.is_a?(Vips::Image) ? - remainder(other) : remainder_const(other) - end - - # Raise to power of an image, constant or array. - # - # @param other [Image, Real, Array] self to the power of this - # @return [Image] result of power - def ** other - call_enum "math2", other, :pow - end - - # Integer left shift with an image, constant or array. - # - # @param other [Image, Real, Array] shift left by this much - # @return [Image] result of left shift - def << other - call_enum "boolean", other, :lshift - end - - # Integer right shift with an image, constant or array. - # - # @param other [Image, Real, Array] shift right by this much - # @return [Image] result of right shift - def >> other - call_enum "boolean", other, :rshift - end - - # Integer bitwise OR with an image, constant or array. - # - # @param other [Image, Real, Array] bitwise OR with this - # @return [Image] result of bitwise OR - def | other - call_enum "boolean", other, :or - end - - # Integer bitwise AND with an image, constant or array. - # - # @param other [Image, Real, Array] bitwise AND with this - # @return [Image] result of bitwise AND - def & other - call_enum "boolean", other, :and - end - - # Integer bitwise EOR with an image, constant or array. - # - # @param other [Image, Real, Array] bitwise EOR with this - # @return [Image] result of bitwise EOR - def ^ other - call_enum "boolean", other, :eor - end - - # Equivalent to image ^ -1 - # - # @return [Image] image with bits flipped - def ! - self ^ -1 - end - - # Equivalent to image ^ -1 - # - # @return [Image] image with bits flipped - def ~ - self ^ -1 - end - - # @return [Image] image - def +@ - self - end - - # Equivalent to image * -1 - # - # @return [Image] negative of image - def -@ - self * -1 - end - - # Relational less than with an image, constant or array. - # - # @param other [Image, Real, Array] relational less than with this - # @return [Image] result of less than - def < other - call_enum "relational", other, :less - end - - # Relational less than or equal to with an image, constant or array. - # - # @param other [Image, Real, Array] relational less than or - # equal to with this - # @return [Image] result of less than or equal to - def <= other - call_enum "relational", other, :lesseq - end - - # Relational more than with an image, constant or array. - # - # @param other [Image, Real, Array] relational more than with this - # @return [Image] result of more than - def > other - call_enum "relational", other, :more - end - - # Relational more than or equal to with an image, constant or array. - # - # @param other [Image, Real, Array] relational more than or - # equal to with this - # @return [Image] result of more than or equal to - def >= other - call_enum "relational", other, :moreeq - end - - # Compare equality to nil, an image, constant or array. - # - # @param other [nil, Image, Real, Array] test equality to this - # @return [Image] result of equality - def == other - # for equality, we must allow tests against nil - if other.nil? - false - else - call_enum "relational", other, :equal - end - end - - # Compare inequality to nil, an image, constant or array. - # - # @param other [nil, Image, Real, Array] test inequality to this - # @return [Image] result of inequality - def != other - # for equality, we must allow tests against nil - if other.nil? - true - else - call_enum "relational", other, :noteq - end - end - - # Fetch bands using a number or a range - # - # @param index [Numeric, Range] extract these band(s) - # @return [Image] extracted band(s) - def [] index - if index.is_a? Range - n = index.size - extract_band index.begin, n: n - elsif index.is_a? Numeric - extract_band index - else - raise Vips::Error, "[] index is not range or numeric." - end - end - - # Convert to an Enumerator. Similar to `#to_a` but lazier. - # - # @return [Enumerator] Enumerator of Enumerators of Arrays of Numerics - def to_enum - # make the template for unpack - template = { - char: "c", - uchar: "C", - short: "s_", - ushort: "S_", - int: "i_", - uint: "I_", - float: "f", - double: "d", - complex: "f", - dpcomplex: "d" - }[format] + "*" - - # we render the image to a big string, then unpack into - # one-dimensional array as a Ruby array of the correct type - array = write_to_memory.unpack template - - # gather bands of a pixel together - pixel_array = array.each_slice bands - - # gather pixels of a row together - pixel_array.each_slice width - end - - # Convert to an Array. This will be slow for large images. - # - # @return [Array] Array of Arrays of Arrays of Numerics - def to_a - to_enum.to_a - end - - # Return the largest integral value not greater than the argument. - # - # @return [Image] floor of image - def floor - round :floor - end - - # Return the smallest integral value not less than the argument. - # - # @return [Image] ceil of image - def ceil - round :ceil - end - - # Return the nearest integral value. - # - # @return [Image] rint of image - def rint - round :rint - end - - # AND the bands of an image together - # - # @return [Image] all bands ANDed together - def bandand - bandbool :and - end - - # OR the bands of an image together - # - # @return [Image] all bands ORed together - def bandor - bandbool :or - end - - # EOR the bands of an image together - # - # @return [Image] all bands EORed together - def bandeor - bandbool :eor - end - - # Split an n-band image into n separate images. - # - # @return [Array] Array of n one-band images - def bandsplit - (0...bands).map { |i| extract_band i } - end - - # Join a set of images bandwise. - # - # @param other [Image, Array, Real, Array] bands to append - # @return [Image] many band image - def bandjoin other - unless other.is_a? Array - other = [other] - end - - # if other is just Numeric, we can use bandjoin_const - not_all_real = !other.all? { |x| x.is_a? Numeric } - - if not_all_real - Vips::Image.bandjoin([self] + other) - else - bandjoin_const other - end - end - - # Composite a set of images with a set of blend modes. - # - # @param overlay [Image, Array] images to composite - # @param mode [BlendMode, Array] blend modes to use - # @param opts [Hash] Set of options - # @option opts [Array] :x x positions of overlay - # @option opts [Array] :y y positions of overlay - # @option opts [Vips::Interpretation] :compositing_space Composite images - # in this colour space - # @option opts [Boolean] :premultiplied Images have premultiplied alpha - # @return [Image] blended image - def composite overlay, mode, **opts - unless overlay.is_a? Array - overlay = [overlay] - end - unless mode.is_a? Array - mode = [mode] - end - - mode = mode.map do |x| - GObject::GValue.from_nick Vips::BLEND_MODE_TYPE, x - end - - Vips::Image.composite([self] + overlay, mode, **opts) - end - - # Return the coordinates of the image maximum. - # - # @return [Real, Real, Real] maximum value, x coordinate of maximum, y - # coordinate of maximum - def maxpos - v, opts = max x: true, y: true - x = opts["x"] - y = opts["y"] - [v, x, y] - end - - # Return the coordinates of the image minimum. - # - # @return [Real, Real, Real] minimum value, x coordinate of minimum, y - # coordinate of minimum - def minpos - v, opts = min x: true, y: true - x = opts["x"] - y = opts["y"] - [v, x, y] - end - - # a median filter - # - # @param size [Integer] size of filter window - # @return [Image] result of median filter - def median size = 3 - rank size, size, size**2 / 2 - end - - # Return the real part of a complex image. - # - # @return [Image] real part of complex image - def real - complexget :real - end - - # Return the imaginary part of a complex image. - # - # @return [Image] imaginary part of complex image - def imag - complexget :imag - end - - # Return an image with rectangular pixels converted to polar. - # - # The image - # can be complex, in which case the return image will also be complex, - # or must have an even number of bands, in which case pairs of - # bands are treated as (x, y) coordinates. - # - # @see xyz - # @return [Image] image converted to polar coordinates - def polar - Image.run_cmplx(self) { |x| x.complex :polar } - end - - # Return an image with polar pixels converted to rectangular. - # - # The image - # can be complex, in which case the return image will also be complex, - # or must have an even number of bands, in which case pairs of - # bands are treated as (x, y) coordinates. - # - # @see xyz - # @return [Image] image converted to rectangular coordinates - def rect - Image.run_cmplx(self) { |x| x.complex :rect } - end - - # Return the complex conjugate of an image. - # - # The image - # can be complex, in which case the return image will also be complex, - # or must have an even number of bands, in which case pairs of - # bands are treated as (x, y) coordinates. - # - # @return [Image] complex conjugate - def conj - Image.run_cmplx(self) { |x| x.complex :conj } - end - - # Calculate the cross phase of two images. - # - # @param other [Image, Real, Array] cross phase with this - # @return [Image] cross phase - def cross_phase other - complex2 other, :cross_phase - end - - # Return the sine of an image in degrees. - # - # @return [Image] sine of each pixel - def sin - math :sin - end - - # Return the cosine of an image in degrees. - # - # @return [Image] cosine of each pixel - def cos - math :cos - end - - # Return the tangent of an image in degrees. - # - # @return [Image] tangent of each pixel - def tan - math :tan - end - - # Return the inverse sine of an image in degrees. - # - # @return [Image] inverse sine of each pixel - def asin - math :asin - end - - # Return the inverse cosine of an image in degrees. - # - # @return [Image] inverse cosine of each pixel - def acos - math :acos - end - - # Return the inverse tangent of an image in degrees. - # - # @return [Image] inverse tangent of each pixel - def atan - math :atan - end - - # Return the natural log of an image. - # - # @return [Image] natural log of each pixel - def log - math :log - end - - # Return the log base 10 of an image. - # - # @return [Image] base 10 log of each pixel - def log10 - math :log10 - end - - # Return e ** pixel. - # - # @return [Image] e ** pixel - def exp - math :exp - end - - # Return 10 ** pixel. - # - # @return [Image] 10 ** pixel - def exp10 - math :exp10 - end - - # Flip horizontally. - # - # @return [Image] image flipped horizontally - def fliphor - flip :horizontal - end - - # Flip vertically. - # - # @return [Image] image flipped vertically - def flipver - flip :vertical - end - - # Erode with a structuring element. - # - # The structuring element must be an array with 0 for black, 255 for - # white and 128 for don't care. - # - # @param mask [Image, Array, Array>] structuring - # element - # @return [Image] eroded image - def erode mask - morph mask, :erode - end - - # Dilate with a structuring element. - # - # The structuring element must be an array with 0 for black, 255 for - # white and 128 for don't care. - # - # @param mask [Image, Array, Array>] structuring - # element - # @return [Image] dilated image - def dilate mask - morph mask, :dilate - end - - # Rotate by 90 degrees clockwise. - # - # @return [Image] rotated image - def rot90 - rot :d90 - end - - # Rotate by 180 degrees clockwise. - # - # @return [Image] rotated image - def rot180 - rot :d180 - end - - # Rotate by 270 degrees clockwise. - # - # @return [Image] rotated image - def rot270 - rot :d270 - end - - # Select pixels from `th` if `self` is non-zero and from `el` if - # `self` is zero. Use the `:blend` option to fade smoothly - # between `th` and `el`. - # - # @param th [Image, Real, Array] true values - # @param el [Image, Real, Array] false values - # @param opts [Hash] set of options - # @option opts [Boolean] :blend (false) Blend smoothly between th and el - # @return [Image] merged image - def ifthenelse(th, el, **opts) - match_image = [th, el, self].find { |x| x.is_a? Vips::Image } - - unless th.is_a? Vips::Image - th = Operation.imageize match_image, th - end - unless el.is_a? Vips::Image - el = Operation.imageize match_image, el - end - - Vips::Operation.call "ifthenelse", [self, th, el], opts - end - - # Scale an image to uchar. This is the vips `scale` operation, but - # renamed to avoid a clash with the `.scale` property. - # - # @param opts [Hash] Set of options - # @return [Vips::Image] Output image - def scaleimage **opts - Vips::Image.scale self, **opts - end - end -end - -module Vips - # This module generates yard comments for all the dynamically bound - # vips operations. - # - # Regenerate with something like: - # - # ``` - # $ ruby > methods.rb - # require "vips"; Vips::Yard.generate - # ^D - # ``` - - module Yard - # map gobject's type names to Ruby - MAP_GO_TO_RUBY = { - "gboolean" => "Boolean", - "gint" => "Integer", - "gdouble" => "Float", - "gfloat" => "Float", - "gchararray" => "String", - "VipsImage" => "Vips::Image", - "VipsInterpolate" => "Vips::Interpolate", - "VipsConnection" => "Vips::Connection", - "VipsSource" => "Vips::Source", - "VipsTarget" => "Vips::Target", - "VipsSourceCustom" => "Vips::SourceCustom", - "VipsTargetCustom" => "Vips::TargetCustom", - "VipsArrayDouble" => "Array", - "VipsArrayInt" => "Array", - "VipsArrayImage" => "Array", - "VipsArrayString" => "Array" - } - - # these have hand-written methods, see above - NO_GENERATE = ["scale", "bandjoin", "composite", "ifthenelse"] - - # these are aliased (appear under several names) - ALIAS = ["crop"] - - # turn a gtype into a ruby type name - def self.gtype_to_ruby gtype - fundamental = GObject.g_type_fundamental gtype - type_name = GObject.g_type_name gtype - - if MAP_GO_TO_RUBY.include? type_name - type_name = MAP_GO_TO_RUBY[type_name] - end - - if fundamental == GObject::GFLAGS_TYPE || - fundamental == GObject::GENUM_TYPE - type_name = "Vips::" + type_name[/Vips(.*)/, 1] - end - - type_name - end - - def self.generate_operation introspect - return if (introspect.flags & OPERATION_DEPRECATED) != 0 - return if NO_GENERATE.include? introspect.name - - method_args = introspect.method_args - required_output = introspect.required_output - optional_input = introspect.optional_input - optional_output = introspect.optional_output - - print "# @!method " - print "self." unless introspect.member_x - print "#{introspect.name}(" - print method_args.map { |x| x[:yard_name] }.join(", ") - print ", " if method_args.length > 0 - puts "**opts)" - - puts "# #{introspect.description.capitalize}." - - method_args.each do |details| - yard_name = details[:yard_name] - gtype = details[:gtype] - blurb = details[:blurb] - - puts "# @param #{yard_name} [#{gtype_to_ruby(gtype)}] #{blurb}" - end - - puts "# @param opts [Hash] Set of options" - optional_input.each do |arg_name, details| - yard_name = details[:yard_name] - gtype = details[:gtype] - blurb = details[:blurb] - - puts "# @option opts [#{gtype_to_ruby(gtype)}] :#{yard_name} #{blurb}" - end - optional_output.each do |arg_name, details| - yard_name = details[:yard_name] - gtype = details[:gtype] - blurb = details[:blurb] - - print "# @option opts [#{gtype_to_ruby(gtype)}] :#{yard_name}" - puts " Output #{blurb}" - end - - print "# @return [" - if required_output.length == 0 - print "nil" - elsif required_output.length == 1 - print gtype_to_ruby(required_output.first[:gtype]) - else - print "Array<" - print required_output.map { |x| gtype_to_ruby(x[:gtype]) }.join(", ") - print ">" - end - if optional_output.length > 0 - print ", Hash Object>" - end - print "] " - print required_output.map { |x| x[:blurb] }.join(", ") - if optional_output.length > 0 - print ", " if required_output.length > 0 - print "Hash of optional output items" - end - puts "" - - puts "" - end - - def self.generate - alias_gtypes = {} - ALIAS.each do |name| - gtype = Vips.type_find "VipsOperation", name - alias_gtypes[gtype] = name - end - - generate_class = lambda do |gtype, _| - name = if alias_gtypes.key? gtype - alias_gtypes[gtype] - else - Vips.nickname_find gtype - end - - if name - begin - # can fail for abstract types - introspect = Vips::Introspect.get_yard name - rescue Vips::Error - nil - end - - generate_operation(introspect) if introspect - end - - Vips.vips_type_map gtype, generate_class, nil - end - - puts "module Vips" - puts " class Image" - puts "" - - generate_class.call(GObject.g_type_from_name("VipsOperation"), nil) - - puts " end" - puts "end" - end - end -end diff --git a/lib/vips/interesting.rb b/lib/vips/interesting.rb deleted file mode 100644 index 53631d08..00000000 --- a/lib/vips/interesting.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Vips - # Pick the algorithm vips uses to decide image "interestingness". This is - # used by {Image#smartcrop}, for example, to decide what parts of the image - # to keep. - # - # * `:none` do nothing - # * `:centre` just take the centre - # * `:entropy` use an entropy measure - # * `:attention` look for features likely to draw human attention - - class Interesting < Symbol - end -end diff --git a/lib/vips/interpolate.rb b/lib/vips/interpolate.rb deleted file mode 100644 index 7897a5e9..00000000 --- a/lib/vips/interpolate.rb +++ /dev/null @@ -1,58 +0,0 @@ -module Vips - attach_function :vips_interpolate_new, [:string], :pointer - - # An interpolator. One of these can be given to operations like - # {Image#affine} or {Image#mapim} to select the type of pixel interpolation - # to use. - # - # To see all interpolators supported by your - # libvips, try - # - # ``` - # $ vips -l interpolate - # ``` - # - # But at least these should be available: - # - # * `:nearest` Nearest-neighbour interpolation. - # * `:bilinear` Bilinear interpolation. - # * `:bicubic` Bicubic interpolation. - # * `:lbb` Reduced halo bicubic interpolation. - # * `:nohalo` Edge sharpening resampler with halo reduction. - # * `:vsqbs` B-Splines with antialiasing smoothing. - # - # For example: - # - # ```ruby - # im = im.affine [2, 0, 0, 2], - # :interpolate => Vips::Interpolate.new(:bicubic) - # ``` - - class Interpolate < Vips::Object - # the layout of the VipsInterpolate struct - module InterpolateLayout - def self.included base - base.class_eval do - layout :parent, Vips::Object::Struct - # rest opaque - end - end - end - - class Struct < Vips::Object::Struct - include InterpolateLayout - end - - class ManagedStruct < Vips::Object::ManagedStruct - include InterpolateLayout - end - - def initialize name - name = name.to_s if name.is_a? Symbol - ptr = Vips.vips_interpolate_new name - raise Vips::Error if ptr.nil? - - super ptr - end - end -end diff --git a/lib/vips/interpretation.rb b/lib/vips/interpretation.rb deleted file mode 100644 index 96f314eb..00000000 --- a/lib/vips/interpretation.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Vips - # How the values in an image should be interpreted. For example, a - # three-band float image of type :lab should have its - # pixels interpreted as coordinates in CIE Lab space. - # - # * `:multiband` generic many-band image - # * `:b_w` some kind of single-band image - # * `:histogram` a 1D image, eg. histogram or lookup table - # * `:fourier` image is in fourier space - # * `:xyz` the first three bands are CIE XYZ - # * `:lab` pixels are in CIE Lab space - # * `:cmyk` the first four bands are in CMYK space - # * `:labq` implies #VIPS_CODING_LABQ - # * `:rgb` generic RGB space - # * `:cmc` a uniform colourspace based on CMC(1:1) - # * `:lch` pixels are in CIE LCh space - # * `:labs` CIE LAB coded as three signed 16-bit values - # * `:srgb` pixels are sRGB - # * `:hsv` pixels are HSV - # * `:scrgb` pixels are scRGB - # * `:yxy` pixels are CIE Yxy - # * `:rgb16` generic 16-bit RGB - # * `:grey16` generic 16-bit mono - # * `:matrix` a matrix - class Interpretation < Symbol - end -end diff --git a/lib/vips/kernel.rb b/lib/vips/kernel.rb deleted file mode 100644 index 5c7a5137..00000000 --- a/lib/vips/kernel.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Vips - # A resizing kernel. One of these can be given to operations like - # {Image#reduceh} or {Image#resize} to select the resizing kernel to use. - # - # At least these should be available: - # - # * `:nearest` Nearest-neighbour interpolation. - # * `:linear` Linear interpolation. - # * `:cubic` Cubic interpolation. - # * `:lanczos2` Two-lobe Lanczos - # * `:lanczos3` Three-lobe Lanczos - # - # For example: - # - # ```ruby - # im = im.resize 3, :kernel => :lanczos2 - # ``` - - class Kernel < Symbol - end -end diff --git a/lib/vips/methods.rb b/lib/vips/methods.rb deleted file mode 100644 index 77261483..00000000 --- a/lib/vips/methods.rb +++ /dev/null @@ -1,2992 +0,0 @@ -module Vips - class Image - -# @!method self.system(cmd_format, **opts) -# Run an external command. -# @param cmd_format [String] Command to run -# @param opts [Hash] Set of options -# @option opts [Array] :im Array of input images -# @option opts [String] :out_format Format for output filename -# @option opts [String] :in_format Format for input filename -# @option opts [Vips::Image] :out Output Output image -# @option opts [String] :log Output Command log -# @return [nil, Hash Object>] Hash of optional output items - -# @!method add(right, **opts) -# Add two images. -# @param right [Vips::Image] Right-hand image argument -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method subtract(right, **opts) -# Subtract two images. -# @param right [Vips::Image] Right-hand image argument -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method multiply(right, **opts) -# Multiply two images. -# @param right [Vips::Image] Right-hand image argument -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method divide(right, **opts) -# Divide two images. -# @param right [Vips::Image] Right-hand image argument -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method relational(right, relational, **opts) -# Relational operation on two images. -# @param right [Vips::Image] Right-hand image argument -# @param relational [Vips::OperationRelational] relational to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method remainder(right, **opts) -# Remainder after integer division of two images. -# @param right [Vips::Image] Right-hand image argument -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method boolean(right, boolean, **opts) -# Boolean operation on two images. -# @param right [Vips::Image] Right-hand image argument -# @param boolean [Vips::OperationBoolean] boolean to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method math2(right, math2, **opts) -# Binary math operations. -# @param right [Vips::Image] Right-hand image argument -# @param math2 [Vips::OperationMath2] math to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method complex2(right, cmplx, **opts) -# Complex binary operations on two images. -# @param right [Vips::Image] Right-hand image argument -# @param cmplx [Vips::OperationComplex2] binary complex operation to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method complexform(right, **opts) -# Form a complex image from two real images. -# @param right [Vips::Image] Right-hand image argument -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method self.sum(im, **opts) -# Sum an array of images. -# @param im [Array] Array of input images -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method invert(**opts) -# Invert an image. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method linear(a, b, **opts) -# Calculate (a * in + b). -# @param a [Array] Multiply by this -# @param b [Array] Add this -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output should be uchar -# @return [Vips::Image] Output image - -# @!method math(math, **opts) -# Apply a math operation to an image. -# @param math [Vips::OperationMath] math to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method abs(**opts) -# Absolute value of an image. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method sign(**opts) -# Unit vector of pixel. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method round(round, **opts) -# Perform a round function on an image. -# @param round [Vips::OperationRound] rounding operation to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method relational_const(relational, c, **opts) -# Relational operations against a constant. -# @param relational [Vips::OperationRelational] relational to perform -# @param c [Array] Array of constants -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method remainder_const(c, **opts) -# Remainder after integer division of an image and a constant. -# @param c [Array] Array of constants -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method boolean_const(boolean, c, **opts) -# Boolean operations against a constant. -# @param boolean [Vips::OperationBoolean] boolean to perform -# @param c [Array] Array of constants -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method math2_const(math2, c, **opts) -# Binary math operations with a constant. -# @param math2 [Vips::OperationMath2] math to perform -# @param c [Array] Array of constants -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method complex(cmplx, **opts) -# Perform a complex operation on an image. -# @param cmplx [Vips::OperationComplex] complex to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method complexget(get, **opts) -# Get a component from a complex image. -# @param get [Vips::OperationComplexget] complex to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method avg(**opts) -# Find image average. -# @param opts [Hash] Set of options -# @return [Float] Output value - -# @!method min(**opts) -# Find image minimum. -# @param opts [Hash] Set of options -# @option opts [Integer] :size Number of minimum values to find -# @option opts [Integer] :x Output Horizontal position of minimum -# @option opts [Integer] :y Output Vertical position of minimum -# @option opts [Array] :out_array Output Array of output values -# @option opts [Array] :x_array Output Array of horizontal positions -# @option opts [Array] :y_array Output Array of vertical positions -# @return [Float, Hash Object>] Output value, Hash of optional output items - -# @!method max(**opts) -# Find image maximum. -# @param opts [Hash] Set of options -# @option opts [Integer] :size Number of maximum values to find -# @option opts [Integer] :x Output Horizontal position of maximum -# @option opts [Integer] :y Output Vertical position of maximum -# @option opts [Array] :out_array Output Array of output values -# @option opts [Array] :x_array Output Array of horizontal positions -# @option opts [Array] :y_array Output Array of vertical positions -# @return [Float, Hash Object>] Output value, Hash of optional output items - -# @!method deviate(**opts) -# Find image standard deviation. -# @param opts [Hash] Set of options -# @return [Float] Output value - -# @!method stats(**opts) -# Find many image stats. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output array of statistics - -# @!method hist_find(**opts) -# Find image histogram. -# @param opts [Hash] Set of options -# @option opts [Integer] :band Find histogram of band -# @return [Vips::Image] Output histogram - -# @!method hist_find_ndim(**opts) -# Find n-dimensional image histogram. -# @param opts [Hash] Set of options -# @option opts [Integer] :bins Number of bins in each dimension -# @return [Vips::Image] Output histogram - -# @!method hist_find_indexed(index, **opts) -# Find indexed image histogram. -# @param index [Vips::Image] Index image -# @param opts [Hash] Set of options -# @option opts [Vips::Combine] :combine Combine bins like this -# @return [Vips::Image] Output histogram - -# @!method hough_line(**opts) -# Find hough line transform. -# @param opts [Hash] Set of options -# @option opts [Integer] :width horizontal size of parameter space -# @option opts [Integer] :height Vertical size of parameter space -# @return [Vips::Image] Output image - -# @!method hough_circle(**opts) -# Find hough circle transform. -# @param opts [Hash] Set of options -# @option opts [Integer] :scale Scale down dimensions by this factor -# @option opts [Integer] :min_radius Smallest radius to search for -# @option opts [Integer] :max_radius Largest radius to search for -# @return [Vips::Image] Output image - -# @!method project(**opts) -# Find image projections. -# @param opts [Hash] Set of options -# @return [Array] Sums of columns, Sums of rows - -# @!method profile(**opts) -# Find image profiles. -# @param opts [Hash] Set of options -# @return [Array] First non-zero pixel in column, First non-zero pixel in row - -# @!method measure(h, v, **opts) -# Measure a set of patches on a color chart. -# @param h [Integer] Number of patches across chart -# @param v [Integer] Number of patches down chart -# @param opts [Hash] Set of options -# @option opts [Integer] :left Left edge of extract area -# @option opts [Integer] :top Top edge of extract area -# @option opts [Integer] :width Width of extract area -# @option opts [Integer] :height Height of extract area -# @return [Vips::Image] Output array of statistics - -# @!method getpoint(x, y, **opts) -# Read a point from an image. -# @param x [Integer] Point to read -# @param y [Integer] Point to read -# @param opts [Hash] Set of options -# @return [Array] Array of output values - -# @!method find_trim(**opts) -# Search an image for non-edge areas. -# @param opts [Hash] Set of options -# @option opts [Float] :threshold Object threshold -# @option opts [Array] :background Color for background pixels -# @return [Array] Left edge of image, Top edge of extract area, Width of extract area, Height of extract area - -# @!method copy(**opts) -# Copy an image. -# @param opts [Hash] Set of options -# @option opts [Boolean] :swap Swap bytes in image between little and big-endian -# @option opts [Integer] :width Image width in pixels -# @option opts [Integer] :height Image height in pixels -# @option opts [Integer] :bands Number of bands in image -# @option opts [Vips::BandFormat] :format Pixel format in image -# @option opts [Vips::Coding] :coding Pixel coding -# @option opts [Vips::Interpretation] :interpretation Pixel interpretation -# @option opts [Float] :xres Horizontal resolution in pixels/mm -# @option opts [Float] :yres Vertical resolution in pixels/mm -# @option opts [Integer] :xoffset Horizontal offset of origin -# @option opts [Integer] :yoffset Vertical offset of origin -# @return [Vips::Image] Output image - -# @!method tilecache(**opts) -# Cache an image as a set of tiles. -# @param opts [Hash] Set of options -# @option opts [Integer] :tile_width Tile width in pixels -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Integer] :max_tiles Maximum number of tiles to cache -# @option opts [Vips::Access] :access Expected access pattern -# @option opts [Boolean] :threaded Allow threaded access -# @option opts [Boolean] :persistent Keep cache between evaluations -# @return [Vips::Image] Output image - -# @!method linecache(**opts) -# Cache an image as a set of lines. -# @param opts [Hash] Set of options -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Vips::Access] :access Expected access pattern -# @option opts [Boolean] :threaded Allow threaded access -# @option opts [Boolean] :persistent Keep cache between evaluations -# @return [Vips::Image] Output image - -# @!method sequential(**opts) -# Check sequential access. -# @param opts [Hash] Set of options -# @option opts [Boolean] :trace trace pixel requests -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Vips::Access] :access Expected access pattern -# @return [Vips::Image] Output image - -# @!method cache(**opts) -# Cache an image. -# @param opts [Hash] Set of options -# @option opts [Integer] :max_tiles Maximum number of tiles to cache -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Integer] :tile_width Tile width in pixels -# @return [Vips::Image] Output image - -# @!method embed(x, y, width, height, **opts) -# Embed an image in a larger image. -# @param x [Integer] Left edge of input in output -# @param y [Integer] Top edge of input in output -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Vips::Extend] :extend How to generate the extra pixels -# @option opts [Array] :background Color for background pixels -# @return [Vips::Image] Output image - -# @!method gravity(direction, width, height, **opts) -# Place an image within a larger image with a certain gravity. -# @param direction [Vips::CompassDirection] direction to place image within width/height -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Vips::Extend] :extend How to generate the extra pixels -# @option opts [Array] :background Color for background pixels -# @return [Vips::Image] Output image - -# @!method flip(direction, **opts) -# Flip an image. -# @param direction [Vips::Direction] Direction to flip image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method insert(sub, x, y, **opts) -# Insert image @sub into @main at @x, @y. -# @param sub [Vips::Image] Sub-image to insert into main image -# @param x [Integer] Left edge of sub in main -# @param y [Integer] Top edge of sub in main -# @param opts [Hash] Set of options -# @option opts [Boolean] :expand Expand output to hold all of both inputs -# @option opts [Array] :background Color for new pixels -# @return [Vips::Image] Output image - -# @!method join(in2, direction, **opts) -# Join a pair of images. -# @param in2 [Vips::Image] Second input image -# @param direction [Vips::Direction] Join left-right or up-down -# @param opts [Hash] Set of options -# @option opts [Boolean] :expand Expand output to hold all of both inputs -# @option opts [Integer] :shim Pixels between images -# @option opts [Array] :background Colour for new pixels -# @option opts [Vips::Align] :align Align on the low, centre or high coordinate edge -# @return [Vips::Image] Output image - -# @!method self.arrayjoin(im, **opts) -# Join an array of images. -# @param im [Array] Array of input images -# @param opts [Hash] Set of options -# @option opts [Integer] :across Number of images across grid -# @option opts [Integer] :shim Pixels between images -# @option opts [Array] :background Colour for new pixels -# @option opts [Vips::Align] :halign Align on the left, centre or right -# @option opts [Vips::Align] :valign Align on the top, centre or bottom -# @option opts [Integer] :hspacing Horizontal spacing between images -# @option opts [Integer] :vspacing Vertical spacing between images -# @return [Vips::Image] Output image - -# @!method extract_area(left, top, width, height, **opts) -# Extract an area from an image. -# @param left [Integer] Left edge of extract area -# @param top [Integer] Top edge of extract area -# @param width [Integer] Width of extract area -# @param height [Integer] Height of extract area -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method crop(left, top, width, height, **opts) -# Extract an area from an image. -# @param left [Integer] Left edge of extract area -# @param top [Integer] Top edge of extract area -# @param width [Integer] Width of extract area -# @param height [Integer] Height of extract area -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method smartcrop(width, height, **opts) -# Extract an area from an image. -# @param width [Integer] Width of extract area -# @param height [Integer] Height of extract area -# @param opts [Hash] Set of options -# @option opts [Vips::Interesting] :interesting How to measure interestingness -# @return [Vips::Image] Output image - -# @!method extract_band(band, **opts) -# Extract band from an image. -# @param band [Integer] Band to extract -# @param opts [Hash] Set of options -# @option opts [Integer] :n Number of bands to extract -# @return [Vips::Image] Output image - -# @!method bandjoin_const(c, **opts) -# Append a constant band to an image. -# @param c [Array] Array of constants to add -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method self.bandrank(im, **opts) -# Band-wise rank of a set of images. -# @param im [Array] Array of input images -# @param opts [Hash] Set of options -# @option opts [Integer] :index Select this band element from sorted list -# @return [Vips::Image] Output image - -# @!method bandmean(**opts) -# Band-wise average. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method bandbool(boolean, **opts) -# Boolean operation across image bands. -# @param boolean [Vips::OperationBoolean] boolean to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method replicate(across, down, **opts) -# Replicate an image. -# @param across [Integer] Repeat this many times horizontally -# @param down [Integer] Repeat this many times vertically -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method cast(format, **opts) -# Cast an image. -# @param format [Vips::BandFormat] Format to cast to -# @param opts [Hash] Set of options -# @option opts [Boolean] :shift Shift integer values up and down -# @return [Vips::Image] Output image - -# @!method rot(angle, **opts) -# Rotate an image. -# @param angle [Vips::Angle] Angle to rotate image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method rot45(**opts) -# Rotate an image. -# @param opts [Hash] Set of options -# @option opts [Vips::Angle45] :angle Angle to rotate image -# @return [Vips::Image] Output image - -# @!method autorot(**opts) -# Autorotate image by exif tag. -# @param opts [Hash] Set of options -# @option opts [Vips::Angle] :angle Output Angle image was rotated by -# @option opts [Boolean] :flip Output Whether the image was flipped or not -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method recomb(m, **opts) -# Linear recombination with matrix. -# @param m [Vips::Image] matrix of coefficients -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method bandfold(**opts) -# Fold up x axis into bands. -# @param opts [Hash] Set of options -# @option opts [Integer] :factor Fold by this factor -# @return [Vips::Image] Output image - -# @!method bandunfold(**opts) -# Unfold image bands into x axis. -# @param opts [Hash] Set of options -# @option opts [Integer] :factor Unfold by this factor -# @return [Vips::Image] Output image - -# @!method flatten(**opts) -# Flatten alpha out of an image. -# @param opts [Hash] Set of options -# @option opts [Array] :background Background value -# @option opts [Float] :max_alpha Maximum value of alpha channel -# @return [Vips::Image] Output image - -# @!method premultiply(**opts) -# Premultiply image alpha. -# @param opts [Hash] Set of options -# @option opts [Float] :max_alpha Maximum value of alpha channel -# @return [Vips::Image] Output image - -# @!method unpremultiply(**opts) -# Unpremultiply image alpha. -# @param opts [Hash] Set of options -# @option opts [Float] :max_alpha Maximum value of alpha channel -# @option opts [Integer] :alpha_band Unpremultiply with this alpha -# @return [Vips::Image] Output image - -# @!method grid(tile_height, across, down, **opts) -# Grid an image. -# @param tile_height [Integer] chop into tiles this high -# @param across [Integer] number of tiles across -# @param down [Integer] number of tiles down -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method transpose3d(**opts) -# Transpose3d an image. -# @param opts [Hash] Set of options -# @option opts [Integer] :page_height Height of each input page -# @return [Vips::Image] Output image - -# @!method wrap(**opts) -# Wrap image origin. -# @param opts [Hash] Set of options -# @option opts [Integer] :x Left edge of input in output -# @option opts [Integer] :y Top edge of input in output -# @return [Vips::Image] Output image - -# @!method zoom(xfac, yfac, **opts) -# Zoom an image. -# @param xfac [Integer] Horizontal zoom factor -# @param yfac [Integer] Vertical zoom factor -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method subsample(xfac, yfac, **opts) -# Subsample an image. -# @param xfac [Integer] Horizontal subsample factor -# @param yfac [Integer] Vertical subsample factor -# @param opts [Hash] Set of options -# @option opts [Boolean] :point Point sample -# @return [Vips::Image] Output image - -# @!method msb(**opts) -# Pick most-significant byte from an image. -# @param opts [Hash] Set of options -# @option opts [Integer] :band Band to msb -# @return [Vips::Image] Output image - -# @!method byteswap(**opts) -# Byteswap an image. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method falsecolour(**opts) -# False-color an image. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method gamma(**opts) -# Gamma an image. -# @param opts [Hash] Set of options -# @option opts [Float] :exponent Gamma factor -# @return [Vips::Image] Output image - -# @!method composite2(overlay, mode, **opts) -# Blend a pair of images with a blend mode. -# @param overlay [Vips::Image] Overlay image -# @param mode [Vips::BlendMode] VipsBlendMode to join with -# @param opts [Hash] Set of options -# @option opts [Integer] :x x position of overlay -# @option opts [Integer] :y y position of overlay -# @option opts [Vips::Interpretation] :compositing_space Composite images in this colour space -# @option opts [Boolean] :premultiplied Images have premultiplied alpha -# @return [Vips::Image] Output image - -# @!method self.black(width, height, **opts) -# Make a black image. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Integer] :bands Number of bands in image -# @return [Vips::Image] Output image - -# @!method self.gaussnoise(width, height, **opts) -# Make a gaussnoise image. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Float] :sigma Standard deviation of pixels in generated image -# @option opts [Float] :mean Mean of pixels in generated image -# @option opts [Integer] :seed Random number seed -# @return [Vips::Image] Output image - -# @!method self.xyz(width, height, **opts) -# Make an image where pixel values are coordinates. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Integer] :csize Size of third dimension -# @option opts [Integer] :dsize Size of fourth dimension -# @option opts [Integer] :esize Size of fifth dimension -# @return [Vips::Image] Output image - -# @!method self.gaussmat(sigma, min_ampl, **opts) -# Make a gaussian image. -# @param sigma [Float] Sigma of Gaussian -# @param min_ampl [Float] Minimum amplitude of Gaussian -# @param opts [Hash] Set of options -# @option opts [Boolean] :separable Generate separable Gaussian -# @option opts [Boolean] :integer Generate integer Gaussian -# @option opts [Vips::Precision] :precision Generate with this precision -# @return [Vips::Image] Output image - -# @!method self.logmat(sigma, min_ampl, **opts) -# Make a laplacian of gaussian image. -# @param sigma [Float] Radius of Logmatian -# @param min_ampl [Float] Minimum amplitude of Logmatian -# @param opts [Hash] Set of options -# @option opts [Boolean] :separable Generate separable Logmatian -# @option opts [Boolean] :integer Generate integer Logmatian -# @option opts [Vips::Precision] :precision Generate with this precision -# @return [Vips::Image] Output image - -# @!method self.text(text, **opts) -# Make a text image. -# @param text [String] Text to render -# @param opts [Hash] Set of options -# @option opts [String] :font Font to render with -# @option opts [Integer] :width Maximum image width in pixels -# @option opts [Integer] :height Maximum image height in pixels -# @option opts [Vips::Align] :align Align on the low, centre or high edge -# @option opts [Boolean] :rgba Enable RGBA output -# @option opts [Integer] :dpi DPI to render at -# @option opts [Boolean] :justify Justify lines -# @option opts [Integer] :spacing Line spacing -# @option opts [String] :fontfile Load this font file -# @option opts [Integer] :autofit_dpi Output DPI selected by autofit -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.eye(width, height, **opts) -# Make an image showing the eye's spatial response. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Float] :factor Maximum spatial frequency -# @return [Vips::Image] Output image - -# @!method self.grey(width, height, **opts) -# Make a grey ramp image. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @return [Vips::Image] Output image - -# @!method self.zone(width, height, **opts) -# Make a zone plate. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @return [Vips::Image] Output image - -# @!method self.sines(width, height, **opts) -# Make a 2d sine wave. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Float] :hfreq Horizontal spatial frequency -# @option opts [Float] :vfreq Vertical spatial frequency -# @return [Vips::Image] Output image - -# @!method self.mask_ideal(width, height, frequency_cutoff, **opts) -# Make an ideal filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param frequency_cutoff [Float] Frequency cutoff -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_ideal_ring(width, height, frequency_cutoff, ringwidth, **opts) -# Make an ideal ring filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param frequency_cutoff [Float] Frequency cutoff -# @param ringwidth [Float] Ringwidth -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_ideal_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, **opts) -# Make an ideal band filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param frequency_cutoff_x [Float] Frequency cutoff x -# @param frequency_cutoff_y [Float] Frequency cutoff y -# @param radius [Float] radius of circle -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_butterworth(width, height, order, frequency_cutoff, amplitude_cutoff, **opts) -# Make a butterworth filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param order [Float] Filter order -# @param frequency_cutoff [Float] Frequency cutoff -# @param amplitude_cutoff [Float] Amplitude cutoff -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_butterworth_ring(width, height, order, frequency_cutoff, amplitude_cutoff, ringwidth, **opts) -# Make a butterworth ring filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param order [Float] Filter order -# @param frequency_cutoff [Float] Frequency cutoff -# @param amplitude_cutoff [Float] Amplitude cutoff -# @param ringwidth [Float] Ringwidth -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_butterworth_band(width, height, order, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, **opts) -# Make a butterworth_band filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param order [Float] Filter order -# @param frequency_cutoff_x [Float] Frequency cutoff x -# @param frequency_cutoff_y [Float] Frequency cutoff y -# @param radius [Float] radius of circle -# @param amplitude_cutoff [Float] Amplitude cutoff -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_gaussian(width, height, frequency_cutoff, amplitude_cutoff, **opts) -# Make a gaussian filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param frequency_cutoff [Float] Frequency cutoff -# @param amplitude_cutoff [Float] Amplitude cutoff -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_gaussian_ring(width, height, frequency_cutoff, amplitude_cutoff, ringwidth, **opts) -# Make a gaussian ring filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param frequency_cutoff [Float] Frequency cutoff -# @param amplitude_cutoff [Float] Amplitude cutoff -# @param ringwidth [Float] Ringwidth -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_gaussian_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, **opts) -# Make a gaussian filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param frequency_cutoff_x [Float] Frequency cutoff x -# @param frequency_cutoff_y [Float] Frequency cutoff y -# @param radius [Float] radius of circle -# @param amplitude_cutoff [Float] Amplitude cutoff -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method self.mask_fractal(width, height, fractal_dimension, **opts) -# Make fractal filter. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param fractal_dimension [Float] Fractal dimension -# @param opts [Hash] Set of options -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Boolean] :nodc Remove DC component -# @option opts [Boolean] :reject Invert the sense of the filter -# @option opts [Boolean] :optical Rotate quadrants to optical space -# @return [Vips::Image] Output image - -# @!method buildlut(**opts) -# Build a look-up table. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method invertlut(**opts) -# Build an inverted look-up table. -# @param opts [Hash] Set of options -# @option opts [Integer] :size LUT size to generate -# @return [Vips::Image] Output image - -# @!method self.tonelut(**opts) -# Build a look-up table. -# @param opts [Hash] Set of options -# @option opts [Integer] :in_max Size of LUT to build -# @option opts [Integer] :out_max Maximum value in output LUT -# @option opts [Float] :Lb Lowest value in output -# @option opts [Float] :Lw Highest value in output -# @option opts [Float] :Ps Position of shadow -# @option opts [Float] :Pm Position of mid-tones -# @option opts [Float] :Ph Position of highlights -# @option opts [Float] :S Adjust shadows by this much -# @option opts [Float] :M Adjust mid-tones by this much -# @option opts [Float] :H Adjust highlights by this much -# @return [Vips::Image] Output image - -# @!method self.identity(**opts) -# Make a 1d image where pixel values are indexes. -# @param opts [Hash] Set of options -# @option opts [Integer] :bands Number of bands in LUT -# @option opts [Boolean] :ushort Create a 16-bit LUT -# @option opts [Integer] :size Size of 16-bit LUT -# @return [Vips::Image] Output image - -# @!method self.fractsurf(width, height, fractal_dimension, **opts) -# Make a fractal surface. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param fractal_dimension [Float] Fractal dimension -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method self.worley(width, height, **opts) -# Make a worley noise image. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Integer] :cell_size Size of Worley cells -# @option opts [Integer] :seed Random number seed -# @return [Vips::Image] Output image - -# @!method self.perlin(width, height, **opts) -# Make a perlin noise image. -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param opts [Hash] Set of options -# @option opts [Integer] :cell_size Size of Perlin cells -# @option opts [Boolean] :uchar Output an unsigned char image -# @option opts [Integer] :seed Random number seed -# @return [Vips::Image] Output image - -# @!method self.switch(tests, **opts) -# Find the index of the first non-zero pixel in tests. -# @param tests [Array] Table of images to test -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method self.csvload(filename, **opts) -# Load csv. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :skip Skip this many lines at the start of the file -# @option opts [Integer] :lines Read this many lines from the file -# @option opts [String] :whitespace Set of whitespace characters -# @option opts [String] :separator Set of separator characters -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.csvload_source(source, **opts) -# Load csv. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :skip Skip this many lines at the start of the file -# @option opts [Integer] :lines Read this many lines from the file -# @option opts [String] :whitespace Set of whitespace characters -# @option opts [String] :separator Set of separator characters -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.matrixload(filename, **opts) -# Load matrix. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.matrixload_source(source, **opts) -# Load matrix. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.rawload(filename, width, height, bands, **opts) -# Load raw data from a file. -# @param filename [String] Filename to load from -# @param width [Integer] Image width in pixels -# @param height [Integer] Image height in pixels -# @param bands [Integer] Number of bands in image -# @param opts [Hash] Set of options -# @option opts [guint64] :offset Offset in bytes from start of file -# @option opts [Vips::BandFormat] :format Pixel format in image -# @option opts [Vips::Interpretation] :interpretation Pixel interpretation -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.vipsload(filename, **opts) -# Load vips from file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.vipsload_source(source, **opts) -# Load vips from source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.analyzeload(filename, **opts) -# Load an analyze6 image. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.ppmload(filename, **opts) -# Load ppm from file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.ppmload_source(source, **opts) -# Load ppm base class. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.radload(filename, **opts) -# Load a radiance image from a file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.radload_buffer(buffer, **opts) -# Load rad from buffer. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.radload_source(source, **opts) -# Load rad from source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.svgload(filename, **opts) -# Load svg with rsvg. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Float] :dpi Render at this DPI -# @option opts [Float] :scale Scale output by this factor -# @option opts [Boolean] :unlimited Allow SVG of any size -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.svgload_buffer(buffer, **opts) -# Load svg with rsvg. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Float] :dpi Render at this DPI -# @option opts [Float] :scale Scale output by this factor -# @option opts [Boolean] :unlimited Allow SVG of any size -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.svgload_source(source, **opts) -# Load svg from source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Float] :dpi Render at this DPI -# @option opts [Float] :scale Scale output by this factor -# @option opts [Boolean] :unlimited Allow SVG of any size -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jxlload(filename, **opts) -# Load jpeg-xl image. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jxlload_buffer(buffer, **opts) -# Load jpeg-xl image. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jxlload_source(source, **opts) -# Load jpeg-xl image. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jp2kload(filename, **opts) -# Load jpeg2000 image. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the image -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jp2kload_buffer(buffer, **opts) -# Load jpeg2000 image. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the image -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jp2kload_source(source, **opts) -# Load jpeg2000 image. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the image -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.gifload(filename, **opts) -# Load gif with libnsgif. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :n Load this many pages -# @option opts [Integer] :page Load this page from the file -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.gifload_buffer(buffer, **opts) -# Load gif with libnsgif. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :n Load this many pages -# @option opts [Integer] :page Load this page from the file -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.gifload_source(source, **opts) -# Load gif from source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :n Load this many pages -# @option opts [Integer] :page Load this page from the file -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.pngload(filename, **opts) -# Load png from file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.pngload_buffer(buffer, **opts) -# Load png from buffer. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.pngload_source(source, **opts) -# Load png from source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.matload(filename, **opts) -# Load mat from file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jpegload(filename, **opts) -# Load jpeg from file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :shrink Shrink factor on load -# @option opts [Boolean] :autorotate Rotate image using exif orientation -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jpegload_buffer(buffer, **opts) -# Load jpeg from buffer. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :shrink Shrink factor on load -# @option opts [Boolean] :autorotate Rotate image using exif orientation -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.jpegload_source(source, **opts) -# Load image from jpeg source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :shrink Shrink factor on load -# @option opts [Boolean] :autorotate Rotate image using exif orientation -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.webpload(filename, **opts) -# Load webp from file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Float] :scale Scale factor on load -# @option opts [Integer] :shrink Shrink factor on load -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.webpload_buffer(buffer, **opts) -# Load webp from buffer. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Float] :scale Scale factor on load -# @option opts [Integer] :shrink Shrink factor on load -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.webpload_source(source, **opts) -# Load webp from source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Float] :scale Scale factor on load -# @option opts [Integer] :shrink Shrink factor on load -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.tiffload(filename, **opts) -# Load tiff from file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the image -# @option opts [Integer] :subifd Select subifd index -# @option opts [Integer] :n Load this many pages -# @option opts [Boolean] :autorotate Rotate image using orientation tag -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.tiffload_buffer(buffer, **opts) -# Load tiff from buffer. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the image -# @option opts [Integer] :subifd Select subifd index -# @option opts [Integer] :n Load this many pages -# @option opts [Boolean] :autorotate Rotate image using orientation tag -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.tiffload_source(source, **opts) -# Load tiff from source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the image -# @option opts [Integer] :subifd Select subifd index -# @option opts [Integer] :n Load this many pages -# @option opts [Boolean] :autorotate Rotate image using orientation tag -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.fitsload(filename, **opts) -# Load a fits image. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.fitsload_source(source, **opts) -# Load fits from a source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.openexrload(filename, **opts) -# Load an openexr image. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.niftiload(filename, **opts) -# Load nifti volume. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.niftiload_source(source, **opts) -# Load nifti volumes. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.openslideload(filename, **opts) -# Load file with openslide. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :attach_associated Attach all associated images -# @option opts [Integer] :level Load this level from the file -# @option opts [Boolean] :autocrop Crop to image bounds -# @option opts [String] :associated Load this associated image -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.openslideload_source(source, **opts) -# Load source with openslide. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :attach_associated Attach all associated images -# @option opts [Integer] :level Load this level from the file -# @option opts [Boolean] :autocrop Crop to image bounds -# @option opts [String] :associated Load this associated image -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.heifload(filename, **opts) -# Load a heif image. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Boolean] :thumbnail Fetch thumbnail image -# @option opts [Boolean] :autorotate Rotate image using exif orientation -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.heifload_buffer(buffer, **opts) -# Load a heif image. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Boolean] :thumbnail Fetch thumbnail image -# @option opts [Boolean] :autorotate Rotate image using exif orientation -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.heifload_source(source, **opts) -# Load a heif image. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Boolean] :thumbnail Fetch thumbnail image -# @option opts [Boolean] :autorotate Rotate image using exif orientation -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.pdfload(filename, **opts) -# Load pdf from file. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Float] :dpi Render at this DPI -# @option opts [Float] :scale Scale output by this factor -# @option opts [Array] :background Background value -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.pdfload_buffer(buffer, **opts) -# Load pdf from buffer. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Float] :dpi Render at this DPI -# @option opts [Float] :scale Scale output by this factor -# @option opts [Array] :background Background value -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.pdfload_source(source, **opts) -# Load pdf from source. -# @param source [Vips::Source] Source to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Float] :dpi Render at this DPI -# @option opts [Float] :scale Scale output by this factor -# @option opts [Array] :background Background value -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.magickload(filename, **opts) -# Load file with imagemagick. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :all_frames Read all frames from an image -# @option opts [String] :density Canvas resolution for rendering vector formats like SVG -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method self.magickload_buffer(buffer, **opts) -# Load buffer with imagemagick. -# @param buffer [VipsBlob] Buffer to load from -# @param opts [Hash] Set of options -# @option opts [Boolean] :all_frames Read all frames from an image -# @option opts [String] :density Canvas resolution for rendering vector formats like SVG -# @option opts [Integer] :page Load this page from the file -# @option opts [Integer] :n Load this many pages -# @option opts [Boolean] :memory Force open via memory -# @option opts [Vips::Access] :access Required access pattern for this file -# @option opts [Boolean] :sequential Sequential read only -# @option opts [Boolean] :fail Fail on first error -# @option opts [Boolean] :disc Open to disc -# @option opts [Vips::ForeignFlags] :flags Output Flags for this file -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method csvsave(filename, **opts) -# Save image to csv. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [String] :separator Separator characters -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method csvsave_target(target, **opts) -# Save image to csv. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [String] :separator Separator characters -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method matrixsave(filename, **opts) -# Save image to matrix. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method matrixsave_target(target, **opts) -# Save image to matrix. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method matrixprint(**opts) -# Print matrix. -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method rawsave(filename, **opts) -# Save image to raw file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method rawsave_fd(fd, **opts) -# Write raw image to file descriptor. -# @param fd [Integer] File descriptor to write to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method vipssave(filename, **opts) -# Save image to file in vips format. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method vipssave_target(target, **opts) -# Save image to target in vips format. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method ppmsave(filename, **opts) -# Save image to ppm file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :ascii save as ascii -# @option opts [Boolean] :squash save as one bit -# @option opts [Integer] :bitdepth set to 1 to write as a 1 bit image -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method ppmsave_target(target, **opts) -# Save to ppm. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :ascii save as ascii -# @option opts [Boolean] :squash save as one bit -# @option opts [Integer] :bitdepth set to 1 to write as a 1 bit image -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method radsave(filename, **opts) -# Save image to radiance file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method radsave_buffer(**opts) -# Save image to radiance buffer. -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method radsave_target(target, **opts) -# Save image to radiance target. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method jxlsave(filename, **opts) -# Save image in jpeg-xl format. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :tier Decode speed tier -# @option opts [Float] :distance Target butteraugli distance -# @option opts [Integer] :effort Encoding effort -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Integer] :Q Quality factor -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method jxlsave_buffer(**opts) -# Save image in jpeg-xl format. -# @param opts [Hash] Set of options -# @option opts [Integer] :tier Decode speed tier -# @option opts [Float] :distance Target butteraugli distance -# @option opts [Integer] :effort Encoding effort -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Integer] :Q Quality factor -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method jxlsave_target(target, **opts) -# Save image in jpeg-xl format. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :tier Decode speed tier -# @option opts [Float] :distance Target butteraugli distance -# @option opts [Integer] :effort Encoding effort -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Integer] :Q Quality factor -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method jp2ksave(filename, **opts) -# Save image in jpeg2000 format. -# @param filename [String] Filename to load from -# @param opts [Hash] Set of options -# @option opts [Integer] :tile_width Tile width in pixels -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Integer] :Q Q factor -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method jp2ksave_buffer(**opts) -# Save image in jpeg2000 format. -# @param opts [Hash] Set of options -# @option opts [Integer] :tile_width Tile width in pixels -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Integer] :Q Q factor -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method jp2ksave_target(target, **opts) -# Save image in jpeg2000 format. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :tile_width Tile width in pixels -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Integer] :Q Q factor -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method dzsave(filename, **opts) -# Save image to deepzoom file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [String] :dirname Directory name to save to -# @option opts [String] :basename Base name to save to -# @option opts [Vips::ForeignDzLayout] :layout Directory layout -# @option opts [String] :suffix Filename suffix for tiles -# @option opts [Integer] :overlap Tile overlap in pixels -# @option opts [Integer] :tile_size Tile size in pixels -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Integer] :tile_width Tile width in pixels -# @option opts [Boolean] :centre Center image in tile -# @option opts [Vips::ForeignDzDepth] :depth Pyramid depth -# @option opts [Vips::Angle] :angle Rotate image during save -# @option opts [Vips::ForeignDzContainer] :container Pyramid container type -# @option opts [Boolean] :properties Write a properties file to the output directory -# @option opts [Integer] :compression ZIP deflate compression level -# @option opts [Vips::RegionShrink] :region_shrink Method to shrink regions -# @option opts [Integer] :skip_blanks Skip tiles which are nearly equal to the background -# @option opts [Boolean] :no_strip Don't strip tile metadata -# @option opts [String] :id Resource ID -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method dzsave_buffer(**opts) -# Save image to dz buffer. -# @param opts [Hash] Set of options -# @option opts [String] :dirname Directory name to save to -# @option opts [String] :basename Base name to save to -# @option opts [Vips::ForeignDzLayout] :layout Directory layout -# @option opts [String] :suffix Filename suffix for tiles -# @option opts [Integer] :overlap Tile overlap in pixels -# @option opts [Integer] :tile_size Tile size in pixels -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Integer] :tile_width Tile width in pixels -# @option opts [Boolean] :centre Center image in tile -# @option opts [Vips::ForeignDzDepth] :depth Pyramid depth -# @option opts [Vips::Angle] :angle Rotate image during save -# @option opts [Vips::ForeignDzContainer] :container Pyramid container type -# @option opts [Boolean] :properties Write a properties file to the output directory -# @option opts [Integer] :compression ZIP deflate compression level -# @option opts [Vips::RegionShrink] :region_shrink Method to shrink regions -# @option opts [Integer] :skip_blanks Skip tiles which are nearly equal to the background -# @option opts [Boolean] :no_strip Don't strip tile metadata -# @option opts [String] :id Resource ID -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method pngsave(filename, **opts) -# Save image to png file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :compression Compression factor -# @option opts [Boolean] :interlace Interlace image -# @option opts [String] :profile ICC profile to embed -# @option opts [Vips::ForeignPngFilter] :filter libpng row filter flag(s) -# @option opts [Boolean] :palette Quantise to 8bpp palette -# @option opts [Integer] :colours Max number of palette colours -# @option opts [Integer] :Q Quantisation quality -# @option opts [Float] :dither Amount of dithering -# @option opts [Integer] :bitdepth Write as a 1, 2, 4 or 8 bit image -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method pngsave_buffer(**opts) -# Save image to png buffer. -# @param opts [Hash] Set of options -# @option opts [Integer] :compression Compression factor -# @option opts [Boolean] :interlace Interlace image -# @option opts [String] :profile ICC profile to embed -# @option opts [Vips::ForeignPngFilter] :filter libpng row filter flag(s) -# @option opts [Boolean] :palette Quantise to 8bpp palette -# @option opts [Integer] :colours Max number of palette colours -# @option opts [Integer] :Q Quantisation quality -# @option opts [Float] :dither Amount of dithering -# @option opts [Integer] :bitdepth Write as a 1, 2, 4 or 8 bit image -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method pngsave_target(target, **opts) -# Save image to target as png. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :compression Compression factor -# @option opts [Boolean] :interlace Interlace image -# @option opts [String] :profile ICC profile to embed -# @option opts [Vips::ForeignPngFilter] :filter libpng row filter flag(s) -# @option opts [Boolean] :palette Quantise to 8bpp palette -# @option opts [Integer] :colours Max number of palette colours -# @option opts [Integer] :Q Quantisation quality -# @option opts [Float] :dither Amount of dithering -# @option opts [Integer] :bitdepth Write as a 1, 2, 4 or 8 bit image -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method jpegsave(filename, **opts) -# Save image to jpeg file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :optimize_coding Compute optimal Huffman coding tables -# @option opts [Boolean] :interlace Generate an interlaced (progressive) jpeg -# @option opts [Boolean] :no_subsample Disable chroma subsample -# @option opts [Boolean] :trellis_quant Apply trellis quantisation to each 8x8 block -# @option opts [Boolean] :overshoot_deringing Apply overshooting to samples with extreme values -# @option opts [Boolean] :optimize_scans Split spectrum of DCT coefficients into separate scans -# @option opts [Integer] :quant_table Use predefined quantization table with given index -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method jpegsave_buffer(**opts) -# Save image to jpeg buffer. -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :optimize_coding Compute optimal Huffman coding tables -# @option opts [Boolean] :interlace Generate an interlaced (progressive) jpeg -# @option opts [Boolean] :no_subsample Disable chroma subsample -# @option opts [Boolean] :trellis_quant Apply trellis quantisation to each 8x8 block -# @option opts [Boolean] :overshoot_deringing Apply overshooting to samples with extreme values -# @option opts [Boolean] :optimize_scans Split spectrum of DCT coefficients into separate scans -# @option opts [Integer] :quant_table Use predefined quantization table with given index -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method jpegsave_target(target, **opts) -# Save image to jpeg target. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :optimize_coding Compute optimal Huffman coding tables -# @option opts [Boolean] :interlace Generate an interlaced (progressive) jpeg -# @option opts [Boolean] :no_subsample Disable chroma subsample -# @option opts [Boolean] :trellis_quant Apply trellis quantisation to each 8x8 block -# @option opts [Boolean] :overshoot_deringing Apply overshooting to samples with extreme values -# @option opts [Boolean] :optimize_scans Split spectrum of DCT coefficients into separate scans -# @option opts [Integer] :quant_table Use predefined quantization table with given index -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method jpegsave_mime(**opts) -# Save image to jpeg mime. -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :optimize_coding Compute optimal Huffman coding tables -# @option opts [Boolean] :interlace Generate an interlaced (progressive) jpeg -# @option opts [Boolean] :no_subsample Disable chroma subsample -# @option opts [Boolean] :trellis_quant Apply trellis quantisation to each 8x8 block -# @option opts [Boolean] :overshoot_deringing Apply overshooting to samples with extreme values -# @option opts [Boolean] :optimize_scans Split spectrum of DCT coefficients into separate scans -# @option opts [Integer] :quant_table Use predefined quantization table with given index -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method webpsave(filename, **opts) -# Save image to webp file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [Boolean] :lossless enable lossless compression -# @option opts [Vips::ForeignWebpPreset] :preset Preset for lossy compression -# @option opts [Boolean] :smart_subsample Enable high quality chroma subsampling -# @option opts [Boolean] :near_lossless Enable preprocessing in lossless mode (uses Q) -# @option opts [Integer] :alpha_q Change alpha plane fidelity for lossy compression -# @option opts [Boolean] :min_size Optimise for minium size -# @option opts [Integer] :kmin Minimum number of frames between key frames -# @option opts [Integer] :kmax Maximum number of frames between key frames -# @option opts [Integer] :reduction_effort Level of CPU effort to reduce file size -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method webpsave_buffer(**opts) -# Save image to webp buffer. -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [Boolean] :lossless enable lossless compression -# @option opts [Vips::ForeignWebpPreset] :preset Preset for lossy compression -# @option opts [Boolean] :smart_subsample Enable high quality chroma subsampling -# @option opts [Boolean] :near_lossless Enable preprocessing in lossless mode (uses Q) -# @option opts [Integer] :alpha_q Change alpha plane fidelity for lossy compression -# @option opts [Boolean] :min_size Optimise for minium size -# @option opts [Integer] :kmin Minimum number of frames between key frames -# @option opts [Integer] :kmax Maximum number of frames between key frames -# @option opts [Integer] :reduction_effort Level of CPU effort to reduce file size -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method webpsave_target(target, **opts) -# Save image to webp target. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [Boolean] :lossless enable lossless compression -# @option opts [Vips::ForeignWebpPreset] :preset Preset for lossy compression -# @option opts [Boolean] :smart_subsample Enable high quality chroma subsampling -# @option opts [Boolean] :near_lossless Enable preprocessing in lossless mode (uses Q) -# @option opts [Integer] :alpha_q Change alpha plane fidelity for lossy compression -# @option opts [Boolean] :min_size Optimise for minium size -# @option opts [Integer] :kmin Minimum number of frames between key frames -# @option opts [Integer] :kmax Maximum number of frames between key frames -# @option opts [Integer] :reduction_effort Level of CPU effort to reduce file size -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method tiffsave(filename, **opts) -# Save image to tiff file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Vips::ForeignTiffCompression] :compression Compression for this file -# @option opts [Integer] :Q Q factor -# @option opts [Vips::ForeignTiffPredictor] :predictor Compression prediction -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :tile Write a tiled tiff -# @option opts [Integer] :tile_width Tile width in pixels -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Boolean] :pyramid Write a pyramidal tiff -# @option opts [Boolean] :squash Squash images down to 1 bit -# @option opts [Boolean] :miniswhite Use 0 for white in 1-bit images -# @option opts [Integer] :bitdepth Write as a 1, 2, 4 or 8 bit image -# @option opts [Vips::ForeignTiffResunit] :resunit Resolution unit -# @option opts [Float] :xres Horizontal resolution in pixels/mm -# @option opts [Float] :yres Vertical resolution in pixels/mm -# @option opts [Boolean] :bigtiff Write a bigtiff image -# @option opts [Boolean] :rgbjpeg Output RGB JPEG rather than YCbCr -# @option opts [Boolean] :properties Write a properties document to IMAGEDESCRIPTION -# @option opts [Vips::RegionShrink] :region_shrink Method to shrink regions -# @option opts [Integer] :level ZSTD compression level -# @option opts [Boolean] :lossless Enable WEBP lossless mode -# @option opts [Vips::ForeignDzDepth] :depth Pyramid depth -# @option opts [Boolean] :subifd Save pyr layers as sub-IFDs -# @option opts [Boolean] :premultiply Save with premultiplied alpha -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method tiffsave_buffer(**opts) -# Save image to tiff buffer. -# @param opts [Hash] Set of options -# @option opts [Vips::ForeignTiffCompression] :compression Compression for this file -# @option opts [Integer] :Q Q factor -# @option opts [Vips::ForeignTiffPredictor] :predictor Compression prediction -# @option opts [String] :profile ICC profile to embed -# @option opts [Boolean] :tile Write a tiled tiff -# @option opts [Integer] :tile_width Tile width in pixels -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Boolean] :pyramid Write a pyramidal tiff -# @option opts [Boolean] :squash Squash images down to 1 bit -# @option opts [Boolean] :miniswhite Use 0 for white in 1-bit images -# @option opts [Integer] :bitdepth Write as a 1, 2, 4 or 8 bit image -# @option opts [Vips::ForeignTiffResunit] :resunit Resolution unit -# @option opts [Float] :xres Horizontal resolution in pixels/mm -# @option opts [Float] :yres Vertical resolution in pixels/mm -# @option opts [Boolean] :bigtiff Write a bigtiff image -# @option opts [Boolean] :rgbjpeg Output RGB JPEG rather than YCbCr -# @option opts [Boolean] :properties Write a properties document to IMAGEDESCRIPTION -# @option opts [Vips::RegionShrink] :region_shrink Method to shrink regions -# @option opts [Integer] :level ZSTD compression level -# @option opts [Boolean] :lossless Enable WEBP lossless mode -# @option opts [Vips::ForeignDzDepth] :depth Pyramid depth -# @option opts [Boolean] :subifd Save pyr layers as sub-IFDs -# @option opts [Boolean] :premultiply Save with premultiplied alpha -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method fitssave(filename, **opts) -# Save image to fits file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method niftisave(filename, **opts) -# Save image to nifti file. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method heifsave(filename, **opts) -# Save image in heif format. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Vips::ForeignHeifCompression] :compression Compression format -# @option opts [Integer] :speed CPU effort -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method heifsave_buffer(**opts) -# Save image in heif format. -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Vips::ForeignHeifCompression] :compression Compression format -# @option opts [Integer] :speed CPU effort -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method heifsave_target(target, **opts) -# Save image in heif format. -# @param target [Vips::Target] Target to save to -# @param opts [Hash] Set of options -# @option opts [Integer] :Q Q factor -# @option opts [Boolean] :lossless Enable lossless compression -# @option opts [Vips::ForeignHeifCompression] :compression Compression format -# @option opts [Integer] :speed CPU effort -# @option opts [Vips::ForeignSubsample] :subsample_mode Select chroma subsample operation mode -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method magicksave(filename, **opts) -# Save file with imagemagick. -# @param filename [String] Filename to save to -# @param opts [Hash] Set of options -# @option opts [String] :format Format to save in -# @option opts [Integer] :quality Quality to use -# @option opts [Boolean] :optimize_gif_frames Apply GIF frames optimization -# @option opts [Boolean] :optimize_gif_transparency Apply GIF transparency optimization -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [nil] - -# @!method magicksave_buffer(**opts) -# Save image to magick buffer. -# @param opts [Hash] Set of options -# @option opts [String] :format Format to save in -# @option opts [Integer] :quality Quality to use -# @option opts [Boolean] :optimize_gif_frames Apply GIF frames optimization -# @option opts [Boolean] :optimize_gif_transparency Apply GIF transparency optimization -# @option opts [Boolean] :strip Strip all metadata from image -# @option opts [Array] :background Background value -# @option opts [Integer] :page_height Set page height for multipage save -# @return [VipsBlob] Buffer to save to - -# @!method self.thumbnail(filename, width, **opts) -# Generate thumbnail from file. -# @param filename [String] Filename to read from -# @param width [Integer] Size to this width -# @param opts [Hash] Set of options -# @option opts [Integer] :height Size to this height -# @option opts [Vips::Size] :size Only upsize, only downsize, or both -# @option opts [Boolean] :no_rotate Don't use orientation tags to rotate image upright -# @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop -# @option opts [Boolean] :linear Reduce in linear light -# @option opts [String] :import_profile Fallback import profile -# @option opts [String] :export_profile Fallback export profile -# @option opts [Vips::Intent] :intent Rendering intent -# @option opts [Boolean] :auto_rotate Use orientation tags to rotate image upright -# @return [Vips::Image] Output image - -# @!method self.thumbnail_buffer(buffer, width, **opts) -# Generate thumbnail from buffer. -# @param buffer [VipsBlob] Buffer to load from -# @param width [Integer] Size to this width -# @param opts [Hash] Set of options -# @option opts [String] :option_string Options that are passed on to the underlying loader -# @option opts [Integer] :height Size to this height -# @option opts [Vips::Size] :size Only upsize, only downsize, or both -# @option opts [Boolean] :no_rotate Don't use orientation tags to rotate image upright -# @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop -# @option opts [Boolean] :linear Reduce in linear light -# @option opts [String] :import_profile Fallback import profile -# @option opts [String] :export_profile Fallback export profile -# @option opts [Vips::Intent] :intent Rendering intent -# @option opts [Boolean] :auto_rotate Use orientation tags to rotate image upright -# @return [Vips::Image] Output image - -# @!method thumbnail_image(width, **opts) -# Generate thumbnail from image. -# @param width [Integer] Size to this width -# @param opts [Hash] Set of options -# @option opts [Integer] :height Size to this height -# @option opts [Vips::Size] :size Only upsize, only downsize, or both -# @option opts [Boolean] :no_rotate Don't use orientation tags to rotate image upright -# @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop -# @option opts [Boolean] :linear Reduce in linear light -# @option opts [String] :import_profile Fallback import profile -# @option opts [String] :export_profile Fallback export profile -# @option opts [Vips::Intent] :intent Rendering intent -# @option opts [Boolean] :auto_rotate Use orientation tags to rotate image upright -# @return [Vips::Image] Output image - -# @!method self.thumbnail_source(source, width, **opts) -# Generate thumbnail from source. -# @param source [Vips::Source] Source to load from -# @param width [Integer] Size to this width -# @param opts [Hash] Set of options -# @option opts [String] :option_string Options that are passed on to the underlying loader -# @option opts [Integer] :height Size to this height -# @option opts [Vips::Size] :size Only upsize, only downsize, or both -# @option opts [Boolean] :no_rotate Don't use orientation tags to rotate image upright -# @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop -# @option opts [Boolean] :linear Reduce in linear light -# @option opts [String] :import_profile Fallback import profile -# @option opts [String] :export_profile Fallback export profile -# @option opts [Vips::Intent] :intent Rendering intent -# @option opts [Boolean] :auto_rotate Use orientation tags to rotate image upright -# @return [Vips::Image] Output image - -# @!method mapim(index, **opts) -# Resample with a map image. -# @param index [Vips::Image] Index pixels with this -# @param opts [Hash] Set of options -# @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this -# @return [Vips::Image] Output image - -# @!method shrink(hshrink, vshrink, **opts) -# Shrink an image. -# @param hshrink [Float] Horizontal shrink factor -# @param vshrink [Float] Vertical shrink factor -# @param opts [Hash] Set of options -# @option opts [Float] :xshrink Horizontal shrink factor -# @option opts [Float] :yshrink Vertical shrink factor -# @return [Vips::Image] Output image - -# @!method shrinkh(hshrink, **opts) -# Shrink an image horizontally. -# @param hshrink [Integer] Horizontal shrink factor -# @param opts [Hash] Set of options -# @option opts [Integer] :xshrink Horizontal shrink factor -# @return [Vips::Image] Output image - -# @!method shrinkv(vshrink, **opts) -# Shrink an image vertically. -# @param vshrink [Integer] Vertical shrink factor -# @param opts [Hash] Set of options -# @option opts [Integer] :yshrink Vertical shrink factor -# @return [Vips::Image] Output image - -# @!method reduceh(hshrink, **opts) -# Shrink an image horizontally. -# @param hshrink [Float] Horizontal shrink factor -# @param opts [Hash] Set of options -# @option opts [Float] :xshrink Horizontal shrink factor -# @option opts [Vips::Kernel] :kernel Resampling kernel -# @option opts [Boolean] :centre Use centre sampling convention -# @return [Vips::Image] Output image - -# @!method reducev(vshrink, **opts) -# Shrink an image vertically. -# @param vshrink [Float] Vertical shrink factor -# @param opts [Hash] Set of options -# @option opts [Float] :yshrink Vertical shrink factor -# @option opts [Vips::Kernel] :kernel Resampling kernel -# @option opts [Boolean] :centre Use centre sampling convention -# @return [Vips::Image] Output image - -# @!method reduce(hshrink, vshrink, **opts) -# Reduce an image. -# @param hshrink [Float] Horizontal shrink factor -# @param vshrink [Float] Vertical shrink factor -# @param opts [Hash] Set of options -# @option opts [Vips::Kernel] :kernel Resampling kernel -# @option opts [Boolean] :centre Use centre sampling convention -# @option opts [Float] :xshrink Horizontal shrink factor -# @option opts [Float] :yshrink Vertical shrink factor -# @return [Vips::Image] Output image - -# @!method quadratic(coeff, **opts) -# Resample an image with a quadratic transform. -# @param coeff [Vips::Image] Coefficient matrix -# @param opts [Hash] Set of options -# @option opts [Vips::Interpolate] :interpolate Interpolate values with this -# @return [Vips::Image] Output image - -# @!method affine(matrix, **opts) -# Affine transform of an image. -# @param matrix [Array] Transformation matrix -# @param opts [Hash] Set of options -# @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this -# @option opts [Array] :oarea Area of output to generate -# @option opts [Float] :odx Horizontal output displacement -# @option opts [Float] :ody Vertical output displacement -# @option opts [Float] :idx Horizontal input displacement -# @option opts [Float] :idy Vertical input displacement -# @option opts [Array] :background Background value -# @option opts [Boolean] :premultiplied Images have premultiplied alpha -# @option opts [Vips::Extend] :extend How to generate the extra pixels -# @return [Vips::Image] Output image - -# @!method similarity(**opts) -# Similarity transform of an image. -# @param opts [Hash] Set of options -# @option opts [Float] :scale Scale by this factor -# @option opts [Float] :angle Rotate anticlockwise by this many degrees -# @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this -# @option opts [Array] :background Background value -# @option opts [Float] :odx Horizontal output displacement -# @option opts [Float] :ody Vertical output displacement -# @option opts [Float] :idx Horizontal input displacement -# @option opts [Float] :idy Vertical input displacement -# @return [Vips::Image] Output image - -# @!method rotate(angle, **opts) -# Rotate an image by a number of degrees. -# @param angle [Float] Rotate anticlockwise by this many degrees -# @param opts [Hash] Set of options -# @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this -# @option opts [Array] :background Background value -# @option opts [Float] :odx Horizontal output displacement -# @option opts [Float] :ody Vertical output displacement -# @option opts [Float] :idx Horizontal input displacement -# @option opts [Float] :idy Vertical input displacement -# @return [Vips::Image] Output image - -# @!method resize(scale, **opts) -# Resize an image. -# @param scale [Float] Scale image by this factor -# @param opts [Hash] Set of options -# @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this -# @option opts [Vips::Kernel] :kernel Resampling kernel -# @option opts [Boolean] :centre Use centre sampling convention -# @option opts [Float] :vscale Vertical scale image by this factor -# @option opts [Float] :idx Horizontal input displacement -# @option opts [Float] :idy Vertical input displacement -# @return [Vips::Image] Output image - -# @!method colourspace(space, **opts) -# Convert to a new colorspace. -# @param space [Vips::Interpretation] Destination color space -# @param opts [Hash] Set of options -# @option opts [Vips::Interpretation] :source_space Source color space -# @return [Vips::Image] Output image - -# @!method Lab2XYZ(**opts) -# Transform cielab to xyz. -# @param opts [Hash] Set of options -# @option opts [Array] :temp Color temperature -# @return [Vips::Image] Output image - -# @!method XYZ2Lab(**opts) -# Transform xyz to lab. -# @param opts [Hash] Set of options -# @option opts [Array] :temp Colour temperature -# @return [Vips::Image] Output image - -# @!method Lab2LCh(**opts) -# Transform lab to lch. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method LCh2Lab(**opts) -# Transform lch to lab. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method LCh2CMC(**opts) -# Transform lch to cmc. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method CMC2LCh(**opts) -# Transform lch to cmc. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method XYZ2Yxy(**opts) -# Transform xyz to yxy. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method Yxy2XYZ(**opts) -# Transform yxy to xyz. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method scRGB2XYZ(**opts) -# Transform scrgb to xyz. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method XYZ2scRGB(**opts) -# Transform xyz to scrgb. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method LabQ2Lab(**opts) -# Unpack a labq image to float lab. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method Lab2LabQ(**opts) -# Transform float lab to labq coding. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method LabQ2LabS(**opts) -# Unpack a labq image to short lab. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method LabS2LabQ(**opts) -# Transform short lab to labq coding. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method LabS2Lab(**opts) -# Transform signed short lab to float. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method Lab2LabS(**opts) -# Transform float lab to signed short. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method rad2float(**opts) -# Unpack radiance coding to float rgb. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method float2rad(**opts) -# Transform float rgb to radiance coding. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method LabQ2sRGB(**opts) -# Convert a labq image to srgb. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method sRGB2HSV(**opts) -# Transform srgb to hsv. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method HSV2sRGB(**opts) -# Transform hsv to srgb. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method icc_import(**opts) -# Import from device with icc profile. -# @param opts [Hash] Set of options -# @option opts [Vips::PCS] :pcs Set Profile Connection Space -# @option opts [Vips::Intent] :intent Rendering intent -# @option opts [Boolean] :black_point_compensation Enable black point compensation -# @option opts [Boolean] :embedded Use embedded input profile, if available -# @option opts [String] :input_profile Filename to load input profile from -# @return [Vips::Image] Output image - -# @!method icc_export(**opts) -# Output to device with icc profile. -# @param opts [Hash] Set of options -# @option opts [Vips::PCS] :pcs Set Profile Connection Space -# @option opts [Vips::Intent] :intent Rendering intent -# @option opts [Boolean] :black_point_compensation Enable black point compensation -# @option opts [String] :output_profile Filename to load output profile from -# @option opts [Integer] :depth Output device space depth in bits -# @return [Vips::Image] Output image - -# @!method icc_transform(output_profile, **opts) -# Transform between devices with icc profiles. -# @param output_profile [String] Filename to load output profile from -# @param opts [Hash] Set of options -# @option opts [Vips::PCS] :pcs Set Profile Connection Space -# @option opts [Vips::Intent] :intent Rendering intent -# @option opts [Boolean] :black_point_compensation Enable black point compensation -# @option opts [Boolean] :embedded Use embedded input profile, if available -# @option opts [String] :input_profile Filename to load input profile from -# @option opts [Integer] :depth Output device space depth in bits -# @return [Vips::Image] Output image - -# @!method dE76(right, **opts) -# Calculate de76. -# @param right [Vips::Image] Right-hand input image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method dE00(right, **opts) -# Calculate de00. -# @param right [Vips::Image] Right-hand input image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method dECMC(right, **opts) -# Calculate decmc. -# @param right [Vips::Image] Right-hand input image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method sRGB2scRGB(**opts) -# Convert an srgb image to scrgb. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method scRGB2BW(**opts) -# Convert scrgb to bw. -# @param opts [Hash] Set of options -# @option opts [Integer] :depth Output device space depth in bits -# @return [Vips::Image] Output image - -# @!method scRGB2sRGB(**opts) -# Convert an scrgb image to srgb. -# @param opts [Hash] Set of options -# @option opts [Integer] :depth Output device space depth in bits -# @return [Vips::Image] Output image - -# @!method CMYK2XYZ(**opts) -# Transform cmyk to xyz. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method XYZ2CMYK(**opts) -# Transform xyz to cmyk. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method self.profile_load(name, **opts) -# Load named icc profile. -# @param name [String] Profile name -# @param opts [Hash] Set of options -# @return [VipsBlob] Loaded profile - -# @!method maplut(lut, **opts) -# Map an image though a lut. -# @param lut [Vips::Image] Look-up table image -# @param opts [Hash] Set of options -# @option opts [Integer] :band apply one-band lut to this band of in -# @return [Vips::Image] Output image - -# @!method case(cases, **opts) -# Use pixel values to pick cases from an array of images. -# @param cases [Array] Array of case images -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method percent(percent, **opts) -# Find threshold for percent of pixels. -# @param percent [Float] Percent of pixels -# @param opts [Hash] Set of options -# @return [Integer] Threshold above which lie percent of pixels - -# @!method stdif(width, height, **opts) -# Statistical difference. -# @param width [Integer] Window width in pixels -# @param height [Integer] Window height in pixels -# @param opts [Hash] Set of options -# @option opts [Float] :s0 New deviation -# @option opts [Float] :b Weight of new deviation -# @option opts [Float] :m0 New mean -# @option opts [Float] :a Weight of new mean -# @return [Vips::Image] Output image - -# @!method hist_cum(**opts) -# Form cumulative histogram. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method hist_match(ref, **opts) -# Match two histograms. -# @param ref [Vips::Image] Reference histogram -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method hist_norm(**opts) -# Normalise histogram. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method hist_equal(**opts) -# Histogram equalisation. -# @param opts [Hash] Set of options -# @option opts [Integer] :band Equalise with this band -# @return [Vips::Image] Output image - -# @!method hist_plot(**opts) -# Plot histogram. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method hist_local(width, height, **opts) -# Local histogram equalisation. -# @param width [Integer] Window width in pixels -# @param height [Integer] Window height in pixels -# @param opts [Hash] Set of options -# @option opts [Integer] :max_slope Maximum slope (CLAHE) -# @return [Vips::Image] Output image - -# @!method hist_ismonotonic(**opts) -# Test for monotonicity. -# @param opts [Hash] Set of options -# @return [Boolean] true if in is monotonic - -# @!method hist_entropy(**opts) -# Estimate image entropy. -# @param opts [Hash] Set of options -# @return [Float] Output value - -# @!method conv(mask, **opts) -# Convolution operation. -# @param mask [Vips::Image] Input matrix image -# @param opts [Hash] Set of options -# @option opts [Vips::Precision] :precision Convolve with this precision -# @option opts [Integer] :layers Use this many layers in approximation -# @option opts [Integer] :cluster Cluster lines closer than this in approximation -# @return [Vips::Image] Output image - -# @!method conva(mask, **opts) -# Approximate integer convolution. -# @param mask [Vips::Image] Input matrix image -# @param opts [Hash] Set of options -# @option opts [Integer] :layers Use this many layers in approximation -# @option opts [Integer] :cluster Cluster lines closer than this in approximation -# @return [Vips::Image] Output image - -# @!method convf(mask, **opts) -# Float convolution operation. -# @param mask [Vips::Image] Input matrix image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method convi(mask, **opts) -# Int convolution operation. -# @param mask [Vips::Image] Input matrix image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method compass(mask, **opts) -# Convolve with rotating mask. -# @param mask [Vips::Image] Input matrix image -# @param opts [Hash] Set of options -# @option opts [Integer] :times Rotate and convolve this many times -# @option opts [Vips::Angle45] :angle Rotate mask by this much between convolutions -# @option opts [Vips::Combine] :combine Combine convolution results like this -# @option opts [Vips::Precision] :precision Convolve with this precision -# @option opts [Integer] :layers Use this many layers in approximation -# @option opts [Integer] :cluster Cluster lines closer than this in approximation -# @return [Vips::Image] Output image - -# @!method convsep(mask, **opts) -# Seperable convolution operation. -# @param mask [Vips::Image] Input matrix image -# @param opts [Hash] Set of options -# @option opts [Vips::Precision] :precision Convolve with this precision -# @option opts [Integer] :layers Use this many layers in approximation -# @option opts [Integer] :cluster Cluster lines closer than this in approximation -# @return [Vips::Image] Output image - -# @!method convasep(mask, **opts) -# Approximate separable integer convolution. -# @param mask [Vips::Image] Input matrix image -# @param opts [Hash] Set of options -# @option opts [Integer] :layers Use this many layers in approximation -# @return [Vips::Image] Output image - -# @!method fastcor(ref, **opts) -# Fast correlation. -# @param ref [Vips::Image] Input reference image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method spcor(ref, **opts) -# Spatial correlation. -# @param ref [Vips::Image] Input reference image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method sharpen(**opts) -# Unsharp masking for print. -# @param opts [Hash] Set of options -# @option opts [Integer] :radius radius of Gaussian -# @option opts [Float] :sigma Sigma of Gaussian -# @option opts [Float] :x1 Flat/jaggy threshold -# @option opts [Float] :y2 Maximum brightening -# @option opts [Float] :y3 Maximum darkening -# @option opts [Float] :m1 Slope for flat areas -# @option opts [Float] :m2 Slope for jaggy areas -# @return [Vips::Image] Output image - -# @!method gaussblur(sigma, **opts) -# Gaussian blur. -# @param sigma [Float] Sigma of Gaussian -# @param opts [Hash] Set of options -# @option opts [Float] :min_ampl Minimum amplitude of Gaussian -# @option opts [Vips::Precision] :precision Convolve with this precision -# @return [Vips::Image] Output image - -# @!method canny(**opts) -# Canny edge detector. -# @param opts [Hash] Set of options -# @option opts [Float] :sigma Sigma of Gaussian -# @option opts [Vips::Precision] :precision Convolve with this precision -# @return [Vips::Image] Output image - -# @!method sobel(**opts) -# Sobel edge detector. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method fwfft(**opts) -# Forward fft. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method invfft(**opts) -# Inverse fft. -# @param opts [Hash] Set of options -# @option opts [Boolean] :real Output only the real part of the transform -# @return [Vips::Image] Output image - -# @!method freqmult(mask, **opts) -# Frequency-domain filtering. -# @param mask [Vips::Image] Input mask image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method spectrum(**opts) -# Make displayable power spectrum. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method phasecor(in2, **opts) -# Calculate phase correlation. -# @param in2 [Vips::Image] Second input image -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method morph(mask, morph, **opts) -# Morphology operation. -# @param mask [Vips::Image] Input matrix image -# @param morph [Vips::OperationMorphology] Morphological operation to perform -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method rank(width, height, index, **opts) -# Rank filter. -# @param width [Integer] Window width in pixels -# @param height [Integer] Window height in pixels -# @param index [Integer] Select pixel at index -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method countlines(direction, **opts) -# Count lines in an image. -# @param direction [Vips::Direction] Countlines left-right or up-down -# @param opts [Hash] Set of options -# @return [Float] Number of lines - -# @!method labelregions(**opts) -# Label regions in an image. -# @param opts [Hash] Set of options -# @option opts [Integer] :segments Output Number of discrete contigious regions -# @return [Vips::Image, Hash Object>] Mask of region labels, Hash of optional output items - -# @!method fill_nearest(**opts) -# Fill image zeros with nearest non-zero pixel. -# @param opts [Hash] Set of options -# @option opts [Vips::Image] :distance Output Distance to nearest non-zero pixel -# @return [Vips::Image, Hash Object>] Value of nearest non-zero pixel, Hash of optional output items - -# @!method draw_rect(ink, left, top, width, height, **opts) -# Paint a rectangle on an image. -# @param ink [Array] Color for pixels -# @param left [Integer] Rect to fill -# @param top [Integer] Rect to fill -# @param width [Integer] Rect to fill -# @param height [Integer] Rect to fill -# @param opts [Hash] Set of options -# @option opts [Boolean] :fill Draw a solid object -# @return [Vips::Image] Image to draw on - -# @!method draw_mask(ink, mask, x, y, **opts) -# Draw a mask on an image. -# @param ink [Array] Color for pixels -# @param mask [Vips::Image] Mask of pixels to draw -# @param x [Integer] Draw mask here -# @param y [Integer] Draw mask here -# @param opts [Hash] Set of options -# @return [Vips::Image] Image to draw on - -# @!method draw_line(ink, x1, y1, x2, y2, **opts) -# Draw a line on an image. -# @param ink [Array] Color for pixels -# @param x1 [Integer] Start of draw_line -# @param y1 [Integer] Start of draw_line -# @param x2 [Integer] End of draw_line -# @param y2 [Integer] End of draw_line -# @param opts [Hash] Set of options -# @return [Vips::Image] Image to draw on - -# @!method draw_circle(ink, cx, cy, radius, **opts) -# Draw a circle on an image. -# @param ink [Array] Color for pixels -# @param cx [Integer] Centre of draw_circle -# @param cy [Integer] Centre of draw_circle -# @param radius [Integer] Radius in pixels -# @param opts [Hash] Set of options -# @option opts [Boolean] :fill Draw a solid object -# @return [Vips::Image] Image to draw on - -# @!method draw_flood(ink, x, y, **opts) -# Flood-fill an area. -# @param ink [Array] Color for pixels -# @param x [Integer] DrawFlood start point -# @param y [Integer] DrawFlood start point -# @param opts [Hash] Set of options -# @option opts [Vips::Image] :test Test pixels in this image -# @option opts [Boolean] :equal DrawFlood while equal to edge -# @option opts [Integer] :left Output Left edge of modified area -# @option opts [Integer] :top Output top edge of modified area -# @option opts [Integer] :width Output width of modified area -# @option opts [Integer] :height Output height of modified area -# @return [Vips::Image, Hash Object>] Image to draw on, Hash of optional output items - -# @!method draw_image(sub, x, y, **opts) -# Paint an image into another image. -# @param sub [Vips::Image] Sub-image to insert into main image -# @param x [Integer] Draw image here -# @param y [Integer] Draw image here -# @param opts [Hash] Set of options -# @option opts [Vips::CombineMode] :mode Combining mode -# @return [Vips::Image] Image to draw on - -# @!method draw_smudge(left, top, width, height, **opts) -# Blur a rectangle on an image. -# @param left [Integer] Rect to fill -# @param top [Integer] Rect to fill -# @param width [Integer] Rect to fill -# @param height [Integer] Rect to fill -# @param opts [Hash] Set of options -# @return [Vips::Image] Image to draw on - -# @!method merge(sec, direction, dx, dy, **opts) -# Merge two images. -# @param sec [Vips::Image] Secondary image -# @param direction [Vips::Direction] Horizontal or vertical merge -# @param dx [Integer] Horizontal displacement from sec to ref -# @param dy [Integer] Vertical displacement from sec to ref -# @param opts [Hash] Set of options -# @option opts [Integer] :mblend Maximum blend size -# @return [Vips::Image] Output image - -# @!method mosaic(sec, direction, xref, yref, xsec, ysec, **opts) -# Mosaic two images. -# @param sec [Vips::Image] Secondary image -# @param direction [Vips::Direction] Horizontal or vertical mosaic -# @param xref [Integer] Position of reference tie-point -# @param yref [Integer] Position of reference tie-point -# @param xsec [Integer] Position of secondary tie-point -# @param ysec [Integer] Position of secondary tie-point -# @param opts [Hash] Set of options -# @option opts [Integer] :hwindow Half window size -# @option opts [Integer] :harea Half area size -# @option opts [Integer] :mblend Maximum blend size -# @option opts [Integer] :bandno Band to search for features on -# @option opts [Integer] :dx0 Output Detected integer offset -# @option opts [Integer] :dy0 Output Detected integer offset -# @option opts [Float] :scale1 Output Detected scale -# @option opts [Float] :angle1 Output Detected rotation -# @option opts [Float] :dy1 Output Detected first-order displacement -# @option opts [Float] :dx1 Output Detected first-order displacement -# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items - -# @!method mosaic1(sec, direction, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, **opts) -# First-order mosaic of two images. -# @param sec [Vips::Image] Secondary image -# @param direction [Vips::Direction] Horizontal or vertical mosaic -# @param xr1 [Integer] Position of first reference tie-point -# @param yr1 [Integer] Position of first reference tie-point -# @param xs1 [Integer] Position of first secondary tie-point -# @param ys1 [Integer] Position of first secondary tie-point -# @param xr2 [Integer] Position of second reference tie-point -# @param yr2 [Integer] Position of second reference tie-point -# @param xs2 [Integer] Position of second secondary tie-point -# @param ys2 [Integer] Position of second secondary tie-point -# @param opts [Hash] Set of options -# @option opts [Integer] :hwindow Half window size -# @option opts [Integer] :harea Half area size -# @option opts [Boolean] :search Search to improve tie-points -# @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this -# @option opts [Integer] :mblend Maximum blend size -# @option opts [Integer] :bandno Band to search for features on -# @return [Vips::Image] Output image - -# @!method matrixinvert(**opts) -# Invert an matrix. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output matrix - -# @!method match(sec, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, **opts) -# First-order match of two images. -# @param sec [Vips::Image] Secondary image -# @param xr1 [Integer] Position of first reference tie-point -# @param yr1 [Integer] Position of first reference tie-point -# @param xs1 [Integer] Position of first secondary tie-point -# @param ys1 [Integer] Position of first secondary tie-point -# @param xr2 [Integer] Position of second reference tie-point -# @param yr2 [Integer] Position of second reference tie-point -# @param xs2 [Integer] Position of second secondary tie-point -# @param ys2 [Integer] Position of second secondary tie-point -# @param opts [Hash] Set of options -# @option opts [Integer] :hwindow Half window size -# @option opts [Integer] :harea Half area size -# @option opts [Boolean] :search Search to improve tie-points -# @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this -# @return [Vips::Image] Output image - -# @!method globalbalance(**opts) -# Global balance an image mosaic. -# @param opts [Hash] Set of options -# @option opts [Float] :gamma Image gamma -# @option opts [Boolean] :int_output Integer output -# @return [Vips::Image] Output image - - end -end diff --git a/lib/vips/mutableimage.rb b/lib/vips/mutableimage.rb deleted file mode 100644 index 2290dba4..00000000 --- a/lib/vips/mutableimage.rb +++ /dev/null @@ -1,173 +0,0 @@ -# This module provides an interface to the vips image processing library -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" -require "forwardable" - -module Vips - # This class represents a libvips image which can be modified. See - # {Vips::Image#mutate}. - class MutableImage < Vips::Object - extend Forwardable - alias_method :parent_get_typeof, :get_typeof - def_instance_delegators :@image, :width, :height, :bands, :format, - :interpretation, :filename, :xoffset, :yoffset, :xres, :yres, :size, - :get, :get_typeof, :get_fields - - # layout is exactly as {Image} (since we are also wrapping a VipsImage - # object) - module MutableImageLayout - def self.included base - base.class_eval do - layout :parent, Vips::Object::Struct - # rest opaque - end - end - end - - class Struct < Vips::Object::Struct - include MutableImageLayout - end - - class ManagedStruct < Vips::Object::ManagedStruct - include MutableImageLayout - end - - # Get the {Image} this {MutableImage} is modifying. Only use this once you - # have finished all modifications. - # - # This is for internal use only. See {Vips::Image#mutate} for the - # user-facing interface. - attr_reader :image - - # Make a {MutableImage} from a regular {Image}. - # - # This is for internal use only. See {Vips::Image#mutate} for the - # user-facing interface. - def initialize(image) - # We take a copy of the regular Image to ensure we have an unshared - # (unique) object. We forward things like #width and #height to this, and - # it's the thing we return at the end of the mutate block. - copy_image = image.copy - - # Use ptr since we need the raw unwrapped pointer inside the image ... - # and make the ref that gobject will unref when it finishes. - # See also the comment on set_type! before changing this. - pointer = copy_image.ptr - ::GObject.g_object_ref pointer - super pointer - - # and save the copy ready for when we finish mutating - @image = copy_image - end - - def inspect - "#" - end - - def respond_to? name, include_all = false - # To support keyword args, we need to tell Ruby that final image - # arguments cannot be hashes of keywords. - # - # https://makandracards.com/makandra/ - # 36013-heads-up-ruby-implicitly-converts-a-hash-to-keyword-arguments - return false if name == :to_hash - - super - end - - def respond_to_missing? name, include_all = false - # Respond to all vips operations by nickname. - return true if Vips.type_find("VipsOperation", name.to_s) != 0 - - super - end - - # Invoke a vips operation with {Vips::Operation#call}, using self as - # the first input argument. {Vips::Operation#call} will only allow - # operations that modify self when passed a {MutableImage}. - # - # @param name [String] vips operation to call - # @return result of vips operation - def method_missing name, *args, **options - Vips::Operation.call name.to_s, [self, *args], options - end - - # Create a metadata item on an image of the specifed type. Ruby types - # are automatically transformed into the matching glib type (eg. - # {GObject::GINT_TYPE}), if possible. - # - # For example, you can use this to set an image's ICC profile: - # - # ```ruby - # x.set_type! Vips::BLOB_TYPE, "icc-profile-data", profile - # ``` - # - # where `profile` is an ICC profile held as a binary string object. - # - # @see set! - # @param gtype [Integer] GType of item - # @param name [String] Metadata field to set - # @param value [Object] Value to set - def set_type! gtype, name, value - gvalue = GObject::GValue.alloc - gvalue.init gtype - gvalue.set value - - # libvips 8.9.1 had a terrible misfeature which would block metadata - # modification unless the object had a ref_count of 1. MutableImage - # will always have a ref_count of at least 2 (the parent gobject keeps a - # ref, and we keep a ref to the copy ready to return to our caller), - # so we must temporarily drop the refs to 1 around metadata changes. - # - # See https://github.com/libvips/ruby-vips/issues/291 - begin - ::GObject.g_object_unref ptr - Vips.vips_image_set self, name, gvalue - ensure - ::GObject.g_object_ref ptr - end - - gvalue.unset - end - - # Set the value of a metadata item on an image. The metadata item must - # already exist. Ruby types are automatically transformed into the - # matching {GObject::GValue}, if possible. - # - # For example, you can use this to set an image's ICC profile: - # - # ``` - # x.set! "icc-profile-data", profile - # ``` - # - # where `profile` is an ICC profile held as a binary string object. - # - # @see set_type! - # @param name [String] Metadata field to set - # @param value [Object] Value to set - def set! name, value - set_type! get_typeof(name), name, value - end - - # Remove a metadata item from an image. - # - # For example: - # - # ``` - # x.remove! "icc-profile-data" - # ``` - # - # @param name [String] Metadata field to remove - def remove! name - # See set_type! for an explanation. Image#remove can't throw an - # exception, so there's no need to ensure we unref. - ::GObject.g_object_unref ptr - Vips.vips_image_remove self, name - ::GObject.g_object_ref ptr - end - end -end diff --git a/lib/vips/object.rb b/lib/vips/object.rb deleted file mode 100644 index 3b3e92de..00000000 --- a/lib/vips/object.rb +++ /dev/null @@ -1,348 +0,0 @@ -# This module provides an interface to the top level bits of libvips -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module Vips - private - - # debugging support - attach_function :vips_object_print_all, [], :void - - # we must init these by hand, since they are usually made on first image - # create - attach_function :vips_band_format_get_type, [], :GType - attach_function :vips_interpretation_get_type, [], :GType - attach_function :vips_coding_get_type, [], :GType - - public - - # some handy gtypes - IMAGE_TYPE = GObject.g_type_from_name "VipsImage" - ARRAY_INT_TYPE = GObject.g_type_from_name "VipsArrayInt" - ARRAY_DOUBLE_TYPE = GObject.g_type_from_name "VipsArrayDouble" - ARRAY_IMAGE_TYPE = GObject.g_type_from_name "VipsArrayImage" - REFSTR_TYPE = GObject.g_type_from_name "VipsRefString" - BLOB_TYPE = GObject.g_type_from_name "VipsBlob" - - BAND_FORMAT_TYPE = Vips.vips_band_format_get_type - INTERPRETATION_TYPE = Vips.vips_interpretation_get_type - CODING_TYPE = Vips.vips_coding_get_type - - if Vips.at_least_libvips?(8, 6) - attach_function :vips_blend_mode_get_type, [], :GType - BLEND_MODE_TYPE = Vips.vips_blend_mode_get_type - else - BLEND_MODE_TYPE = nil - end - - private - - class Progress < FFI::Struct - layout :im, :pointer, - :run, :int, - :eta, :int, - :tpels, :int64_t, - :npels, :int64_t, - :percent, :int, - :start, :pointer - end - - # Our signal marshalers. - # - # These are functions which take the handler as a param and return a - # closure with the right FFI signature for g_signal_connect for this - # specific signal. - # - # ruby-ffi makes it hard to use the g_signal_connect user data param - # to pass the function pointer through, unfortunately. - # - # We can't throw exceptions across C, so we must catch everything. - - MARSHAL_PROGRESS = proc do |handler| - FFI::Function.new(:void, [:pointer, :pointer, :pointer]) do |vi, prog, cb| - # this can't throw an exception, so no catch is necessary - handler.call(Progress.new(prog)) - end - end - - MARSHAL_READ = proc do |handler| - FFI::Function.new(:int64_t, [:pointer, :pointer, :int64_t]) do |i, p, len| - begin - result = handler.call(p, len) - rescue Exception => e - puts "read: #{e}" - result = 0 - end - - result - end - end - - MARSHAL_SEEK = proc do |handler| - FFI::Function.new(:int64_t, [:pointer, :int64_t, :int]) do |i, off, whence| - begin - result = handler.call(off, whence) - rescue Exception => e - puts "seek: #{e}" - result = -1 - end - - result - end - end - - MARSHAL_WRITE = proc do |handler| - FFI::Function.new(:int64_t, [:pointer, :pointer, :int64_t]) do |i, p, len| - begin - result = handler.call(p, len) - rescue Exception => e - puts "write: #{e}" - result = 0 - end - - result - end - end - - MARSHAL_FINISH = proc do |handler| - FFI::Function.new(:void, [:pointer, :pointer]) do |i, cb| - # this can't throw an exception, so no catch is necessary - handler.call - end - end - - # map signal name to marshal proc - MARSHAL_ALL = { - preeval: MARSHAL_PROGRESS, - eval: MARSHAL_PROGRESS, - posteval: MARSHAL_PROGRESS, - read: MARSHAL_READ, - seek: MARSHAL_SEEK, - write: MARSHAL_WRITE, - finish: MARSHAL_FINISH - } - - attach_function :vips_enum_from_nick, [:string, :GType, :string], :int - attach_function :vips_enum_nick, [:GType, :int], :string - - attach_function :vips_value_set_ref_string, - [GObject::GValue.ptr, :string], :void - attach_function :vips_value_set_array_double, - [GObject::GValue.ptr, :pointer, :int], :void - attach_function :vips_value_set_array_int, - [GObject::GValue.ptr, :pointer, :int], :void - attach_function :vips_value_set_array_image, - [GObject::GValue.ptr, :int], :void - callback :free_fn, [:pointer], :void - attach_function :vips_value_set_blob, - [GObject::GValue.ptr, :free_fn, :pointer, :size_t], :void - - class SizeStruct < FFI::Struct - layout :value, :size_t - end - - class IntStruct < FFI::Struct - layout :value, :int - end - - attach_function :vips_value_get_ref_string, - [GObject::GValue.ptr, SizeStruct.ptr], :string - attach_function :vips_value_get_array_double, - [GObject::GValue.ptr, IntStruct.ptr], :pointer - attach_function :vips_value_get_array_int, - [GObject::GValue.ptr, IntStruct.ptr], :pointer - attach_function :vips_value_get_array_image, - [GObject::GValue.ptr, IntStruct.ptr], :pointer - attach_function :vips_value_get_blob, - [GObject::GValue.ptr, SizeStruct.ptr], :pointer - - attach_function :type_find, :vips_type_find, [:string, :string], :GType - - class Object < GObject::GObject - # print all active VipsObjects, with their reference counts. Handy for - # debugging ruby-vips. - def self.print_all - GC.start - Vips.vips_object_print_all - end - - # the layout of the VipsObject struct - module ObjectLayout - def self.included base - base.class_eval do - # don't actually need most of these - layout :parent, GObject::GObject::Struct, - :constructed, :int, - :static_object, :int, - :argument_table, :pointer, - :nickname, :string, - :description, :string, - :preclose, :int, - :close, :int, - :postclose, :int, - :local_memory, :size_t - end - end - end - - class Struct < GObject::GObject::Struct - include ObjectLayout - end - - class ManagedStruct < GObject::GObject::ManagedStruct - include ObjectLayout - end - - # return a pspec, or nil ... nil wil leave a message in the error log - # which you must clear - def get_pspec name - ppspec = GObject::GParamSpecPtr.new - argument_class = Vips::ArgumentClassPtr.new - argument_instance = Vips::ArgumentInstancePtr.new - - result = Vips.vips_object_get_argument self, name, - ppspec, argument_class, argument_instance - return nil if result != 0 - - ppspec[:value] - end - - # return a gtype, raise an error on not found - def get_typeof_error name - pspec = get_pspec name - raise Vips::Error unless pspec - - pspec[:value_type] - end - - # return a gtype, 0 on not found - def get_typeof name - pspec = get_pspec name - unless pspec - Vips.vips_error_clear - return 0 - end - - pspec[:value_type] - end - - def get name - gtype = get_typeof_error name - gvalue = GObject::GValue.alloc - gvalue.init gtype - GObject.g_object_get_property self, name, gvalue - result = gvalue.get - gvalue.unset - - GLib.logger.debug("Vips::Object.get") { "#{name} == #{result}" } - - result - end - - def set name, value - GLib.logger.debug("Vips::Object.set") { "#{name} = #{value}" } - - gtype = get_typeof_error name - gvalue = GObject::GValue.alloc - gvalue.init gtype - gvalue.set value - GObject.g_object_set_property self, name, gvalue - gvalue.unset - end - - def signal_connect name, handler = nil, &block - marshal = MARSHAL_ALL[name.to_sym] - raise Vips::Error, "unsupported signal #{name}" if marshal.nil? - - if block - # our block as a Proc - prc = block - elsif handler - # We assume the hander is a Proc (perhaps we should test) - prc = handler - else - raise Vips::Error, "must supply either block or handler" - end - - # The marshal function will make a closure with the right type signature - # for the selected signal - callback = marshal.call(prc) - - # we need to make sure this is not GCd while self is alive - @references << callback - - GObject.g_signal_connect_data(self, name.to_s, callback, nil, nil, 0) - end - end - - class ObjectClass < FFI::Struct - # opaque - end - - class Argument < FFI::Struct - layout :pspec, GObject::GParamSpec.ptr - end - - class ArgumentInstance < Argument - layout :parent, Argument - # rest opaque - end - - # enum VipsArgumentFlags - ARGUMENT_REQUIRED = 1 - ARGUMENT_CONSTRUCT = 2 - ARGUMENT_SET_ONCE = 4 - ARGUMENT_SET_ALWAYS = 8 - ARGUMENT_INPUT = 16 - ARGUMENT_OUTPUT = 32 - ARGUMENT_DEPRECATED = 64 - ARGUMENT_MODIFY = 128 - - ARGUMENT_FLAGS = { - required: ARGUMENT_REQUIRED, - construct: ARGUMENT_CONSTRUCT, - set_once: ARGUMENT_SET_ONCE, - set_always: ARGUMENT_SET_ALWAYS, - input: ARGUMENT_INPUT, - output: ARGUMENT_OUTPUT, - deprecated: ARGUMENT_DEPRECATED, - modify: ARGUMENT_MODIFY - } - - class ArgumentClass < Argument - layout :parent, Argument, - :object_class, ObjectClass.ptr, - :flags, :uint, - :priority, :int, - :offset, :ulong_long - end - - class ArgumentClassPtr < FFI::Struct - layout :value, ArgumentClass.ptr - end - - class ArgumentInstancePtr < FFI::Struct - layout :value, ArgumentInstance.ptr - end - - # just use :pointer, not VipsObject.ptr, to avoid casting gobject - # subclasses - attach_function :vips_object_get_argument, - [:pointer, :string, - GObject::GParamSpecPtr.ptr, - ArgumentClassPtr.ptr, ArgumentInstancePtr.ptr], - :int - - attach_function :vips_object_print_all, [], :void - - attach_function :vips_object_set_from_string, [:pointer, :string], :int - - callback :type_map_fn, [:GType, :pointer], :pointer - attach_function :vips_type_map, [:GType, :type_map_fn, :pointer], :pointer - - attach_function :vips_object_get_description, [:pointer], :string -end diff --git a/lib/vips/operation.rb b/lib/vips/operation.rb deleted file mode 100644 index 8fed370c..00000000 --- a/lib/vips/operation.rb +++ /dev/null @@ -1,514 +0,0 @@ -# This module provides an interface to the top level bits of libvips -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" -require "set" - -module Vips - private - - attach_function :vips_operation_new, [:string], :pointer - - # We may well block during this (eg. if it's avg, or perhaps jpegsave), and - # libvips might trigger some signals which ruby has handles for. - # - # We need FFI to drop the GIL lock during this call and reacquire it when - # the call ends, or we'll deadlock. - attach_function :vips_cache_operation_build, [:pointer], :pointer, - blocking: true - attach_function :vips_object_unref_outputs, [:pointer], :void - - callback :argument_map_fn, [:pointer, - GObject::GParamSpec.ptr, - ArgumentClass.ptr, - ArgumentInstance.ptr, - :pointer, :pointer], :pointer - attach_function :vips_argument_map, [:pointer, - :argument_map_fn, - :pointer, :pointer], :pointer - - OPERATION_SEQUENTIAL = 1 - OPERATION_NOCACHE = 4 - OPERATION_DEPRECATED = 8 - - OPERATION_FLAGS = { - sequential: OPERATION_SEQUENTIAL, - nocache: OPERATION_NOCACHE, - deprecated: OPERATION_DEPRECATED - } - - attach_function :vips_operation_get_flags, [:pointer], :int - - # Introspect a vips operation and return a large structure containing - # everything we know about it. This is used for doc generation as well as - # call. - class Introspect - attr_reader :name, :description, :flags, :args, :required_input, - :optional_input, :required_output, :optional_output, :member_x, - :method_args, :vips_name, :destructive - - @@introspect_cache = {} - - def initialize name - # if there's a trailing "!", this is a destructive version of an - # operation - if name[-1] == "!" - @destructive = true - # strip the trailing "!" - @vips_name = name[0...-1] - else - @destructive = false - @vips_name = name - end - - @op = Operation.new @vips_name - @args = [] - @required_input = [] - @optional_input = {} - @required_output = [] - @optional_output = {} - - # find all the arguments the operator can take - @op.argument_map do |pspec, argument_class, _argument_instance| - flags = argument_class[:flags] - if (flags & ARGUMENT_CONSTRUCT) != 0 - # names can include - as punctuation, but we always use _ in - # Ruby - arg_name = pspec[:name].tr("-", "_") - @args << { - arg_name: arg_name, - flags: flags, - gtype: pspec[:value_type] - } - end - - nil - end - - @args.each do |details| - arg_name = details[:arg_name] - flags = details[:flags] - - if (flags & ARGUMENT_INPUT) != 0 - if (flags & ARGUMENT_REQUIRED) != 0 && - (flags & ARGUMENT_DEPRECATED) == 0 - @required_input << details - else - # we allow deprecated optional args - @optional_input[arg_name] = details - end - - # MODIFY INPUT args count as OUTPUT as well in non-destructive mode - if (flags & ARGUMENT_MODIFY) != 0 && - !@destructive - if (flags & ARGUMENT_REQUIRED) != 0 && - (flags & ARGUMENT_DEPRECATED) == 0 - @required_output << details - else - @optional_output[arg_name] = details - end - end - elsif (flags & ARGUMENT_OUTPUT) != 0 - if (flags & ARGUMENT_REQUIRED) != 0 && - (flags & ARGUMENT_DEPRECATED) == 0 - @required_output << details - else - # again, allow deprecated optional args - @optional_output[arg_name] = details - end - end - end - - # in destructive mode, the first required input arg must be MODIFY and - # must be an image - if @destructive - if @required_input.length < 1 || - @required_input[0][:flags] & ARGUMENT_MODIFY == 0 || - @required_input[0][:gtype] != IMAGE_TYPE - raise Vips::Error, "operation #{@vips_name} is not destructive" - end - end - end - - # Yard comment generation needs a little more introspection. We add this - # extra metadata in a separate method to keep the main path as fast as - # we can. - def add_yard_introspection name - @name = name - @description = Vips.vips_object_get_description @op - @flags = Vips.vips_operation_get_flags @op - @member_x = nil - @method_args = [] - - @args.each do |details| - arg_name = details[:arg_name] - flags = details[:flags] - gtype = details[:gtype] - - details[:yard_name] = arg_name == "in" ? "im" : arg_name - pspec = @op.get_pspec arg_name - details[:blurb] = GObject.g_param_spec_get_blurb pspec - - if (flags & ARGUMENT_INPUT) != 0 && - (flags & ARGUMENT_REQUIRED) != 0 && - (flags & ARGUMENT_DEPRECATED) == 0 - # the first required input image is the thing we will be a method - # of - if @member_x.nil? && gtype == IMAGE_TYPE - @member_x = details - else - @method_args << details - end - end - end - end - - def self.get name - @@introspect_cache[name] ||= Introspect.new name - end - - def self.get_yard name - introspect = Introspect.get name - introspect.add_yard_introspection name - introspect - end - end - - class Operation < Object - # the layout of the VipsOperation struct - module OperationLayout - def self.included base - base.class_eval do - layout :parent, Object::Struct - # rest opaque - end - end - end - - class Struct < Object::Struct - include OperationLayout - end - - class ManagedStruct < Object::ManagedStruct - include OperationLayout - end - - def initialize value - # allow init with a pointer so we can wrap the return values from - # things like _build - if value.is_a? String - value = Vips.vips_operation_new value - raise Vips::Error if value.null? - end - - super value - end - - def build - op = Vips.vips_cache_operation_build self - if op.null? - Vips.vips_object_unref_outputs self - raise Vips::Error - end - - Operation.new op - end - - def argument_map &block - fn = proc do |_op, pspec, argument_class, argument_instance, _a, _b| - block.call pspec, argument_class, argument_instance - end - Vips.vips_argument_map self, fn, nil, nil - end - - # Search an object for the first element to match a predicate. Search - # inside subarrays and sub-hashes. Equlvalent to x.flatten.find{}. - def self.flat_find object, &block - if object.respond_to? :each - object.each do |x| - result = flat_find x, &block - return result unless result.nil? - end - elsif yield object - return object - end - - nil - end - - # expand a constant into an image - def self.imageize match_image, value - return value if value.is_a?(Image) || value.is_a?(MutableImage) - - # 2D array values become tiny 2D images - # if there's nothing to match to, we also make a 2D image - if (value.is_a?(Array) && value[0].is_a?(Array)) || match_image.nil? - Image.new_from_array value - else - # we have a 1D array ... use that as a pixel constant and - # expand to match match_image - match_image.new_from_image value - end - end - - # set an operation argument, expanding constants and copying images as - # required - def set name, value, match_image, flags, gtype, destructive - if gtype == IMAGE_TYPE - value = Operation.imageize match_image, value - - # in non-destructive mode, make sure we have a unique copy - if (flags & ARGUMENT_MODIFY) != 0 && - !destructive - value = value.copy.copy_memory - end - elsif gtype == ARRAY_IMAGE_TYPE - value = value.map { |x| Operation.imageize match_image, x } - end - - super name, value - end - - public - - # This is the public entry point for the vips binding. {call} will run - # any vips operation, for example: - # - # ```ruby - # out = Vips::Operation.call "black", [100, 100], {:bands => 12} - # ``` - # - # will call the C function - # - # ```C - # vips_black( &out, 100, 100, "bands", 12, NULL ); - # ``` - # - # There are {Image#method_missing} hooks which will run {call} for you - # on {Image} for undefined instance or class methods. So you can also - # write: - # - # ```ruby - # out = Vips::Image.black 100, 100, bands: 12 - # ``` - # - # Or perhaps: - # - # ```ruby - # x = Vips::Image.black 100, 100 - # y = x.invert - # ``` - # - # to run the `vips_invert()` operator. - # - # There are also a set of operator overloads and some convenience - # functions, see {Image}. - # - # If the operator needs a vector constant, {call} will turn a scalar - # into a - # vector for you. So for `x.linear a, b`, which calculates - # `x * a + b` where `a` and `b` are vector constants, you can write: - # - # ```ruby - # x = Vips::Image.black 100, 100, bands: 3 - # y = x.linear 1, 2 - # y = x.linear [1], 4 - # y = x.linear [1, 2, 3], 4 - # ``` - # - # or any other combination. The operator overloads use this facility to - # support all the variations on: - # - # ```ruby - # x = Vips::Image.black 100, 100, bands: 3 - # y = x * 2 - # y = x + [1,2,3] - # y = x % [1] - # ``` - # - # Similarly, wherever an image is required, you can use a constant. The - # constant will be expanded to an image matching the first input image - # argument. For example, you can write: - # - # ``` - # x = Vips::Image.black 100, 100, bands: 3 - # y = x.bandjoin 255 - # ``` - # - # to add an extra band to the image where each pixel in the new band has - # the constant value 255. - - def self.call name, supplied, optional = {}, option_string = "" - GLib.logger.debug("Vips::VipsOperation.call") { - "name = #{name}, supplied = #{supplied}, " \ - "optional = #{optional}, option_string = #{option_string}" - } - - introspect = Introspect.get name - required_input = introspect.required_input - required_output = introspect.required_output - optional_input = introspect.optional_input - optional_output = introspect.optional_output - destructive = introspect.destructive - - unless supplied.is_a? Array - raise Vips::Error, "unable to call #{name}: " \ - "argument array is not an array" - end - unless optional.is_a? Hash - raise Vips::Error, "unable to call #{name}: " \ - "optional arguments are not a hash" - end - - if supplied.length != required_input.length - raise Vips::Error, "unable to call #{name}: " \ - "you supplied #{supplied.length} arguments, " \ - "but operation needs #{required_input.length}." - end - - # all supplied_optional keys should be in optional_input or - # optional_output - optional.each do |key, _value| - arg_name = key.to_s - - unless optional_input.has_key?(arg_name) || - optional_output.has_key?(arg_name) - raise Vips::Error, "unable to call #{name}: " \ - "unknown option #{arg_name}" - end - end - - # the first image arg is the thing we expand constants to match ... - # we need to find it - # - # look inside array and hash arguments, since we may be passing an - # array of images - # - # also enforce the rules around mutable and non-mutable images - match_image = nil - flat_find(supplied) do |value| - if match_image - # no non-first image arg can ever be mutable - if value.is_a?(MutableImage) - raise Vips::Error, "unable to call #{name}: " \ - "only the first image argument can be mutable" - end - elsif destructive - if value.is_a?(Image) - raise Vips::Error, "unable to call #{name}: " \ - "first image argument to a destructive " \ - "operation must be mutable" - elsif value.is_a?(MutableImage) - match_image = value - end - elsif value.is_a?(MutableImage) - # non destructive operation, so no mutable images - raise Vips::Error, "unable to call #{name}: " \ - "must not pass mutable images to " \ - "non-destructive operations" - elsif value.is_a?(Image) - match_image = value - end - - # keep looping - false - end - - op = Operation.new introspect.vips_name - - # set any string args first so they can't be overridden - unless option_string.nil? - if Vips.vips_object_set_from_string(op, option_string) != 0 - raise Vips::Error - end - end - - # collect a list of all input references here - references = Set.new - - add_reference = lambda do |x| - if x.is_a?(Vips::Image) - x.references.each do |i| - references << i - end - end - false - end - - # set all required inputs - required_input.each_index do |i| - details = required_input[i] - arg_name = details[:arg_name] - flags = details[:flags] - gtype = details[:gtype] - value = supplied[i] - - flat_find value, &add_reference - op.set arg_name, value, match_image, flags, gtype, destructive - end - - # set all optional inputs - optional.each do |key, value| - next if value.nil? - - arg_name = key.to_s - - if optional_input.has_key? arg_name - details = optional_input[arg_name] - flags = details[:flags] - gtype = details[:gtype] - - flat_find value, &add_reference - op.set arg_name, value, match_image, flags, gtype, destructive - end - end - - op = op.build - - # attach all input refs to output x - set_reference = lambda do |x| - if x.is_a? Vips::Image - x.references += references - end - false - end - - # get all required results - result = [] - required_output.each do |details| - value = details[:arg_name] - flat_find value, &set_reference - result << op.get(value) - end - - # fetch all optional ones - optional_results = {} - optional.each do |key, _value| - arg_name = key.to_s - - if optional_output.has_key? arg_name - value = op.get arg_name - flat_find value, &set_reference - optional_results[arg_name] = value - end - end - - result << optional_results if optional_results != {} - - if result.length == 1 - result = result.first - elsif result.length == 0 - result = nil - end - - GLib.logger.debug("Vips::Operation.call") { "result = #{result}" } - - Vips.vips_object_unref_outputs op - - result - end - end -end diff --git a/lib/vips/operationboolean.rb b/lib/vips/operationboolean.rb deleted file mode 100644 index 1cedd605..00000000 --- a/lib/vips/operationboolean.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Vips - # The type of boolean operation to perform on an image. See - # {Image#boolean}. - # - # * ':and' bitwise and - # * ':or' bitwise or - # * ':eor' bitwise eor - # * ':lshift' shift left n bits - # * ':rshift' shift right n bits - - class OperationBoolean < Symbol - end -end diff --git a/lib/vips/operationcomplex.rb b/lib/vips/operationcomplex.rb deleted file mode 100644 index c182930a..00000000 --- a/lib/vips/operationcomplex.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Vips - # The type of complex operation to perform on an image. See - # {Image#complex}. - # - # * ':polar' to polar coordinates - # * ':rect' to rectangular coordinates - # * ':conj' complex conjugate - - class OperationComplex < Symbol - end -end diff --git a/lib/vips/operationcomplex2.rb b/lib/vips/operationcomplex2.rb deleted file mode 100644 index 35767a6a..00000000 --- a/lib/vips/operationcomplex2.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Vips - # The type of binary complex operation to perform on an image. See - # {Image#complex2}. - # - # * ':cross_phase' cross phase - - class OperationComplex2 < Symbol - end -end diff --git a/lib/vips/operationcomplexget.rb b/lib/vips/operationcomplexget.rb deleted file mode 100644 index 8bb083c4..00000000 --- a/lib/vips/operationcomplexget.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Vips - # The type of complex projection operation to perform on an image. See - # {Image#complexget}. - # - # * ':real' get real part - # * ':imag' get imaginary part - - class OperationComplexget < Symbol - end -end diff --git a/lib/vips/operationmath.rb b/lib/vips/operationmath.rb deleted file mode 100644 index bd29d600..00000000 --- a/lib/vips/operationmath.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Vips - # The math operation to perform on an image. See {Image#math}. - # - # * ':sin' sin(), angles in degrees - # * ':cos' cos(), angles in degrees - # * ':tan' tan(), angles in degrees - # * ':asin' asin(), angles in degrees - # * ':acos' acos(), angles in degrees - # * ':atan' atan(), angles in degrees - # * ':log' log base e - # * ':log10' log base 10 - # * ':exp' e to the something - # * ':exp10' 10 to the something - - class OperationMath < Symbol - end -end diff --git a/lib/vips/operationmath2.rb b/lib/vips/operationmath2.rb deleted file mode 100644 index 87fa1368..00000000 --- a/lib/vips/operationmath2.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Vips - # The binary math operation to perform on an image. See {Image#math2}. - # - # * ':pow' pow() - # * ':wop' pow(), but with the arguments reversed - - class OperationMath2 < Symbol - end -end diff --git a/lib/vips/operationrelational.rb b/lib/vips/operationrelational.rb deleted file mode 100644 index 21924515..00000000 --- a/lib/vips/operationrelational.rb +++ /dev/null @@ -1,14 +0,0 @@ -module Vips - # The type of relational operation to perform on an image. See - # {Image#relational}. - # - # * ':more' more than - # * ':less' less than - # * ':moreeq' more than or equal to - # * ':lesseq' less than or equal to - # * ':equal' equal to - # * ':noteq' not equal to - - class OperationRelational < Symbol - end -end diff --git a/lib/vips/operationround.rb b/lib/vips/operationround.rb deleted file mode 100644 index 81657c3d..00000000 --- a/lib/vips/operationround.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Vips - # The type of rounding to perform on an image. See {Image#round}. - # - # * ':ceil' round up - # * ':floor' round down - # * ':rint' round to nearest integer - - class OperationRound < Symbol - end -end diff --git a/lib/vips/region.rb b/lib/vips/region.rb deleted file mode 100644 index 92d08a0d..00000000 --- a/lib/vips/region.rb +++ /dev/null @@ -1,73 +0,0 @@ -# This module provides an interface to the top level bits of libvips -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module Vips - attach_function :vips_region_new, [:pointer], :pointer - - if Vips.at_least_libvips?(8, 8) - attach_function :vips_region_fetch, [:pointer, :int, :int, :int, :int, SizeStruct.ptr], :pointer - attach_function :vips_region_width, [:pointer], :int - attach_function :vips_region_height, [:pointer], :int - end - - # A region on an image. Create one, then use `fetch` to quickly get a region - # of pixels. - # - # For example: - # - # ```ruby - # region = Vips::Region.new(image) - # pixels = region.fetch(10, 10, 100, 100) - # ``` - class Region < Vips::Object - # The layout of the VipsRegion struct. - module RegionLayout - def self.included(base) - base.class_eval do - layout :parent, Vips::Object::Struct - # rest opaque - end - end - end - - class Struct < Vips::Object::Struct - include RegionLayout - end - - class ManagedStruct < Vips::Object::ManagedStruct - include RegionLayout - end - - def initialize(name) - ptr = Vips.vips_region_new name - raise Vips::Error if ptr.null? - - super ptr - end - - def width - Vips.vips_region_width self - end - - def height - Vips.vips_region_height self - end - - # Fetch a region filled with pixel data. - def fetch(left, top, width, height) - len = Vips::SizeStruct.new - ptr = Vips.vips_region_fetch self, left, top, width, height, len - raise Vips::Error if ptr.null? - - # wrap up as an autopointer - ptr = FFI::AutoPointer.new(ptr, GLib::G_FREE) - - ptr.get_bytes 0, len[:value] - end - end -end diff --git a/lib/vips/size.rb b/lib/vips/size.rb deleted file mode 100644 index ce92b5c2..00000000 --- a/lib/vips/size.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Vips - # Controls whether an operation should upsize, downsize, or both up and - # downsize. - # - # * `:both` size both up and down - # * `:up` only upsize - # * `:down` only downsize - # * `:force` change aspect ratio - - class Size < Symbol - end -end diff --git a/lib/vips/source.rb b/lib/vips/source.rb deleted file mode 100644 index a2526977..00000000 --- a/lib/vips/source.rb +++ /dev/null @@ -1,88 +0,0 @@ -# This module provides an interface to the top level bits of libvips -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module Vips - if Vips.at_least_libvips?(8, 9) - attach_function :vips_source_new_from_descriptor, [:int], :pointer - attach_function :vips_source_new_from_file, [:pointer], :pointer - attach_function :vips_source_new_from_memory, [:pointer, :size_t], :pointer - end - - # A source. For example: - # - # ```ruby - # source = Vips::Source.new_from_file("k2.jpg") - # image = Vips::Image.new_from_source(source) - # ``` - class Source < Vips::Connection - module SourceLayout - def self.included(base) - base.class_eval do - layout :parent, Vips::Connection::Struct - # rest opaque - end - end - end - - class Struct < Vips::Connection::Struct - include SourceLayout - end - - class ManagedStruct < Vips::Connection::ManagedStruct - include SourceLayout - end - - # Create a new source from a file descriptor. File descriptors are - # small integers, for example 0 is stdin. - # - # Pass sources to {Image.new_from_source} to load images from - # them. - # - # @param descriptor [Integer] the file descriptor - # @return [Source] the new Vips::Source - def self.new_from_descriptor(descriptor) - ptr = Vips.vips_source_new_from_descriptor descriptor - raise Vips::Error if ptr.null? - - Vips::Source.new ptr - end - - # Create a new source from a file name. - # - # Pass sources to {Image.new_from_source} to load images from - # them. - # - # @param filename [String] the name of the file - # @return [Source] the new Vips::Source - def self.new_from_file(filename) - raise Vips::Error, "filename is nil" if filename.nil? - ptr = Vips.vips_source_new_from_file filename - raise Vips::Error if ptr.null? - - Vips::Source.new ptr - end - - # Create a new source from an area of memory. Memory areas can be - # strings, arrays and so forth -- anything that supports bytesize. - # - # Pass sources to {Image.new_from_source} to load images from - # them. - # - # @param data [String] memory area - # @return [Source] the new Vips::Source - def self.new_from_memory(data) - ptr = Vips.vips_source_new_from_memory data, data.bytesize - raise Vips::Error if ptr.null? - - # FIXME do we need to keep a ref to the underlying memory area? what - # about Image.new_from_buffer? Does that need a secret ref too? - - Vips::Source.new ptr - end - end -end diff --git a/lib/vips/sourcecustom.rb b/lib/vips/sourcecustom.rb deleted file mode 100644 index 48d5a05c..00000000 --- a/lib/vips/sourcecustom.rb +++ /dev/null @@ -1,89 +0,0 @@ -# This module provides an interface to the top level bits of libvips -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module Vips - if Vips.at_least_libvips?(8, 9) - attach_function :vips_source_custom_new, [], :pointer - end - - # A source you can attach action signal handlers to to implement - # custom input types. - # - # For example: - # - # ```ruby - # file = File.open "some/file/name", "rb" - # source = Vips::SourceCustom.new - # source.on_read { |length| file.read length } - # image = Vips::Image.new_from_source source - # ``` - # - # (just an example -- of course in practice you'd use {Source#new_from_file} - # to read from a named file) - class SourceCustom < Vips::Source - module SourceCustomLayout - def self.included(base) - base.class_eval do - layout :parent, Vips::Source::Struct - # rest opaque - end - end - end - - class Struct < Vips::Source::Struct - include SourceCustomLayout - end - - class ManagedStruct < Vips::Source::ManagedStruct - include SourceCustomLayout - end - - def initialize - pointer = Vips.vips_source_custom_new - raise Vips::Error if pointer.null? - - super pointer - end - - # The block is executed to read data from the source. The interface is - # exactly as IO::read, ie. it takes a maximum number of bytes to read and - # returns a string of bytes from the source, or nil if the source is already - # at end of file. - # - # @yieldparam length [Integer] Read and return up to this many bytes - # @yieldreturn [String] Up to length bytes of data, or nil for EOF - def on_read &block - signal_connect "read" do |buf, len| - chunk = block.call len - return 0 if chunk.nil? - bytes_read = chunk.bytesize - buf.put_bytes(0, chunk, 0, bytes_read) - chunk.clear - - bytes_read - end - end - - # The block is executed to seek the source. The interface is exactly as - # IO::seek, ie. it should take an offset and whence, and return the - # new read position. - # - # This handler is optional -- if you do not attach a seek handler, - # {Source} will treat your source like an unseekable pipe object and - # do extra caching. - # - # @yieldparam offset [Integer] Seek offset - # @yieldparam whence [Integer] Seek whence - # @yieldreturn [Integer] the new read position, or -1 on error - def on_seek &block - signal_connect "seek" do |offset, whence| - block.call offset, whence - end - end - end -end diff --git a/lib/vips/target.rb b/lib/vips/target.rb deleted file mode 100644 index 050e2c4a..00000000 --- a/lib/vips/target.rb +++ /dev/null @@ -1,86 +0,0 @@ -# This module provides an interface to the top level bits of libvips -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module Vips - if Vips.at_least_libvips?(8, 9) - attach_function :vips_target_new_to_descriptor, [:int], :pointer - attach_function :vips_target_new_to_file, [:string], :pointer - attach_function :vips_target_new_to_memory, [], :pointer - end - - # A target. For example: - # - # ```ruby - # target = Vips::Target.new_to_file('k2.jpg') - # image.write_to_target(target, '.jpg') - # ``` - class Target < Vips::Connection - # The layout of the VipsRegion struct. - module TargetLayout - def self.included(base) - base.class_eval do - layout :parent, Vips::Connection::Struct - # rest opaque - end - end - end - - class Struct < Vips::Connection::Struct - include TargetLayout - end - - class ManagedStruct < Vips::Connection::ManagedStruct - include TargetLayout - end - - # Create a new target to a file descriptor. File descriptors are - # small integers, for example 1 is stdout. - # - # Pass targets to {Image#write_to_target} to write images to - # them. - # - # @param descriptor [Integer] the file descriptor - # @return [Target] the new Vips::Target - def self.new_to_descriptor(descriptor) - ptr = Vips.vips_target_new_to_descriptor descriptor - raise Vips::Error if ptr.null? - - Vips::Target.new ptr - end - - # Create a new target to a file name. - # - # Pass targets to {Image#write_to_target} to write images to - # them. - # - # @param filename [String] the name of the file - # @return [Target] the new Vips::Target - def self.new_to_file(filename) - raise Vips::Error, "filename is nil" if filename.nil? - ptr = Vips.vips_target_new_to_file filename - raise Vips::Error if ptr.null? - - Vips::Target.new ptr - end - - # Create a new target to an area of memory. - # - # Pass targets to {Image#write_to_target} to write images to - # them. - # - # Once the image has been written, use {Object#get}`("blob")` to read out - # the data. - # - # @return [Target] the new Vips::Target - def self.new_to_memory - ptr = Vips.vips_target_new_to_memory - - Vips::Target.new ptr - end - end -end diff --git a/lib/vips/targetcustom.rb b/lib/vips/targetcustom.rb deleted file mode 100644 index 9f07db75..00000000 --- a/lib/vips/targetcustom.rb +++ /dev/null @@ -1,77 +0,0 @@ -# This module provides an interface to the top level bits of libvips -# via ruby-ffi. -# -# Author:: John Cupitt (mailto:jcupitt@gmail.com) -# License:: MIT - -require "ffi" - -module Vips - if Vips.at_least_libvips?(8, 9) - attach_function :vips_target_custom_new, [], :pointer - end - - # A target you can attach action signal handlers to to implememt - # custom output types. - # - # For example: - # - # ```ruby - # file = File.open "some/file/name", "wb" - # target = Vips::TargetCustom.new - # target.on_write { |bytes| file.write bytes } - # image.write_to_target target, ".png" - # ``` - # - # (just an example -- of course in practice you'd use {Target#new_to_file} - # to write to a named file) - class TargetCustom < Vips::Target - module TargetCustomLayout - def self.included(base) - base.class_eval do - layout :parent, Vips::Target::Struct - # rest opaque - end - end - end - - class Struct < Vips::Target::Struct - include TargetCustomLayout - end - - class ManagedStruct < Vips::Target::ManagedStruct - include TargetCustomLayout - end - - def initialize - pointer = Vips.vips_target_custom_new - raise Vips::Error if pointer.null? - - super pointer - end - - # The block is executed to write data to the source. The interface is - # exactly as IO::write, ie. it should write the string and return the - # number of bytes written. - # - # @yieldparam bytes [String] Write these bytes to the file - # @yieldreturn [Integer] The number of bytes written, or -1 on error - def on_write &block - signal_connect "write" do |p, len| - chunk = p.get_bytes(0, len) - bytes_written = block.call chunk - chunk.clear - - bytes_written - end - end - - # The block is executed at the end of write. It should do any necessary - # finishing action, such as closing a file. - def on_finish &block - signal_connect "finish" do - block.call - end - end - end -end diff --git a/lib/vips/version.rb b/lib/vips/version.rb deleted file mode 100644 index efc5ffbd..00000000 --- a/lib/vips/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module Vips - VERSION = "2.1.3" -end diff --git a/method_list.html b/method_list.html new file mode 100644 index 00000000..592467b6 --- /dev/null +++ b/method_list.html @@ -0,0 +1,4147 @@ + + + + + + + + + + + + + + + + + + Method List + + + +
+
+

Method List

+ + + +
+ + +
+ + diff --git a/ruby-vips.gemspec b/ruby-vips.gemspec deleted file mode 100644 index 9e706040..00000000 --- a/ruby-vips.gemspec +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -require_relative "lib/vips/version" - -Gem::Specification.new do |spec| - spec.name = "ruby-vips" - spec.version = Vips::VERSION - spec.summary = "A fast image processing library with low memory needs" - spec.description = <<-DESC.strip - ruby-vips is a binding for the libvips image processing library. It is fast - and it can process large images without loading the whole image in memory. - DESC - spec.homepage = "http://github.com/libvips/ruby-vips" - spec.licenses = ["MIT"] - spec.authors = ["John Cupitt"] - spec.email = ["jcupitt@gmail.com"] - - spec.metadata = { - "bug_tracker_uri" => "https://github.com/libvips/ruby-vips/issues", - "changelog_uri" => - "https://github.com/libvips/ruby-vips/blob/master/CHANGELOG.md", - "documentation_uri" => "https://www.rubydoc.info/gems/ruby-vips", - "homepage_uri" => spec.homepage, - "source_code_uri" => "https://github.com/libvips/ruby-vips", - - "msys2_mingw_dependencies" => "libvips" - } - - spec.require_paths = ["lib"] - spec.extra_rdoc_files = %w[LICENSE.txt README.md TODO] - - spec.files = `git ls-files -z`.split("\x0").reject do |f| - f.match(%r{^(test|spec|features)/}) - end - - spec.required_ruby_version = ">= 2.0.0" - - spec.add_runtime_dependency "ffi", ["~> 1.12"] - - spec.add_development_dependency "rake", ["~> 12.0"] - spec.add_development_dependency "rspec", ["~> 3.3"] - spec.add_development_dependency "yard", ["~> 0.9.11"] - spec.add_development_dependency "bundler", [">= 1.0", "< 3"] - - if Gem.ruby_version >= Gem::Version.new("2.2") - spec.add_development_dependency "standard" - end -end diff --git a/spec/connection_spec.rb b/spec/connection_spec.rb deleted file mode 100644 index c2649e29..00000000 --- a/spec/connection_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require "spec_helper" - -RSpec.describe Vips::Source, version: [8, 9] do - it "can create a source from a descriptor" do - source = Vips::Source.new_from_descriptor(0) - - expect(source) - end - - it "can create a source from a filename" do - source = Vips::Source.new_from_file simg("wagon.jpg") - - expect(source) - end - - it "can't create a source from a bad filename" do - expect { - Vips::Source.new_from_file simg("banana.jpg") - }.to raise_exception(Vips::Error) - end - - it "can create a source from an area of memory" do - str = File.open(simg("wagon.jpg"), "rb").read - source = Vips::Source.new_from_memory str - - expect(source) - end - - it "sources have filenames and nicks" do - source = Vips::Source.new_from_file simg("wagon.jpg") - - expect(source.filename).to eq(simg("wagon.jpg")) - expect(source.nick) - end - - it "can load an image from filename source" do - source = Vips::Source.new_from_file simg("wagon.jpg") - image = Vips::Image.new_from_source source, "" - - expect(image) - expect(image.width).to eq(685) - expect(image.height).to eq(478) - expect(image.bands).to eq(3) - expect(image.avg).to be_within(0.001).of(109.789) - end -end - -RSpec.describe Vips::Target, version: [8, 9] do - it "can create a target to a filename" do - target = Vips::Target.new_to_file timg("x.jpg") - - expect(target) - end - - it "can create a target to a descriptor" do - target = Vips::Target.new_to_descriptor 1 - - expect(target) - end - - it "can create a target to a memory area" do - target = Vips::Target.new_to_memory - - expect(target) - end - - it "can't create a target to a bad filename" do - expect { - Vips::Target.new_to_file "/banana/monkey" - }.to raise_exception(Vips::Error) - end - - it "can save an image to a filename target" do - source = Vips::Source.new_from_file simg("wagon.jpg") - image = Vips::Image.new_from_source source, "" - filename = timg("x4.png") - target = Vips::Target.new_to_file filename - image.write_to_target target, ".png" - - image = Vips::Image.new_from_file filename - expect(image) - expect(image.width).to eq(685) - expect(image.height).to eq(478) - expect(image.bands).to eq(3) - expect(image.avg).to be_within(0.001).of(109.789) - end - - it "can save an image to a memory target" do - source = Vips::Source.new_from_file simg("wagon.jpg") - image = Vips::Image.new_from_source source, "" - target = Vips::Target.new_to_memory - image.write_to_target target, ".png" - memory = target.get("blob") - - image = Vips::Image.new_from_buffer memory, "" - expect(image) - expect(image.width).to eq(685) - expect(image.height).to eq(478) - expect(image.bands).to eq(3) - expect(image.avg).to be_within(0.001).of(109.789) - end -end - -RSpec.describe Vips::SourceCustom, version: [8, 9] do - it "can create a custom source" do - source = Vips::SourceCustom.new - - expect(source) - end - - it "can load a custom source" do - file = File.open simg("wagon.jpg"), "rb" - source = Vips::SourceCustom.new - source.on_read { |length| file.read length } - source.on_seek { |offset, whence| file.seek(offset, whence) } - image = Vips::Image.new_from_source source, "" - - expect(image) - expect(image.width).to eq(685) - expect(image.height).to eq(478) - expect(image.bands).to eq(3) - expect(image.avg).to be_within(0.001).of(109.789) - end - - it "on_seek is optional" do - file = File.open simg("wagon.jpg"), "rb" - source = Vips::SourceCustom.new - source.on_read { |length| file.read length } - image = Vips::Image.new_from_source source, "" - - expect(image) - expect(image.width).to eq(685) - expect(image.height).to eq(478) - expect(image.bands).to eq(3) - expect(image.avg).to be_within(0.001).of(109.789) - end - - it "can create a user output stream" do - target = Vips::TargetCustom.new - - expect(target) - end - - it "can write an image to a user output stream" do - filename = timg("x5.png") - file = File.open filename, "wb" - target = Vips::TargetCustom.new - target.on_write { |chunk| file.write(chunk) } - target.on_finish { file.close } - image = Vips::Image.new_from_file simg("wagon.jpg") - image.write_to_target target, ".png" - - image = Vips::Image.new_from_file filename - expect(image) - expect(image.width).to eq(685) - expect(image.height).to eq(478) - expect(image.bands).to eq(3) - expect(image.avg).to be_within(0.001).of(109.789) - end -end diff --git a/spec/image_spec.rb b/spec/image_spec.rb deleted file mode 100644 index f1d49f64..00000000 --- a/spec/image_spec.rb +++ /dev/null @@ -1,739 +0,0 @@ -require "spec_helper" - -def has_jpeg? - Vips.type_find("VipsOperation", "jpegload") != nil -end - -RSpec.describe Vips::Image do - it "can save an image to a file" do - filename = timg "x.v" - - image = Vips::Image.black(16, 16) + 128 - image.write_to_file filename - - expect(File.exist?(filename)).to be true - end - - it "can load an image from a file" do - filename = timg "x.v" - - image = Vips::Image.black(16, 16) + 128 - image.write_to_file(filename) - - x = Vips::Image.new_from_file filename - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(1) - expect(x.avg).to eq(128) - end - - it "can load an image from memory" do - image = Vips::Image.black(16, 16) + 128 - data = image.write_to_memory - - x = Vips::Image.new_from_memory data, - image.width, image.height, image.bands, image.format - - # GC to try to trigger a segv if data hasn't been reffed by - # new_from_memory - GC.start - - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(1) - expect(x.avg).to eq(128) - end - - it "can load an image from memory by memory pointer" do - data = FFI::MemoryPointer.new(:uchar, 16 * 16) - data.put_array_of_uchar(0, Array.new(16 * 16, 128)) - - x = Vips::Image.new_from_memory data, 16, 16, 1, :uchar - - # GC to try to trigger a segv if data hasn't been reffed by - # new_from_memory - GC.start - - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(1) - expect(x.avg).to eq(128) - end - - it "can load an image from memory by size aware address pointer" do - memory = FFI::MemoryPointer.new(:uchar, 16 * 16) - memory.put_array_of_uchar(0, Array.new(16 * 16, 128)) - - data = FFI::Pointer.new(memory) - # JRuby's FFI implementation loses the size information - data = data.slice(0, 16 * 16) if defined?(JRUBY_VERSION) - - x = Vips::Image.new_from_memory data, 16, 16, 1, :uchar - - # GC to try to trigger a segv if data hasn't been reffed by - # new_from_memory - GC.start - - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(1) - expect(x.avg).to eq(128) - end - - it "throws an error when trying to load an image from memory with unknown size" do - data = FFI::Pointer.new(1) - expect { Vips::Image.new_from_memory(data, 16, 16, 1, :uchar) }.to raise_error(Vips::Error) - end - - it "can load an image from memory and copy" do - image = Vips::Image.black(16, 16) + 128 - data = image.write_to_memory - - x = Vips::Image.new_from_memory_copy data, - image.width, image.height, image.bands, image.format - - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(1) - expect(x.avg).to eq(128) - end - - it "can load and copy an image from memory by memory pointer" do - data = FFI::MemoryPointer.new(:uchar, 16 * 16) - data.put_array_of_uchar(0, Array.new(16 * 16, 128)) - - x = Vips::Image.new_from_memory_copy data, 16, 16, 1, :uchar - - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(1) - expect(x.avg).to eq(128) - end - - it "can load and copy an image from memory by size aware address pointer" do - memory = FFI::MemoryPointer.new(:uchar, 16 * 16) - memory.put_array_of_uchar(0, Array.new(16 * 16, 128)) - - data = FFI::Pointer.new(memory) - # JRuby's FFI implementation loses the size information - data = data.slice(0, 16 * 16) if defined?(JRUBY_VERSION) - - x = Vips::Image.new_from_memory_copy data, 16, 16, 1, :uchar - - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(1) - expect(x.avg).to eq(128) - end - - it "throws an error when trying to load and copy from memory with unknown size" do - data = FFI::Pointer.new(1) - expect { Vips::Image.new_from_memory_copy(data, 16, 16, 1, :uchar) }.to raise_error(Vips::Error) - end - - if has_jpeg? - it "can save an image to a buffer" do - image = Vips::Image.black(16, 16) + 128 - buffer = image.write_to_buffer ".jpg" - expect(buffer.length).to be > 100 - end - end - - if has_jpeg? - it "can load an image from a buffer" do - image = Vips::Image.black(16, 16) + 128 - buffer = image.write_to_buffer ".jpg" - x = Vips::Image.new_from_buffer buffer, "" - expect(x.width).to eq(16) - expect(x.height).to eq(16) - end - end - - it "can make an image from a 2d array" do - image = Vips::Image.new_from_array [[1, 2], [3, 4]] - expect(image.width).to eq(2) - expect(image.height).to eq(2) - expect(image.bands).to eq(1) - expect(image.avg).to eq(2.5) - end - - it "can make an image from a 1d array" do - image = Vips::Image.new_from_array [1, 2] - expect(image.width).to eq(2) - expect(image.height).to eq(1) - expect(image.bands).to eq(1) - expect(image.avg).to eq(1.5) - end - - it "can use array consts for image args" do - r = Vips::Image.black(16, 16) - r = r.draw_rect 255, 10, 12, 1, 1 - g = Vips::Image.black(16, 16) - g = g.draw_rect 255, 10, 11, 1, 1 - b = Vips::Image.black(16, 16) - b = b.draw_rect 255, 10, 10, 1, 1 - im = r.bandjoin([g, b]) - - expect(im.width).to eq(16) - expect(im.height).to eq(16) - expect(im.bands).to eq(3) - - im = im.conv [ - [0.11, 0.11, 0.11], - [0.11, 0.11, 0.11], - [0.11, 0.11, 0.11] - ], precision: :float - - expect(im.width).to eq(16) - expect(im.height).to eq(16) - expect(im.bands).to eq(3) - end - - it "can set scale and offset on a convolution mask" do - image = Vips::Image.new_from_array [1, 2], 8, 2 - expect(image.width).to eq(2) - expect(image.height).to eq(1) - expect(image.bands).to eq(1) - expect(image.scale).to eq(8) - expect(image.offset).to eq(2) - expect(image.avg).to eq(1.5) - end - - it "supports imagescale" do - image = Vips::Image.new_from_array [1, 2], 8, 2 - image = image.scaleimage - expect(image.width).to eq(2) - expect(image.height).to eq(1) - expect(image.max).to eq(255) - expect(image.min).to eq(0) - end - - if has_jpeg? - it "can load a sample jpg image file" do - x = Vips::Image.new_from_file simg("wagon.jpg") - expect(x.width).to eq(685) - expect(x.height).to eq(478) - expect(x.bands).to eq(3) - expect(x.avg).to be_within(0.001).of(109.789) - end - end - - if has_jpeg? - it "can load a sample jpg image buffer" do - str = File.open(simg("wagon.jpg"), "rb").read - x = Vips::Image.new_from_buffer str, "" - expect(x.width).to eq(685) - expect(x.height).to eq(478) - expect(x.bands).to eq(3) - expect(x.avg).to be_within(0.001).of(109.789) - end - end - - if has_jpeg? - it "can load a sample jpg image utf-8 buffer" do - str = File.open(simg("wagon.jpg"), "r").read - x = Vips::Image.new_from_buffer str, "" - expect(x.width).to eq(685) - expect(x.height).to eq(478) - expect(x.bands).to eq(3) - expect(x.avg).to be_within(0.001).of(109.789) - end - end - - if has_jpeg? - it "can extract an ICC profile from a jpg image" do - x = Vips::Image.new_from_file simg("icc.jpg") - expect(x.width).to eq(2800) - expect(x.height).to eq(2100) - expect(x.bands).to eq(3) - expect(x.avg).to be_within(0.001).of(109.189) - - profile = x.get_value "icc-profile-data" - expect(profile.class).to eq(String) - expect(profile.length).to eq(2360) - end - end - - if has_jpeg? - it "can set an ICC profile on a jpg image" do - x = Vips::Image.new_from_file simg("icc.jpg") - profile = File.open(simg("lcd.icc"), "rb").read - x = x.copy - x.set_value "icc-profile-data", profile - x.write_to_file(timg("x.jpg")) - - x = Vips::Image.new_from_file timg("x.jpg") - expect(x.width).to eq(2800) - expect(x.height).to eq(2100) - expect(x.bands).to eq(3) - expect(x.avg).to be_within(0.1).of(109.189) - - profile = x.get_value "icc-profile-data" - expect(profile.class).to eq(String) - expect(profile.length).to eq(3048) - end - end - - if has_jpeg? - it "can load a sample jpg image" do - x = Vips::Image.new_from_file simg("wagon.jpg") - expect(x.width).to eq(685) - expect(x.height).to eq(478) - expect(x.bands).to eq(3) - expect(x.avg).to be_within(0.001).of(109.789) - end - end - - it "has binary arithmetic operator overloads with constants" do - image = Vips::Image.black(16, 16) + 128 - - image += 128 - image -= 128 - image *= 2 - image /= 2 - image %= 100 - image += 100 - image **= 2 - image **= 0.5 - image <<= 1 - image >>= 1 - image |= 64 - image &= 32 - image ^= 128 - - expect(image.avg).to eq(128) - end - - it "has binary arithmetic operator overloads with array constants" do - image = Vips::Image.black(16, 16, bands: 3) + 128 - - image += [128, 0, 0] - image -= [128, 0, 0] - image *= [2, 1, 1] - image /= [2, 1, 1] - image %= [100, 99, 98] - image += [100, 99, 98] - image **= [2, 3, 4] - image **= [1.0 / 2.0, 1.0 / 3.0, 1.0 / 4.0] - image <<= [1, 2, 3] - image >>= [1, 2, 3] - image |= [64, 128, 256] - image &= [64, 128, 256] - image ^= [64 + 128, 0, 256 + 128] - - expect(image.avg).to eq(128) - end - - it "has binary arithmetic operator overloads with image args" do - image = Vips::Image.black(16, 16) + 128 - x = image - - x += image - x -= image - x *= image - x /= image - x %= image - x += image - x |= image - x &= image - x ^= image - - expect(x.avg).to eq(0) - end - - it "has relational operator overloads with constants" do - image = Vips::Image.black(16, 16) + 128 - - expect((image > 128).avg).to eq(0) - expect((image >= 128).avg).to eq(255) - expect((image < 128).avg).to eq(0) - expect((image <= 128).avg).to eq(255) - expect((image == 128).avg).to eq(255) - expect((image != 128).avg).to eq(0) - end - - it "has relational operator overloads with array constants" do - image = Vips::Image.black(16, 16, bands: 3) + [100, 128, 130] - - expect((image > [100, 128, 130]).avg).to eq(0) - expect((image >= [100, 128, 130]).avg).to eq(255) - expect((image < [100, 128, 130]).avg).to eq(0) - expect((image <= [100, 128, 130]).avg).to eq(255) - expect((image == [100, 128, 130]).avg).to eq(255) - expect((image != [100, 128, 130]).avg).to eq(0) - end - - it "has relational operator overloads with image args" do - image = Vips::Image.black(16, 16) + 128 - - expect((image > image).avg).to eq(0) - expect((image >= image).avg).to eq(255) - expect((image < image).avg).to eq(0) - expect((image <= image).avg).to eq(255) - expect((image == image).avg).to eq(255) - expect((image != image).avg).to eq(0) - end - - it "has band extract with numeric arg" do - image = Vips::Image.black(16, 16, bands: 3) + [100, 128, 130] - x = image[1] - - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(1) - expect(x.avg).to eq(128) - end - - it "has band extract with range arg" do - image = Vips::Image.black(16, 16, bands: 3) + [100, 128, 130] - x = image[1..2] - - expect(x.width).to eq(16) - expect(x.height).to eq(16) - expect(x.bands).to eq(2) - expect(x.avg).to eq(129) - end - - it "has rounding members" do - # need to avoid rounding down to 0.499999 - image = Vips::Image.black(16, 16) + 0.500001 - - expect(image.floor.avg).to eq(0) - expect(image.ceil.avg).to eq(1) - expect(image.rint.avg).to eq(1) - end - - it "has bandsplit and bandjoin" do - image = Vips::Image.black(16, 16, bands: 3) + [100, 128, 130] - - split = image.bandsplit - x = split[0].bandjoin split[1..2] - - expect(x[0].avg).to eq(100) - expect(x[1].avg).to eq(128) - expect(x[2].avg).to eq(130) - end - - it "can bandjoin constants" do - image = Vips::Image.black(16, 16, bands: 3) + [100, 128, 130] - - x = image.bandjoin 255 - - expect(x[0].avg).to eq(100) - expect(x[1].avg).to eq(128) - expect(x[2].avg).to eq(130) - expect(x[3].avg).to eq(255) - expect(x.bands).to eq(4) - - x = image.bandjoin [1, 2] - - expect(x[0].avg).to eq(100) - expect(x[1].avg).to eq(128) - expect(x[2].avg).to eq(130) - expect(x[3].avg).to eq(1) - expect(x[4].avg).to eq(2) - expect(x.bands).to eq(5) - end - - it "can composite", version: [8, 6] do - image = Vips::Image.black(16, 16, bands: 3) + [100, 128, 130] - image = image.copy interpretation: :srgb - base = image + 10 - overlay = image.bandjoin 128 - comb = base.composite overlay, :over - pixel = comb.getpoint(0, 0) - - expect(pixel[0]).to be_within(0.1).of(105) - expect(pixel[1]).to be_within(0.1).of(133) - expect(pixel[2]).to be_within(0.1).of(135) - expect(pixel[3]).to eq(255) - end - - it "has minpos/maxpos" do - image = Vips::Image.black(16, 16) + 128 - image = image.draw_rect 255, 10, 12, 1, 1 - v, x, y = image.maxpos - - expect(v).to eq(255) - expect(x).to eq(10) - expect(y).to eq(12) - - image = Vips::Image.black(16, 16) + 128 - image = image.draw_rect 12, 10, 12, 1, 1 - v, x, y = image.minpos - - expect(v).to eq(12) - expect(x).to eq(10) - expect(y).to eq(12) - end - - it "can form complex images" do - r = Vips::Image.black(16, 16) + 128 - i = Vips::Image.black(16, 16) + 12 - cmplx = r.complexform i - re = cmplx.real - im = cmplx.imag - - expect(re.avg).to eq(128) - expect(im.avg).to eq(12) - end - - it "can convert complex polar <-> rectangular" do - r = Vips::Image.black(16, 16) + 128 - i = Vips::Image.black(16, 16) + 12 - cmplx = r.complexform i - - cmplx = cmplx.rect.polar - - expect(cmplx.real.avg).to be_within(0.001).of(128) - expect(cmplx.imag.avg).to be_within(0.001).of(12) - end - - it "can take complex conjugate" do - r = Vips::Image.black(16, 16) + 128 - i = Vips::Image.black(16, 16) + 12 - cmplx = r.complexform i - - cmplx = cmplx.conj - - expect(cmplx.real.avg).to be_within(0.001).of(128) - expect(cmplx.imag.avg).to be_within(0.001).of(-12) - end - - it "has working trig functions" do - image = Vips::Image.black(16, 16) + 67 - - image = image.sin.cos.tan - image = image.atan.acos.asin - - expect(image.avg).to be_within(0.01).of(67) - end - - it "has working log functions" do - image = Vips::Image.black(16, 16) + 67 - - image = image.log.exp.log10.exp10 - - expect(image.avg).to be_within(0.01).of(67) - end - - it "can flip" do - a = Vips::Image.black(16, 16) - a = a.draw_rect 255, 10, 12, 1, 1 - b = Vips::Image.black(16, 16) - b = b.draw_rect 255, 15 - 10, 12, 1, 1 - - expect((a - b.fliphor).abs.max).to eq(0.0) - - a = Vips::Image.black(16, 16) - a = a.draw_rect 255, 10, 15 - 12, 1, 1 - b = Vips::Image.black(16, 16) - b = b.draw_rect 255, 10, 12, 1, 1 - - expect((a - b.flipver).abs.max).to eq(0.0) - end - - it "can getpoint" do - a = Vips::Image.black(16, 16) - a = a.draw_rect 255, 10, 12, 1, 1 - b = Vips::Image.black(16, 16) - b = b.draw_rect 255, 10, 10, 1, 1 - im = a.bandjoin(b) - - expect(im.getpoint(10, 12)).to eq([255, 0]) - expect(im.getpoint(10, 10)).to eq([0, 255]) - end - - it "can median" do - a = Vips::Image.black(16, 16) - a = a.draw_rect 255, 10, 12, 1, 1 - im = a.median - - expect(im.max).to eq(0) - end - - it "can erode" do - a = Vips::Image.black(16, 16) - a = a.draw_rect 255, 10, 12, 1, 1 - mask = Vips::Image.new_from_array [ - [128, 255, 128], - [255, 255, 255], - [128, 255, 128] - ] - im = a.erode mask - - expect(im.max).to eq(0) - end - - it "can dilate" do - a = Vips::Image.black(16, 16) - a = a.draw_rect 255, 10, 12, 1, 1 - mask = Vips::Image.new_from_array [ - [128, 255, 128], - [255, 255, 255], - [128, 255, 128] - ] - im = a.dilate mask - - expect(im.getpoint(10, 12)).to eq([255]) - expect(im.getpoint(11, 12)).to eq([255]) - expect(im.getpoint(12, 12)).to eq([0]) - end - - it "can rot" do - a = Vips::Image.black(16, 16) - a = a.draw_rect 255, 10, 12, 1, 1 - - im = a.rot90.rot90.rot90.rot90 - expect((a - im).abs.max).to eq(0.0) - - im = a.rot180.rot180 - expect((a - im).abs.max).to eq(0.0) - - im = a.rot270.rot270.rot270.rot270 - expect((a - im).abs.max).to eq(0.0) - end - - it "can bandbool" do - a = Vips::Image.black(16, 16) - a = a.draw_rect 255, 10, 12, 1, 1 - b = Vips::Image.black(16, 16) - b = b.draw_rect 255, 10, 10, 1, 1 - im = a.bandjoin(b) - - expect(im.bandand.getpoint(10, 12)).to eq([0]) - expect(im.bandor.getpoint(10, 12)).to eq([255]) - expect(im.bandeor.getpoint(10, 12)).to eq([255]) - end - - it "ifthenelse with image arguments" do - image = Vips::Image.black(16, 16) - image = image.draw_rect 255, 10, 12, 1, 1 - black = Vips::Image.black(16, 16) - white = Vips::Image.black(16, 16) + 255 - - result = image.ifthenelse black, white - - v, x, y = result.minpos - - expect(v).to eq(0) - expect(x).to eq(10) - expect(y).to eq(12) - end - - it "ifthenelse with constant arguments" do - image = Vips::Image.black(16, 16) - image = image.draw_rect 255, 10, 12, 1, 1 - - result = image.ifthenelse 0, 255 - - v, x, y = result.minpos - - expect(v).to eq(0) - expect(x).to eq(10) - expect(y).to eq(12) - end - - it "ifthenelse with vector arguments" do - image = Vips::Image.black(16, 16) - image = image.draw_rect 255, 10, 12, 1, 1 - white = Vips::Image.black(16, 16) + 255 - - result = image.ifthenelse [255, 0, 0], white - - v, x, y = result.minpos - - expect(v).to eq(0) - expect(x).to eq(10) - expect(y).to eq(12) - end - - it "has a #size method" do - image = Vips::Image.black(200, 100) - expect(image.size).to eq([image.width, image.height]) - end - - it "has #new_from_image method" do - image = Vips::Image.black(200, 100) - - image2 = image.new_from_image 12 - expect(image2.bands).to eq(1) - expect(image2.avg).to eq(12) - - image2 = image.new_from_image [1, 2, 3] - expect(image2.bands).to eq(3) - expect(image2.avg).to eq(2) - end - - it "can make interpolate objects" do - inter = Vips::Interpolate.new "bilinear" - - expect(inter).not_to eq(nil) - end - - it "can call affine with a non-default interpolator" do - image = Vips::Image.black(200, 100) - inter = Vips::Interpolate.new "bilinear" - result = image.affine [2, 0, 0, 2], interpolate: inter - - expect(result.width).to eq(400) - expect(result.height).to eq(200) - end - - it "has a working #to_a" do - image = Vips::Image.black(200, 100) - array = image.to_a - - expect(array.length).to eq(100) - expect(array[0].length).to eq(200) - expect(array[0][0].length).to eq(1) - expect(array[0][0][0]).to eq(0) - end - - it "supports keyword arguments" do - image = Vips::Image.black 200, 200, bands: 12 - - expect(image.width).to eq(200) - expect(image.height).to eq(200) - expect(image.bands).to eq(12) - end - - if has_jpeg? - it "works with arguments containing -" do - image = Vips::Image.black(16, 16) + 128 - buffer = image.write_to_buffer ".jpg", optimize_coding: true - expect(buffer.length).to be > 100 - end - end - - if has_jpeg? - it "can read exif tags" do - x = Vips::Image.new_from_file simg "huge.jpg" - orientation = x.get "exif-ifd0-Orientation" - expect(orientation.length).to be > 20 - expect(orientation.split[0]).to eq("1") - end - end - - # added in 8.5 - if Vips.respond_to? :vips_image_get_fields - it "can read field names" do - x = Vips::Image.black 100, 100 - y = x.get_fields - expect(y.length).to be > 10 - expect(y[0]).to eq("width") - end - end - - it "can has_alpha?" do - x = Vips::Image.new_from_file "./spec/samples/alpha.png" - expect(x.has_alpha?).to be true - end - - it "can add_alpha", version: [8, 6] do - x = Vips::Image.new_from_file "./spec/samples/no_alpha.png" - expect(x.has_alpha?).to be false - y = x.add_alpha - expect(y.has_alpha?).to be true - end -end diff --git a/spec/mutate_spec.rb b/spec/mutate_spec.rb deleted file mode 100644 index 8a866609..00000000 --- a/spec/mutate_spec.rb +++ /dev/null @@ -1,62 +0,0 @@ -require "spec_helper" - -RSpec.describe Vips::MutableImage do - it "can set! metadata in mutate" do - image = Vips::Image.black(16, 16) - image = image.mutate { |x| - x.set_type! GObject::GINT_TYPE, "banana", 12 - } - - expect(image.get("banana")).to eq(12) - end - - it "can remove! metadata in mutate" do - image = Vips::Image.black(16, 16) - image = image.mutate { |x| - x.set_type! GObject::GINT_TYPE, "banana", 12 - } - - image = image.mutate { |x| - x.remove! "banana" - } - - expect(image.get_typeof("banana")).to eq(0) - end - - it "can call destructive operations in mutate" do - image = Vips::Image.black(16, 16) - image = image.mutate { |x| - x.draw_line! 255, 0, 0, x.width, x.height - } - - expect(image.avg).to be > 0 - end - - it "cannot call non-destructive operations in mutate" do - image = Vips::Image.black(16, 16) - - expect { - image = image.mutate { |x| - x.invert - } - }.to raise_exception(Vips::Error) - end - - it "cannot use mutable images as arguments in mutate" do - image = Vips::Image.black(16, 16) - - expect { - image = image.mutate { |x| - x.draw_image! x, 10, 10 - } - }.to raise_exception(Vips::Error) - end - - it "cannot call destructive operations outside mutate" do - image = Vips::Image.black(16, 16) - - expect { - image.draw_line! 255, 0, 0, image.width, image.height - }.to raise_exception(Vips::Error) - end -end diff --git a/spec/region_spec.rb b/spec/region_spec.rb deleted file mode 100644 index cc14ee9f..00000000 --- a/spec/region_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require "spec_helper" - -RSpec.describe Vips::Region do - it "can create a region on an image" do - image = Vips::Image.black(100, 100) - region = Vips::Region.new image - - expect(region) - end - - it "can fetch pixels from a region", version: [8, 8] do - image = Vips::Image.black(100, 100) - region = Vips::Region.new image - pixel_data = region.fetch 10, 20, 30, 40 - - expect(pixel_data) - expect(pixel_data.length == 30 * 40) - end - - it "can make regions with width and height", version: [8, 8] do - image = Vips::Image.black(100, 100) - region = Vips::Region.new image - pixel_data = region.fetch 10, 20, 30, 40 - - expect(pixel_data) - expect(region.width == 30) - expect(region.height == 40) - end -end diff --git a/spec/samples/alpha.png b/spec/samples/alpha.png deleted file mode 100644 index 8b28133b..00000000 Binary files a/spec/samples/alpha.png and /dev/null differ diff --git a/spec/samples/balloon.v b/spec/samples/balloon.v deleted file mode 100644 index 20c367cc..00000000 Binary files a/spec/samples/balloon.v and /dev/null differ diff --git a/spec/samples/ghost.ppm b/spec/samples/ghost.ppm deleted file mode 100644 index c9c2e9c2..00000000 --- a/spec/samples/ghost.ppm +++ /dev/null @@ -1,405 +0,0 @@ -P3 -# Created by Paint Shop Pro 7 -49 52 -255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 248 248 248 204 255 255 204 236 255 -204 236 255 204 255 255 204 236 255 241 241 241 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 241 241 241 241 241 241 255 251 240 -248 248 248 248 248 248 248 248 248 241 241 241 255 251 240 248 248 248 -255 251 240 248 248 248 204 236 255 102 204 255 51 204 255 0 204 255 0 204 255 -0 204 255 0 204 204 0 204 255 51 204 255 102 204 204 204 236 255 248 248 248 -255 251 240 255 251 240 248 248 248 248 248 248 248 248 248 248 248 248 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 251 240 -248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 248 248 248 241 241 241 255 251 240 248 248 248 -255 255 255 248 248 248 255 251 240 248 248 248 255 255 255 241 241 241 -51 204 255 0 204 204 0 204 255 0 204 255 0 204 255 0 204 204 0 204 204 -51 153 204 0 204 255 0 204 255 0 204 255 0 204 204 51 204 204 153 255 255 -248 248 248 255 251 240 241 241 241 248 248 248 248 248 248 255 251 240 -255 251 240 255 255 255 248 248 248 248 248 248 255 251 240 204 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 248 248 248 255 255 255 248 248 248 255 255 255 -248 248 248 255 251 240 255 255 255 166 202 240 0 204 255 0 153 204 0 102 204 -0 153 204 0 204 255 0 153 153 51 102 153 51 51 102 0 102 102 0 204 204 -0 204 204 0 204 255 0 204 255 0 204 255 0 204 204 102 204 255 255 255 255 -255 255 204 255 251 240 255 251 240 255 251 240 255 251 240 255 251 240 -248 248 248 248 248 248 248 248 248 255 251 240 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 251 240 255 251 240 255 255 255 -153 255 255 51 204 255 51 204 255 0 153 204 0 102 153 51 51 102 160 160 164 -255 204 255 241 241 241 204 255 255 234 234 234 160 160 164 51 51 102 51 102 153 -0 204 255 0 204 255 0 204 255 51 153 255 204 236 255 241 241 241 255 255 255 -255 255 255 241 241 241 204 236 255 255 251 240 255 255 204 255 251 240 -255 255 255 241 241 241 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 251 240 255 255 255 255 255 255 -255 255 255 255 251 240 248 248 248 204 255 255 51 204 204 0 204 255 51 153 153 -0 128 128 51 153 153 204 236 255 255 251 240 255 255 204 255 255 204 255 255 204 -255 251 240 255 251 240 241 241 241 102 102 153 51 153 204 0 204 204 0 204 255 -51 204 255 51 204 255 51 255 255 51 255 255 51 204 255 51 204 255 0 204 255 -102 204 255 241 241 241 248 248 248 248 248 248 248 248 248 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 251 240 255 255 255 255 255 255 255 255 255 255 255 255 241 241 241 -102 204 204 0 204 204 0 153 204 0 51 51 102 153 153 241 241 241 241 241 241 -255 251 240 255 255 204 255 255 204 255 251 240 255 251 240 204 255 204 -255 255 204 255 251 240 119 119 119 0 128 128 0 153 204 0 204 255 0 204 255 -0 204 255 0 204 255 0 128 128 0 102 102 0 153 204 0 204 255 102 204 255 -234 234 234 241 241 241 255 255 204 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 251 240 255 255 255 204 255 255 51 204 204 0 204 255 51 204 255 -102 102 102 248 248 248 241 241 241 255 251 240 255 251 240 255 251 240 -255 251 240 255 251 240 255 251 240 231 231 214 255 255 204 255 255 204 -255 255 255 57 57 57 51 102 153 0 204 204 0 204 255 0 204 255 0 204 255 -51 102 102 66 66 66 51 204 204 0 204 255 0 204 255 51 204 204 153 255 255 -241 241 241 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 248 248 248 255 255 255 248 248 248 255 251 240 -255 255 255 153 204 255 0 204 255 0 204 255 0 51 102 204 204 204 255 255 255 -255 251 240 241 241 241 255 251 240 255 251 240 255 251 240 255 251 240 -255 251 240 241 241 241 255 251 240 255 255 204 255 255 204 234 234 234 -0 51 102 51 204 204 0 204 255 51 204 255 51 153 204 51 51 0 102 51 51 66 66 66 -51 153 153 51 204 204 0 204 255 0 153 255 102 204 204 248 248 248 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 248 248 248 255 251 240 255 255 255 102 204 255 0 204 255 0 204 255 -51 51 102 248 248 248 255 251 240 255 251 240 255 251 240 255 255 204 255 255 204 -255 255 204 255 251 240 255 251 240 248 248 248 102 102 102 239 214 198 -255 251 240 255 255 255 102 153 204 0 204 204 0 204 204 51 102 153 153 102 51 -255 102 51 255 102 51 255 102 51 204 102 51 153 102 51 51 153 153 0 204 255 -0 204 204 153 204 204 248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 248 248 248 255 255 255 255 251 240 255 255 255 248 248 248 -51 204 255 0 204 255 0 204 255 51 153 153 241 241 241 255 255 204 255 255 204 -255 251 240 255 251 240 255 255 204 255 255 204 102 102 102 204 204 204 -231 231 214 102 102 153 57 57 57 255 251 240 255 251 240 204 236 255 0 128 128 -51 153 102 255 124 128 204 102 51 204 51 51 255 102 51 204 51 0 204 102 51 -255 102 51 204 102 51 0 204 204 51 204 255 0 204 255 204 236 255 255 251 240 -255 251 240 248 248 248 255 255 255 255 255 255 248 248 248 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 248 248 248 255 255 255 -255 251 240 255 255 255 248 248 248 51 204 204 0 204 255 0 204 255 0 102 153 -248 248 248 255 255 204 255 255 204 255 251 240 255 251 240 255 251 240 -231 231 214 150 150 150 22 22 22 234 234 234 51 51 102 51 51 51 255 251 240 -255 251 240 241 241 241 57 57 57 255 204 153 255 102 51 102 51 51 204 102 102 -204 51 51 153 102 51 153 51 51 255 102 51 255 102 51 85 85 85 0 204 255 -0 204 255 153 204 255 255 251 240 255 251 240 255 255 255 255 255 255 255 255 255 -255 255 255 248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 248 248 248 255 255 255 255 255 255 248 248 248 51 204 204 -0 204 255 0 204 204 0 102 153 248 248 248 255 255 204 255 255 204 255 251 240 -255 251 240 255 251 240 215 215 215 95 95 95 51 0 51 248 248 248 128 128 128 -150 150 150 255 251 240 255 251 240 255 204 204 204 51 51 255 102 51 204 102 0 -204 153 0 204 102 0 153 51 0 255 153 51 255 102 51 255 102 51 255 102 51 -204 102 51 0 204 204 0 204 255 153 204 255 255 251 240 255 251 240 255 255 255 -255 255 255 255 255 255 255 251 240 248 248 248 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 248 248 248 -248 248 248 51 204 204 0 204 255 0 204 255 0 102 153 227 227 227 255 255 204 -255 251 240 255 251 240 255 251 240 255 251 240 255 251 240 178 178 178 -160 160 164 255 255 204 160 160 164 255 255 255 255 251 240 255 255 204 -255 204 204 204 102 51 255 102 51 153 102 51 153 102 51 153 51 51 153 102 51 -204 51 51 204 102 0 153 102 0 255 102 51 255 102 0 0 153 204 0 204 255 -153 204 255 248 248 248 255 255 255 255 255 255 248 248 248 255 255 255 -255 251 240 248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 -248 248 248 255 255 255 248 248 248 248 248 248 248 248 248 102 204 255 -0 204 255 0 204 255 0 102 153 192 192 192 255 251 240 255 251 240 255 251 240 -255 251 240 255 251 240 255 255 204 255 255 204 255 255 255 227 227 227 -153 102 204 102 102 153 215 215 215 255 251 240 255 251 240 204 153 102 -204 153 51 153 102 51 204 204 51 204 204 51 204 153 51 153 153 0 255 255 51 -153 102 0 255 102 51 255 51 51 0 153 255 51 204 204 204 255 255 255 255 255 -255 255 255 255 255 255 248 248 248 248 248 248 255 251 240 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -248 248 248 255 251 240 255 255 255 153 204 255 0 204 204 0 204 255 0 153 204 -102 153 153 241 241 241 255 251 240 255 251 240 255 251 240 255 255 204 -255 255 204 255 255 204 248 248 248 102 102 153 153 102 255 153 102 255 -51 102 153 255 251 240 255 255 204 239 214 198 153 102 51 255 102 51 204 204 51 -153 102 0 204 153 51 204 204 51 153 153 0 204 102 51 255 102 102 102 51 51 -0 204 255 51 204 204 248 248 248 248 248 248 248 248 248 255 255 255 248 248 248 -248 248 248 255 251 240 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 251 240 255 255 255 248 248 248 255 251 240 255 255 255 -204 255 255 0 204 204 0 204 255 0 204 255 102 153 153 204 236 255 255 251 240 -255 255 204 255 255 204 255 251 240 255 255 204 255 251 240 150 150 150 -102 102 204 153 102 255 153 102 255 102 102 153 215 215 215 255 251 240 -255 255 204 102 51 51 204 102 102 204 102 51 204 51 51 153 51 51 153 51 0 -204 153 51 204 102 102 102 51 102 51 204 204 0 204 204 153 255 255 255 255 255 -255 251 240 255 251 240 255 255 255 248 248 248 241 241 241 255 251 240 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 251 240 -255 255 255 248 248 248 255 251 240 248 248 248 204 255 255 51 204 204 -0 204 255 0 204 255 51 102 102 166 202 240 255 251 240 255 255 204 255 251 240 -248 248 248 255 251 240 215 215 215 0 0 102 0 51 102 0 0 204 102 102 255 -102 102 153 192 192 192 255 251 240 255 251 240 134 134 134 51 153 204 -102 51 0 153 51 102 204 102 102 204 102 51 102 51 51 85 85 85 51 204 204 -0 204 255 51 204 204 248 248 248 241 241 241 255 251 240 255 251 240 255 255 255 -248 248 248 241 241 241 255 251 240 248 248 248 255 255 255 255 255 255 -255 255 255 255 255 255 255 251 240 255 255 255 248 248 248 255 251 240 -248 248 248 204 255 255 51 204 204 0 204 255 0 204 255 0 51 102 166 202 240 -255 251 240 255 255 204 255 251 240 255 255 255 255 255 255 178 178 178 -0 0 128 0 51 102 0 51 153 102 102 204 153 51 153 204 204 204 255 255 255 -255 251 240 153 204 204 0 102 204 192 220 192 234 234 234 221 221 221 204 236 255 -51 153 153 0 153 204 0 204 255 51 204 255 248 248 248 255 255 255 248 248 248 -255 251 240 255 251 240 255 255 255 248 248 248 241 241 241 255 251 240 -248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -248 248 248 255 255 255 255 251 240 248 248 248 204 255 255 51 204 204 -0 204 255 0 204 255 0 102 153 203 203 203 255 255 204 255 255 204 241 241 241 -231 231 214 255 255 204 160 160 164 0 51 153 0 51 153 0 51 153 102 102 204 -102 51 204 255 204 255 255 255 204 255 255 204 255 251 240 102 102 153 -241 241 241 204 236 255 204 236 255 241 241 241 51 51 102 0 102 153 0 204 204 -204 236 255 248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 251 240 248 248 248 204 255 255 51 204 204 0 204 255 0 204 255 0 102 102 -227 227 227 255 255 204 255 251 240 241 241 241 255 251 240 255 255 204 -178 178 178 0 0 128 0 51 153 0 51 153 102 102 204 153 102 204 255 255 255 -255 251 240 192 220 192 134 134 134 241 241 241 234 234 234 204 236 255 -204 236 255 241 241 241 51 51 102 51 153 204 102 204 255 255 255 255 255 251 240 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 248 248 248 255 255 255 255 255 255 255 251 240 248 248 248 -153 255 255 51 204 255 0 204 255 0 204 255 51 102 153 241 241 241 255 255 204 -255 251 240 150 150 150 255 251 240 255 251 240 203 203 203 0 51 102 0 51 153 -51 51 153 153 102 204 153 102 204 204 204 204 160 160 164 192 192 192 241 241 241 -234 234 234 204 236 255 204 236 255 234 234 234 234 234 234 51 102 153 -51 204 255 204 236 255 255 251 240 255 251 240 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 248 248 248 -255 255 255 255 255 255 255 251 240 248 248 248 102 204 255 0 204 255 0 204 255 -0 204 255 102 153 102 255 251 240 255 255 204 255 251 240 215 215 215 77 77 77 -203 203 203 248 248 248 51 102 102 51 51 204 102 102 204 102 51 153 153 153 204 -227 227 227 241 241 241 204 236 255 204 236 255 234 234 234 204 236 255 -234 234 234 241 241 241 153 153 204 0 153 153 51 204 255 248 248 248 255 251 240 -248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 248 248 248 255 255 255 255 255 255 255 255 255 -241 241 241 51 204 204 0 204 255 0 204 255 0 204 204 134 134 134 255 251 240 -255 251 240 255 251 240 255 255 255 192 192 192 95 95 95 160 160 164 153 153 204 -51 51 153 102 102 153 227 227 227 241 241 241 234 234 234 204 236 255 204 236 255 -204 236 255 234 234 234 204 236 255 227 227 227 248 248 248 102 153 153 -0 204 204 0 204 255 204 236 255 255 251 240 248 248 248 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 248 248 248 -255 255 255 255 255 255 248 248 248 204 255 255 51 204 204 0 204 255 0 204 255 -0 102 102 192 220 192 255 251 240 255 251 240 255 251 240 255 251 240 255 251 240 -173 169 144 221 221 221 241 241 241 241 241 241 248 248 248 227 227 227 -234 234 234 227 227 227 204 236 255 204 236 255 234 234 234 234 234 234 -234 234 234 204 236 255 241 241 241 102 153 153 51 204 204 0 204 255 102 255 255 -255 255 255 248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 251 240 255 255 255 255 255 255 -248 248 248 102 204 255 0 204 204 0 204 255 51 153 204 0 51 102 255 255 255 -231 231 214 255 251 240 255 251 240 255 255 204 255 251 240 255 251 240 -178 178 178 234 234 234 234 234 234 234 234 234 234 234 234 227 227 227 -241 241 241 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 -204 236 255 204 236 255 166 202 240 51 153 153 0 204 255 0 204 204 241 241 241 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 251 240 255 255 255 255 255 255 204 255 255 -51 204 204 0 204 255 0 204 255 0 153 153 153 153 153 255 255 204 231 231 214 -255 251 240 255 251 240 255 255 204 255 255 204 255 251 240 192 192 192 -178 178 178 234 234 234 241 241 241 241 241 241 204 236 255 234 234 234 -234 234 234 234 234 234 204 236 255 204 236 255 227 227 227 204 236 255 -204 236 255 241 241 241 51 102 102 0 204 204 0 204 255 102 204 204 248 248 248 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 251 240 255 255 255 248 248 248 102 204 255 0 204 204 0 204 255 -0 204 255 51 102 153 234 234 234 239 214 198 255 251 240 255 251 240 255 251 240 -255 255 204 255 255 204 255 251 240 255 251 240 178 178 178 134 134 134 -150 150 150 192 192 192 241 241 241 204 236 255 234 234 234 234 234 234 -204 236 255 204 236 255 204 255 204 234 234 234 204 236 255 248 248 248 -153 153 153 0 102 153 0 204 255 0 204 204 166 202 240 255 255 255 248 248 248 -255 255 255 255 255 255 255 255 255 248 248 248 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 248 248 248 -255 255 255 153 255 255 0 204 204 0 204 255 0 204 255 0 204 204 102 153 204 -255 255 204 239 214 198 255 255 255 192 192 192 178 178 178 255 255 255 -255 251 240 255 255 204 255 251 240 255 251 240 255 251 240 204 204 204 -192 192 192 241 241 241 241 241 241 234 234 234 234 234 234 234 234 234 -234 234 234 255 204 255 204 236 255 204 236 255 234 234 234 255 204 255 -57 57 57 0 153 153 0 204 255 0 204 255 204 236 255 241 241 241 241 241 241 -241 241 241 248 248 248 241 241 241 248 248 248 248 248 248 255 251 240 -255 255 255 255 255 255 255 255 255 255 255 255 241 241 241 255 255 255 -51 204 255 0 204 255 0 204 255 0 204 255 51 153 204 255 251 240 160 160 164 -255 251 240 255 251 240 150 150 150 150 150 150 204 204 204 255 251 240 -255 251 240 255 255 204 255 251 240 231 231 214 128 128 128 248 248 248 -241 241 241 204 236 255 204 236 255 234 234 234 234 234 234 204 236 255 -204 236 255 204 236 255 204 236 255 204 236 255 241 241 241 153 204 204 -0 51 102 0 153 204 0 204 255 102 204 204 241 241 241 255 255 255 255 251 240 -255 251 240 255 255 255 255 255 255 248 248 248 255 251 240 255 255 255 -255 255 255 255 255 255 255 255 255 255 251 240 153 204 255 0 204 255 0 204 255 -51 204 255 51 153 153 227 227 227 231 231 214 178 178 178 255 251 240 204 204 204 -203 203 203 241 241 241 134 134 134 255 251 240 255 251 240 255 255 204 -255 255 204 255 251 240 203 203 203 204 204 204 204 236 255 204 236 255 -234 234 234 234 234 234 234 234 234 204 236 255 204 236 255 204 236 255 -204 236 255 234 234 234 227 227 227 241 241 241 102 102 153 0 153 204 0 204 255 -0 204 204 204 236 255 255 255 255 248 248 248 241 241 241 255 255 255 255 255 255 -248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -241 241 241 0 204 255 0 204 255 0 153 255 0 102 153 192 192 192 255 255 204 -150 150 150 241 241 241 255 251 240 192 192 192 215 215 215 241 241 241 -150 150 150 255 251 240 255 251 240 255 255 204 255 251 240 255 251 240 -234 234 234 160 160 164 241 241 241 204 236 255 204 236 255 234 234 234 -204 236 255 204 236 255 234 234 234 234 234 234 234 234 234 234 234 234 -234 234 234 234 234 234 241 241 241 51 153 153 0 204 204 0 204 204 102 153 204 -255 255 255 248 248 248 248 248 248 255 255 255 255 255 255 255 255 255 -241 241 241 255 255 255 255 255 255 255 255 255 255 255 255 102 204 255 -0 204 204 0 204 255 0 102 153 150 150 150 255 255 255 178 178 178 204 204 153 -255 255 255 255 251 240 160 160 164 234 234 234 234 234 234 160 160 164 -241 241 241 255 251 240 231 231 214 255 251 240 178 178 178 178 178 178 -178 178 178 241 241 241 204 236 255 204 236 255 234 234 234 204 236 255 -204 236 255 255 204 255 204 236 255 204 236 255 204 236 255 234 234 234 -234 234 234 241 241 241 204 236 255 51 51 102 0 153 204 0 153 204 204 255 255 -255 255 255 255 251 240 248 248 248 255 255 255 248 248 248 248 248 248 -255 255 255 255 255 255 255 255 255 255 255 255 0 204 255 0 204 255 51 153 204 -119 119 119 255 255 255 234 234 234 128 128 128 255 255 204 255 255 255 -255 251 240 153 153 153 234 234 234 234 234 234 192 192 192 221 221 221 -255 251 240 221 221 221 255 255 255 150 150 150 215 215 215 234 234 234 -204 236 255 204 236 255 234 234 234 234 234 234 204 236 255 204 236 255 -234 234 234 204 236 255 204 236 255 234 234 234 234 234 234 241 241 241 -241 241 241 153 204 204 102 153 153 0 153 204 0 204 204 102 255 255 248 248 248 -255 251 240 248 248 248 248 248 248 255 255 255 248 248 248 255 255 255 -255 255 255 255 255 255 255 255 255 0 204 255 0 204 204 102 102 153 255 255 255 -204 236 255 153 204 204 178 178 178 255 255 255 255 251 240 234 234 234 -153 153 153 241 241 241 234 234 234 215 215 215 192 192 192 215 215 215 -134 134 134 215 215 215 153 153 153 204 236 255 204 236 255 204 236 255 -204 236 255 234 234 234 234 234 234 234 234 234 234 234 234 204 236 255 -234 234 234 234 234 234 255 255 255 192 192 192 51 102 153 0 102 153 0 153 153 -0 153 204 51 204 255 0 204 204 153 255 255 255 255 255 255 255 255 255 255 255 -248 248 248 255 255 255 248 248 248 255 255 255 255 255 255 255 255 255 -255 255 255 204 236 255 0 204 204 51 153 153 248 248 248 248 248 248 134 134 134 -255 251 240 241 241 241 255 255 204 203 203 203 192 192 192 241 241 241 -204 236 255 241 241 241 192 192 192 178 178 178 241 241 241 192 192 192 -241 241 241 234 234 234 241 241 241 204 236 255 204 236 255 234 234 234 -234 234 234 234 234 234 234 234 234 204 236 255 241 241 241 241 241 241 -51 102 102 0 153 153 51 204 255 51 204 255 0 204 255 0 204 255 0 204 204 -102 204 204 241 241 241 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 248 248 248 255 255 255 255 255 255 255 255 255 255 255 255 -248 248 248 102 255 204 0 204 204 51 153 153 66 66 66 204 204 204 255 251 240 -255 255 204 255 251 240 178 178 178 234 234 234 204 236 255 204 236 255 -204 236 255 241 241 241 234 234 234 234 234 234 234 234 234 204 236 255 -204 236 255 204 236 255 204 236 255 204 236 255 204 236 255 234 234 234 -234 234 234 234 234 234 204 255 255 204 204 204 28 28 28 0 102 102 0 153 153 -0 204 204 0 204 255 0 204 255 0 204 255 153 255 255 248 248 248 248 248 248 -248 248 248 255 251 240 255 255 255 248 248 248 255 255 255 241 241 241 -255 255 255 255 255 255 255 255 255 255 255 255 255 251 240 248 248 248 -0 204 255 0 204 255 0 128 128 204 255 255 241 241 241 239 214 198 178 178 178 -204 153 204 241 241 241 204 236 255 204 236 255 204 236 255 204 236 255 -204 236 255 234 234 234 241 241 241 204 236 255 204 236 255 234 234 234 -234 234 234 227 227 227 241 241 241 204 236 255 204 236 255 241 241 241 -134 134 134 51 51 0 51 51 0 102 51 0 51 51 0 66 66 66 51 102 102 51 204 204 -0 204 255 102 204 255 248 248 248 255 251 240 255 255 204 255 251 240 255 255 255 -248 248 248 255 255 255 248 248 248 255 255 255 255 255 255 255 255 255 -255 255 255 248 248 248 255 255 255 51 204 255 0 204 255 0 204 255 51 153 153 -0 51 51 8 8 8 4 4 4 153 204 153 221 221 221 241 241 241 241 241 241 234 234 234 -234 234 234 204 236 255 204 236 255 204 236 255 204 236 255 234 234 234 -227 227 227 227 227 227 227 227 227 241 241 241 248 248 248 192 192 192 -34 34 34 102 51 0 153 102 0 102 102 0 102 102 0 102 51 0 153 51 0 153 51 51 -0 51 51 51 204 153 51 204 204 102 204 255 241 241 241 255 255 255 248 248 248 -255 255 255 255 255 255 255 255 255 248 248 248 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 248 248 248 0 204 255 0 204 255 51 153 153 -51 102 51 102 51 51 102 51 0 51 51 0 17 17 17 22 22 22 34 34 34 95 95 95 -160 160 164 234 234 234 248 248 248 241 241 241 204 236 255 241 241 241 -241 241 241 234 234 234 248 248 248 248 248 248 178 178 178 51 51 102 51 51 51 -85 85 85 51 102 102 51 102 102 0 128 128 0 128 128 0 128 128 51 102 153 -51 153 204 0 153 204 0 204 255 0 204 255 51 153 204 204 255 255 241 241 241 -248 248 248 248 248 248 255 255 255 255 255 255 255 251 240 255 255 255 -255 255 255 255 255 255 255 255 255 248 248 248 204 236 255 51 204 204 -51 102 102 102 51 51 153 51 0 153 51 0 153 51 0 153 51 0 102 51 51 102 51 51 -77 77 77 51 51 51 51 51 51 57 57 57 66 66 66 134 134 134 192 192 192 204 204 204 -204 204 204 192 192 192 51 153 153 0 102 102 0 153 153 0 204 255 0 204 255 -0 204 255 0 204 255 0 204 255 0 204 255 0 204 204 0 204 255 0 204 255 0 204 255 -0 204 255 51 204 255 102 204 204 153 204 255 241 241 241 255 255 255 248 248 248 -255 255 255 248 248 248 248 248 248 241 241 241 255 255 255 255 255 255 -255 255 255 255 255 255 248 248 248 153 255 204 0 204 204 0 153 153 66 66 66 -66 66 66 51 102 102 0 128 128 0 128 128 0 153 153 0 153 204 0 204 204 0 204 255 -0 204 255 0 204 255 0 204 204 0 153 204 0 153 153 0 153 204 0 153 204 0 153 204 -51 153 204 51 204 204 102 204 204 102 204 204 166 202 240 204 236 255 241 241 241 -241 241 241 241 241 241 241 241 241 204 255 255 204 255 255 241 241 241 -248 248 248 248 248 248 248 248 248 255 255 255 255 255 255 255 255 255 -255 255 255 248 248 248 248 248 248 248 248 248 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 248 248 248 234 234 234 102 204 255 -51 204 255 51 204 204 51 204 204 51 204 255 51 204 255 51 204 255 102 204 255 -102 204 255 102 204 255 102 204 255 102 204 255 102 204 255 51 204 255 -51 204 255 102 204 255 153 204 255 153 204 255 204 236 255 204 255 255 -204 255 255 248 248 248 248 248 248 255 255 255 255 255 255 255 255 255 -248 248 248 248 248 248 248 248 248 248 248 248 255 255 255 248 248 248 -248 248 248 255 255 255 255 251 240 255 251 240 255 251 240 255 255 255 -255 255 255 248 248 248 255 255 255 248 248 248 248 248 248 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 -255 255 255 255 255 255 255 255 255 255 255 255 diff --git a/spec/samples/huge.jpg b/spec/samples/huge.jpg deleted file mode 100644 index 53f08bb0..00000000 Binary files a/spec/samples/huge.jpg and /dev/null differ diff --git a/spec/samples/icc.jpg b/spec/samples/icc.jpg deleted file mode 100644 index 9d254cfa..00000000 Binary files a/spec/samples/icc.jpg and /dev/null differ diff --git a/spec/samples/lcd.icc b/spec/samples/lcd.icc deleted file mode 100644 index 02cf9081..00000000 Binary files a/spec/samples/lcd.icc and /dev/null differ diff --git a/spec/samples/lion.svg b/spec/samples/lion.svg deleted file mode 100644 index 9ef9ff43..00000000 --- a/spec/samples/lion.svg +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spec/samples/no_alpha.png b/spec/samples/no_alpha.png deleted file mode 100644 index d50cba32..00000000 Binary files a/spec/samples/no_alpha.png and /dev/null differ diff --git a/spec/samples/sample.csv b/spec/samples/sample.csv deleted file mode 100644 index 26cf6af2..00000000 --- a/spec/samples/sample.csv +++ /dev/null @@ -1,7 +0,0 @@ -0,0,0,255,0,0,0 -0,0,0,255,0,0,0 -0,0,0,255,0,0,0 -0,0,0,255,0,0,0 -0,255,0,255,0,0,0 -0,255,0,255,0,0,0 -0,0,255,255,0,0,0 diff --git a/spec/samples/sample.exr b/spec/samples/sample.exr deleted file mode 100644 index e19d1710..00000000 Binary files a/spec/samples/sample.exr and /dev/null differ diff --git a/spec/samples/wagon.jpg b/spec/samples/wagon.jpg deleted file mode 100644 index 2205701a..00000000 Binary files a/spec/samples/wagon.jpg and /dev/null differ diff --git a/spec/samples/wagon.v b/spec/samples/wagon.v deleted file mode 100644 index bece0299..00000000 Binary files a/spec/samples/wagon.v and /dev/null differ diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index 0410b1ba..00000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "vips" - -require "tempfile" -require "pathname" - -Vips.set_debug ENV["DEBUG"] -# Vips.leak_set true - -def simg(name) - File.join(__dir__, "samples", name) -end - -def timg(name) - File.join(@temp_dir, name) -end - -RSpec.configure do |config| - config.around do |example| - Dir.mktmpdir("ruby-vips-spec-") do |dir| - @temp_dir = dir - example.run - end - end - - config.before(:example, jpeg: true) do - skip "required jpegload for this spec" unless has_jpeg? - end - - config.before(:example, :version) do |example| - required_version = example.metadata[:version] - unless Vips.at_least_libvips?(*required_version) - skip "required at least #{required_version.join(".")} version of the libvips" - end - end -end diff --git a/spec/vips_spec.rb b/spec/vips_spec.rb deleted file mode 100644 index 6f28cde1..00000000 --- a/spec/vips_spec.rb +++ /dev/null @@ -1,131 +0,0 @@ -require "spec_helper" - -RSpec.describe Vips do - describe "Vips" do - it "can set concurrency" do - Vips.concurrency_set 12 - end - - it "can set SIMD" do - Vips.vector_set true - end - - it "can enable leak testing" do - Vips.leak_set true - Vips.leak_set false - end - - it "can set the operation cache size" do - Vips.cache_set_max 0 - Vips.cache_set_max 100 - end - - it "can set the operation cache memory limit" do - Vips.cache_set_max_mem 0 - Vips.cache_set_max_mem 10000000 - end - - it "can set the operation cache file limit" do - Vips.cache_set_max_files 0 - Vips.cache_set_max_files 100 - end - - it "can get a set of filename suffixes" do - suffs = Vips.get_suffixes - expect(suffs.length > 10).to be true unless suffs.empty? - end - end - - describe "#call" do - it "can make a black image" do - image = Vips::Operation.call "black", [200, 200] - - expect(image.width).to eq(200) - expect(image.height).to eq(200) - expect(image.bands).to eq(1) - end - - it "can take an optional argument" do - image = Vips::Operation.call "black", [200, 200], bands: 12 - - expect(image.width).to eq(200) - expect(image.height).to eq(200) - expect(image.bands).to eq(12) - end - - it "ignores optional arguments with nil values" do - image = Vips::Operation.call "black", [200, 200], bands: nil - - expect(image.width).to eq(200) - expect(image.height).to eq(200) - expect(image.bands).to eq(1) - end - - it "can handle enum arguments" do - black = Vips::Operation.call "black", [200, 200] - embed = Vips::Operation.call "embed", [black, 10, 10, 500, 500], - extend: :mirror - - expect(embed.width).to eq(500) - expect(embed.height).to eq(500) - expect(embed.bands).to eq(1) - end - - it "can handle enum arguments with underscores" do - black = Vips::Image.black 200, 100, bands: 3 - mono = black.colourspace :b_w - - expect(mono.width).to eq(200) - expect(mono.height).to eq(100) - expect(mono.bands).to eq(1) - end - - it "enum arguments can be strings" do - black = Vips::Operation.call "black", [200, 200] - embed = Vips::Operation.call "embed", [black, 10, 10, 500, 500], - extend: "mirror" - - expect(embed.width).to eq(500) - expect(embed.height).to eq(500) - expect(embed.bands).to eq(1) - end - - it "enum arguments can be ints" do - black = Vips::Image.black 200, 100 - # not angle 0, enum 0 (VIPS_ANGLE_D0) - rot = black.rot 0 - - expect(rot.width).to eq(200) - expect(rot.height).to eq(100) - expect(rot.bands).to eq(1) - end - - it "can return optional output args" do - point = Vips::Operation.call "black", [1, 1] - test = Vips::Operation.call "embed", [point, 20, 10, 100, 100], - extend: :white - value, opts = Vips::Operation.call "min", [test], x: true, y: true - - expect(value).to eq(0) - expect(opts["x"]).to eq(20) - expect(opts["y"]).to eq(10) - end - - it "can call draw operations" do - black = Vips::Operation.call "black", [100, 100] - test = Vips::Operation.call "draw_rect", [black, 255, 10, 10, 1, 1] - - max_black = Vips::Operation.call "max", [black] - max_test = Vips::Operation.call "max", [test] - - expect(max_black).to eq(0) - expect(max_test).to eq(255) - end - - it "can throw errors for failed operations" do - black = Vips::Operation.call "black", [100, 1] - - expect { black.crop(10, 10, 1, 1) }.to raise_exception(Vips::Error) - end - end -end diff --git a/top-level-namespace.html b/top-level-namespace.html new file mode 100644 index 00000000..4d75908a --- /dev/null +++ b/top-level-namespace.html @@ -0,0 +1,206 @@ + + + + + + + Top Level Namespace + + — Documentation by YARD 0.9.25 + + + + + + + + + + + + + + + + + + + +
+ + +

Top Level Namespace + + + +

+
+ + + + + + + + + + + +
+ +

Defined Under Namespace

+

+ + + Modules: GLib, GObject, Vips + + + + +

+ + + + + + + + +

+ Instance Method Summary + collapse +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + #library_name(name, abi_number) ⇒ Object + + + + + +

+
+ +

Generate a library name for ffi.

+ +

Platform notes: linux: Some distros allow “libvips.so”, but only if the -dev headers have been installed. To work everywhere, you must include the ABI number. Confusingly, the file extension is not at the end. ffi adds the “lib” prefix. mac: As linux, but the extension is at the end and is added by ffi. windows: The ABI number must be included, but with a hyphen. ffi does not add a “lib” prefix or a “.dll” suffix.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+26
+27
+28
+29
+30
+31
+32
+33
+34
+
+
# File 'lib/vips.rb', line 26
+
+def library_name(name, abi_number)
+  if FFI::Platform.windows?
+    "lib#{name}-#{abi_number}.dll"
+  elsif FFI::Platform.mac?
+    "#{name}.#{abi_number}"
+  else
+    "#{name}.so.#{abi_number}"
+  end
+end
+
+ + + + + + + + + + + \ No newline at end of file