ruby-vips 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9313e9659b31e926e6e1e7dcc71d772528c3e9f
4
- data.tar.gz: 2f82e18e72ab6c483575cc5c1e30c7e180b2fe7a
3
+ metadata.gz: fa7ceeea5a7f3ba540d67ff5940b75229c55195b
4
+ data.tar.gz: 15ab5c034633a329a591b7db148ab5f2de294442
5
5
  SHA512:
6
- metadata.gz: de582b44a3a7228cae2a585db65914984d0274a7f9db225e0d608aaf9d727620d2177b639262e73af22aab99a82736d4aeab56f29e1eab27152b72110454bcbe
7
- data.tar.gz: 1b38ef7ccabcded40a962ab6336ab744ba06e275560515f13e0499133c4d36029e313a3449794f3a939505caf2c6ac07e03b9a0eec952308cf38ac22b46eab91
6
+ metadata.gz: 7a5f515a544a0a09cd68b4faafe23b5e10d06207855826e5a1a09cf0791a1ebf28ba5f2282a1bdc2301aaa21bab39e160c7a11bb76fbbf36370d7551b0b47f45
7
+ data.tar.gz: d483450c4931f687a7b219890f0ce49ada8f4a56334718b0c123a60a8cafc27aa3c45d5085cb4c2dd394e3bec037b10ac54e3fc595ea8250ca5188bd2a8030a5
data/.travis.yml CHANGED
@@ -1,9 +1,16 @@
1
+ sudo: false
2
+
1
3
  env:
2
4
  global:
3
5
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
4
-
5
- env:
6
- - LIBVIPS=8.4.4
6
+ - VIPS_VERSION_MAJOR=8
7
+ - VIPS_VERSION_MINOR=5
8
+ - VIPS_VERSION_MICRO=3
9
+ - PATH=$HOME/vips/bin:$PATH
10
+ - LD_LIBRARY_PATH=$HOME/vips/lib:$LD_LIBRARY_PATH
11
+ - PKG_CONFIG_PATH=$HOME/vips/lib/pkgconfig:$PKG_CONFIG_PATH
12
+ - PYTHONPATH=$HOME/vips/lib/python2.7/site-packages:$PYTHONPATH
13
+ - GI_TYPELIB_PATH=$HOME/vips/lib/girepository-1.0:$GI_TYPELIB_PATH
7
14
 
8
15
  dist: trusty
9
16
 
@@ -30,11 +37,19 @@ addons:
30
37
  - libwebp-dev
31
38
  - libglib2.0-dev
32
39
 
40
+ cache:
41
+ directories:
42
+ - $HOME/vips
43
+
44
+ # gobject-introspection 3.1 declares itself as 2.1 minimum, so we can't test
45
+ # 2.0 ... in fact it seems to work if you force it, but I don't think we can do
46
+ # that on travis
33
47
  language: ruby
34
48
  rvm:
35
49
  - 2.1
36
50
  - 2.2
37
51
  - 2.3
52
+ - 2.4
38
53
 
39
54
  script: "bundle exec rake"
40
55
 
@@ -43,13 +58,4 @@ gemfile:
43
58
 
44
59
  before_install:
45
60
  - uname -a
46
- - sudo apt-get update
47
- - wget http://www.vips.ecs.soton.ac.uk/supported/current/vips-$LIBVIPS.tar.gz
48
- - tar xvf vips-$LIBVIPS.tar.gz
49
- - cd vips-$LIBVIPS
50
- - >
51
- CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
52
- ./configure --prefix=/usr
53
- - make
54
- - sudo make install
55
- - sudo ldconfig
61
+ - bash install-vips.sh
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # master
2
2
 
3
+ # Version 1.0.5
4
+
5
+ * fix `_const` for libvips 8.5 [John Cupitt]
6
+ * add `scaleimage`, the scale operation renamed to avoid a clash with the
7
+ `scale` property [John Cupitt]
8
+ * add `.new_from_image`: make a new image from a constant [John Cupitt]
9
+ * `bandjoin` will use `bandjoin_const`, if it can [John Cupitt]
10
+ * update generated docs for libvips 8.5 [John Cupitt]
11
+ * added docs for new libvips 8.5 enums [John Cupitt]
12
+
3
13
  # Version 1.0.4
4
14
 
5
15
  * remove stray comma from some docs lines [John Cupitt]
data/README.md CHANGED
@@ -9,7 +9,7 @@ The older `ruby-vips` is still here and still maintained in branch
9
9
  `0.3-stable`.
10
10
 
11
11
  This gem provides a Ruby binding for the [vips image processing
12
- library](http://www.vips.ecs.soton.ac.uk).
12
+ library](https://jcupitt.github.io/libvips).
13
13
 
14
14
  Programs that use `ruby-vips` don't
15
15
  manipulate images directly, instead they create pipelines of image processing
@@ -39,7 +39,7 @@ rmagick.rb 3352020
39
39
  ```
40
40
 
41
41
  See also [benchmarks at the official libvips
42
- website](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use).
42
+ website](https://github.com/jcupitt/libvips/wiki/Speed-and-memory-use).
43
43
  There's a handy blog post explaining [how libvips opens
44
44
  files](http://libvips.blogspot.co.uk/2012/06/how-libvips-opens-file.html)
45
45
  which gives some more background.
@@ -73,7 +73,7 @@ Check your package manager and see if the libvips on your system is new enough.
73
73
 
74
74
  If it's too old, you'll need to build libvips from source.
75
75
  Download a tarball from the
76
- [libvips website](http://www.vips.ecs.soton.ac.uk/supported/current), or build
76
+ [libvips website](https://jcupitt.github.io/libvips), or build
77
77
  from [the git repository](https://github.com/jcupitt/libvips) and see the
78
78
  README.
79
79
 
@@ -102,7 +102,7 @@ im = Vips::Image.new_from_file filename
102
102
  # put im at position (100, 100) in a 3000 x 3000 pixel image,
103
103
  # make the other pixels in the image by mirroring im up / down /
104
104
  # left / right, see
105
- # http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/libvips-conversion.html#vips-embed
105
+ # https://jcupitt.github.io/libvips/API/current/libvips-conversion.html#vips-embed
106
106
  im = im.embed 100, 100, 3000, 3000, :extend => :mirror
107
107
 
108
108
  # multiply the green (middle) band by 2, leave the other two alone
data/install-vips.sh ADDED
@@ -0,0 +1,26 @@
1
+ #!/bin/bash
2
+
3
+ vips_site=https://github.com/jcupitt/libvips/releases/download
4
+ version=$VIPS_VERSION_MAJOR.$VIPS_VERSION_MINOR.$VIPS_VERSION_MICRO
5
+
6
+ set -e
7
+
8
+ # do we already have the correct vips built? early exit if yes
9
+ # we could check the configure params as well I guess
10
+ if [ -d "$HOME/vips/bin" ]; then
11
+ installed_version=$($HOME/vips/bin/vips --version)
12
+ escaped_version="$VIPS_VERSION_MAJOR\.$VIPS_VERSION_MINOR\.$VIPS_VERSION_MICRO"
13
+ echo "Need vips-$version"
14
+ echo "Found $installed_version"
15
+ if [[ "$installed_version" =~ ^vips-$escaped_version ]]; then
16
+ echo "Using cached directory"
17
+ exit 0
18
+ fi
19
+ fi
20
+
21
+ rm -rf $HOME/vips
22
+ wget $vips_site/v$version/vips-$version.tar.gz
23
+ tar xf vips-$version.tar.gz
24
+ cd vips-$version
25
+ CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ./configure --prefix=$HOME/vips $*
26
+ make && make install
data/lib/vips.rb CHANGED
@@ -121,6 +121,8 @@ module Vips
121
121
 
122
122
  # TODO get the vips error buffer
123
123
  raise error unless succeeded
124
+
125
+ log "Vips::Loader.call_init_function: argv = #{argv}"
124
126
  end
125
127
 
126
128
  def define_value_modules
@@ -138,7 +140,7 @@ module Vips
138
140
  end
139
141
 
140
142
  at_exit {
141
- Vips::shutdown if Vips.respond_to? :shutdown
143
+ Vips::shutdown if Vips.respond_to? :shutdown
142
144
  }
143
145
 
144
146
  # this makes vips keep a list of all active objects which we can print out
data/lib/vips/argument.rb CHANGED
@@ -50,11 +50,7 @@ module Vips
50
50
 
51
51
  # we have a 1D array ... use that as a pixel constant and expand
52
52
  # to match match_image
53
- pixel = (Vips::Image.black(1, 1) + value).cast(match_image.format)
54
- pixel = pixel.copy :interpretation => match_image.interpretation,
55
- :xres => match_image.xres, :yres => match_image.yres
56
- pixel.embed(0, 0, match_image.width, match_image.height,
57
- :extend => :copy)
53
+ match_image.new_from_image(value)
58
54
  end
59
55
 
60
56
  # @private
data/lib/vips/call.rb CHANGED
@@ -11,14 +11,13 @@ module Vips
11
11
  def initialize(name, supplied_values)
12
12
  @name = name
13
13
  @supplied_values = supplied_values
14
+ @optional_values = {}
14
15
  @instance = nil
15
16
  @option_string = nil
16
17
 
17
18
  if @supplied_values.last.is_a? Hash
18
19
  @optional_values = @supplied_values.last
19
- @supplied_values.delete_at -1
20
- else
21
- @optional_values = {}
20
+ @supplied_values.delete_at(-1)
22
21
  end
23
22
 
24
23
  begin
@@ -119,8 +118,11 @@ module Vips
119
118
  end
120
119
 
121
120
  def set_required_input(match_image, required_input)
121
+ log "set_required_input: @instance = #{@instance}"
122
+
122
123
  # do we have a non-nil instance? set the first image arg with this
123
124
  if @instance != nil
125
+ log "BANANA"
124
126
  log "setting first image arg with instance ..."
125
127
  x = required_input.find do |arg|
126
128
  gtype = GLib::Type["VipsImage"]
@@ -238,6 +240,8 @@ module Vips
238
240
  end
239
241
 
240
242
  def invoke
243
+ log "invoke starting ..."
244
+ log "invoke instance is #{@instance}"
241
245
  set_string_args()
242
246
  match_image = find_match_image()
243
247
  required_input, optional_input = find_input()
data/lib/vips/image.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # This module provides a set of overrides for the [vips image processing
2
- # library](http://www.vips.ecs.soton.ac.uk)
2
+ # library](https://jcupitt.github.io/libvips/)
3
3
  # used via the [gobject-introspection
4
4
  # gem](https://rubygems.org/gems/gobject-introspection).
5
5
  #
@@ -45,7 +45,8 @@
45
45
  # but is slower and needs more memory. See {Access}
46
46
  # for full details
47
47
  # on the various modes available. You can also load formatted images from
48
- # memory buffers or create images that wrap C-style memory arrays.
48
+ # memory buffers, create images that wrap C-style memory arrays, or make images
49
+ # from constants.
49
50
  #
50
51
  # The next line:
51
52
  #
@@ -98,7 +99,7 @@
98
99
  # of overrides which try to make it nicer to use.
99
100
  #
100
101
  # The API you end up with is a Ruby-ish version of the [VIPS C
101
- # API](http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/).
102
+ # API](https://jcupitt.github.io/libvips/API/current).
102
103
  # Full documentation
103
104
  # on the operations and what they do is there, you can use it directly. This
104
105
  # document explains the extra features of the Ruby API and lists the available
@@ -233,7 +234,7 @@
233
234
  # that that operation expects.
234
235
  #
235
236
  # Use the [C API
236
- # docs](http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips)
237
+ # docs](https://jcupitt.github.io/libvips/API/current)
237
238
  # for more detail.
238
239
  #
239
240
  # # Exceptions
@@ -322,7 +323,7 @@ module Vips
322
323
  # handy for overloads ... want to be able to apply a function to an
323
324
  # array or to a scalar
324
325
  def self.smap(x, &block)
325
- x.is_a?(Array) ? x.map {|x| smap(x, &block)} : block.(x)
326
+ x.is_a?(Array) ? x.map {|y| smap(y, &block)} : block.(x)
326
327
  end
327
328
 
328
329
  # run a complex operation on a complex image, or an image with an even
@@ -384,6 +385,24 @@ module Vips
384
385
  end
385
386
  end
386
387
 
388
+ # libvips 8.4 and earlier had a bug which swapped the args to the _const
389
+ # enum operations
390
+ def swap_const_args
391
+ Vips::version(0) < 8 or
392
+ (Vips::version(0) == 8 and Vips::version(1) <= 4)
393
+ end
394
+
395
+ # handy for expanding enum operations
396
+ def call_enum(name, other, enum)
397
+ if other.is_a?(Vips::Image)
398
+ Vips::call_base name.to_s, self, "", [other, enum]
399
+ else
400
+ args = swap_const_args ? [other, enum] : [enum, other]
401
+
402
+ Vips::call_base name.to_s + "_const", self, "", args
403
+ end
404
+ end
405
+
387
406
  public
388
407
 
389
408
  # Invoke a vips operation with {call}, using self as the first
@@ -392,7 +411,7 @@ module Vips
392
411
  # @param name [String] vips operation to call
393
412
  # @return result of vips operation
394
413
  def method_missing(name, *args)
395
- Vips::call_base(name.to_s, self, "", args)
414
+ Vips::call_base name.to_s, self, "", args
396
415
  end
397
416
 
398
417
  # Invoke a vips operation with {call}.
@@ -556,6 +575,23 @@ module Vips
556
575
  return image
557
576
  end
558
577
 
578
+ # A new image is created with the same width, height, format,
579
+ # interpretation, resolution and offset as self, but with every pixel
580
+ # set to the specified value.
581
+ #
582
+ # You can pass an array to make a many-band image, or a single value to
583
+ # make a one-band image.
584
+ #
585
+ # @param pixel [Real, Array<Real>] value to put in each pixel
586
+ # @return [Image] constant image
587
+ def new_from_image(value)
588
+ pixel = (Vips::Image.black(1, 1) + value).cast(format)
589
+ image = pixel.embed(0, 0, width, height, :extend => :copy)
590
+ image.copy :interpretation => interpretation,
591
+ :xres => xres, :yres => yres,
592
+ :xoffset => xoffset, :yoffset => yoffset
593
+ end
594
+
559
595
  # Write this image to a file. Save options may be encoded in the
560
596
  # filename or given as a hash. For example:
561
597
  #
@@ -756,7 +792,8 @@ module Vips
756
792
  # @param other [Image, Real, Array<Real>] Thing to add to self
757
793
  # @return [Image] result of addition
758
794
  def +(other)
759
- other.is_a?(Vips::Image) ? add(other) : linear(1, other)
795
+ other.is_a?(Vips::Image) ?
796
+ add(other) : linear(1, other)
760
797
  end
761
798
 
762
799
  # Subtract an image, constant or array.
@@ -773,7 +810,8 @@ module Vips
773
810
  # @param other [Image, Real, Array<Real>] Thing to multiply by self
774
811
  # @return [Image] result of multiplication
775
812
  def *(other)
776
- other.is_a?(Vips::Image) ? multiply(other) : linear(other, 0)
813
+ other.is_a?(Vips::Image) ?
814
+ multiply(other) : linear(other, 0)
777
815
  end
778
816
 
779
817
  # Divide an image, constant or array.
@@ -799,8 +837,7 @@ module Vips
799
837
  # @param other [Image, Real, Array<Real>] self to the power of this
800
838
  # @return [Image] result of power
801
839
  def **(other)
802
- other.is_a?(Vips::Image) ?
803
- math2(other, :pow) : math2_const(other, :pow)
840
+ call_enum("math2", other, :pow)
804
841
  end
805
842
 
806
843
  # Integer left shift with an image, constant or array.
@@ -808,8 +845,7 @@ module Vips
808
845
  # @param other [Image, Real, Array<Real>] shift left by this much
809
846
  # @return [Image] result of left shift
810
847
  def <<(other)
811
- other.is_a?(Vips::Image) ?
812
- boolean(other, :lshift) : boolean_const(other, :lshift)
848
+ call_enum("boolean", other, :lshift)
813
849
  end
814
850
 
815
851
  # Integer right shift with an image, constant or array.
@@ -817,8 +853,7 @@ module Vips
817
853
  # @param other [Image, Real, Array<Real>] shift right by this much
818
854
  # @return [Image] result of right shift
819
855
  def >>(other)
820
- other.is_a?(Vips::Image) ?
821
- boolean(other, :rshift) : boolean_const(other, :rshift)
856
+ call_enum("boolean", other, :rshift)
822
857
  end
823
858
 
824
859
  # Integer bitwise OR with an image, constant or array.
@@ -826,8 +861,7 @@ module Vips
826
861
  # @param other [Image, Real, Array<Real>] bitwise OR with this
827
862
  # @return [Image] result of bitwise OR
828
863
  def |(other)
829
- other.is_a?(Vips::Image) ?
830
- boolean(other, :or) : boolean_const(other, :or)
864
+ call_enum("boolean", other, :or)
831
865
  end
832
866
 
833
867
  # Integer bitwise AND with an image, constant or array.
@@ -835,8 +869,7 @@ module Vips
835
869
  # @param other [Image, Real, Array<Real>] bitwise AND with this
836
870
  # @return [Image] result of bitwise AND
837
871
  def &(other)
838
- other.is_a?(Vips::Image) ?
839
- boolean(other, :and) : boolean_const(other, :and)
872
+ call_enum("boolean", other, :and)
840
873
  end
841
874
 
842
875
  # Integer bitwise EOR with an image, constant or array.
@@ -844,8 +877,7 @@ module Vips
844
877
  # @param other [Image, Real, Array<Real>] bitwise EOR with this
845
878
  # @return [Image] result of bitwise EOR
846
879
  def ^(other)
847
- other.is_a?(Vips::Image) ?
848
- boolean(other, :eor) : boolean_const(other, :eor)
880
+ call_enum("boolean", other, :eor)
849
881
  end
850
882
 
851
883
  # Equivalent to image ^ -1
@@ -879,8 +911,7 @@ module Vips
879
911
  # @param other [Image, Real, Array<Real>] relational less than with this
880
912
  # @return [Image] result of less than
881
913
  def <(other)
882
- other.is_a?(Vips::Image) ?
883
- relational(other, :less) : relational_const(other, :less)
914
+ call_enum("relational", other, :less)
884
915
  end
885
916
 
886
917
  # Relational less than or equal to with an image, constant or array.
@@ -889,8 +920,7 @@ module Vips
889
920
  # equal to with this
890
921
  # @return [Image] result of less than or equal to
891
922
  def <=(other)
892
- other.is_a?(Vips::Image) ?
893
- relational(other, :lesseq) : relational_const(other, :lesseq)
923
+ call_enum("relational", other, :lesseq)
894
924
  end
895
925
 
896
926
  # Relational more than with an image, constant or array.
@@ -898,8 +928,7 @@ module Vips
898
928
  # @param other [Image, Real, Array<Real>] relational more than with this
899
929
  # @return [Image] result of more than
900
930
  def >(other)
901
- other.is_a?(Vips::Image) ?
902
- relational(other, :more) : relational_const(other, :more)
931
+ call_enum("relational", other, :more)
903
932
  end
904
933
 
905
934
  # Relational more than or equal to with an image, constant or array.
@@ -908,8 +937,7 @@ module Vips
908
937
  # equal to with this
909
938
  # @return [Image] result of more than or equal to
910
939
  def >=(other)
911
- other.is_a?(Vips::Image) ?
912
- relational(other, :moreeq) : relational_const(other, :moreeq)
940
+ call_enum("relational", other, :moreeq)
913
941
  end
914
942
 
915
943
  # Compare equality to nil, an image, constant or array.
@@ -917,12 +945,11 @@ module Vips
917
945
  # @param other [nil, Image, Real, Array<Real>] test equality to this
918
946
  # @return [Image] result of equality
919
947
  def ==(other)
948
+ # for equality, we must allow tests against nil
920
949
  if other == nil
921
950
  false
922
- elsif other.is_a?(Vips::Image)
923
- relational(other, :equal)
924
951
  else
925
- relational_const(other, :equal)
952
+ call_enum("relational", other, :equal)
926
953
  end
927
954
  end
928
955
 
@@ -931,12 +958,11 @@ module Vips
931
958
  # @param other [nil, Image, Real, Array<Real>] test inequality to this
932
959
  # @return [Image] result of inequality
933
960
  def !=(other)
961
+ # for equality, we must allow tests against nil
934
962
  if other == nil
935
963
  true
936
- elsif other.is_a?(Vips::Image)
937
- relational(other, :noteq)
938
964
  else
939
- relational_const(other, :noteq)
965
+ call_enum("relational", other, :noteq)
940
966
  end
941
967
  end
942
968
 
@@ -1029,7 +1055,14 @@ module Vips
1029
1055
  other = [other]
1030
1056
  end
1031
1057
 
1032
- Vips::Image.bandjoin([self] + other)
1058
+ # if other is just Numeric, we can use bandjoin_const
1059
+ not_all_real = (other.map {|x| not x.is_a?(Numeric)}).include?(true)
1060
+
1061
+ if not_all_real
1062
+ Vips::Image.bandjoin([self] + other)
1063
+ else
1064
+ bandjoin_const(other)
1065
+ end
1033
1066
  end
1034
1067
 
1035
1068
  # Return the coordinates of the image maximum.
@@ -1279,6 +1312,15 @@ module Vips
1279
1312
  Vips::call_base "ifthenelse", self, "", [th, el, opts]
1280
1313
  end
1281
1314
 
1315
+ # Scale an image to uchar. This is the vips `scale` operation, but
1316
+ # renamed to avoid a clash with the `.scale` property.
1317
+ #
1318
+ # @param [Hash] opts Set of options
1319
+ # @return [Vips::Image] Output image
1320
+ def scaleimage(opts = {})
1321
+ Vips::Image.scale self, opts
1322
+ end
1323
+
1282
1324
  end
1283
1325
 
1284
1326
  # This method generates yard comments for all the dynamically bound
@@ -1294,7 +1336,7 @@ module Vips
1294
1336
 
1295
1337
  def self.generate_yard
1296
1338
  # these have hand-written methods, see above
1297
- no_generate = ["bandjoin", "ifthenelse"]
1339
+ no_generate = ["scale", "bandjoin", "ifthenelse"]
1298
1340
 
1299
1341
  generate_operation = lambda do |op|
1300
1342
  flags = op.flags
@@ -0,0 +1,14 @@
1
+ module Vips
2
+
3
+ # Pick the algorithm vips uses to decide image "interestingness". This is
4
+ # used by {Image#smartcrop}, for example, to decide what parts of the image
5
+ # to keep.
6
+ #
7
+ # * `:none` do nothing
8
+ # * `:centre` just take the centre
9
+ # * `:entropy` use an entropy measure
10
+ # * `:attention` look for features likely to draw human attention
11
+
12
+ class Interesting
13
+ end
14
+ end
data/lib/vips/methods.rb CHANGED
@@ -117,10 +117,10 @@ module Vips
117
117
  # @param [Hash] opts Set of options
118
118
  # @return [Vips::Image] Output image
119
119
 
120
- # @!method relational_const(c, relational, opts = {})
120
+ # @!method relational_const(relational, c, opts = {})
121
121
  # Relational operations against a constant.
122
- # @param c [Array<Double>] Array of constants
123
122
  # @param relational [Vips::OperationRelational] relational to perform
123
+ # @param c [Array<Double>] Array of constants
124
124
  # @param [Hash] opts Set of options
125
125
  # @return [Vips::Image] Output image
126
126
 
@@ -130,17 +130,17 @@ module Vips
130
130
  # @param [Hash] opts Set of options
131
131
  # @return [Vips::Image] Output image
132
132
 
133
- # @!method boolean_const(c, boolean, opts = {})
133
+ # @!method boolean_const(boolean, c, opts = {})
134
134
  # Boolean operations against a constant.
135
- # @param c [Array<Double>] Array of constants
136
135
  # @param boolean [Vips::OperationBoolean] boolean to perform
136
+ # @param c [Array<Double>] Array of constants
137
137
  # @param [Hash] opts Set of options
138
138
  # @return [Vips::Image] Output image
139
139
 
140
- # @!method math2_const(c, math2, opts = {})
140
+ # @!method math2_const(math2, c, opts = {})
141
141
  # Binary math operations with a constant.
142
- # @param c [Array<Double>] Array of constants
143
142
  # @param math2 [Vips::OperationMath2] math to perform
143
+ # @param c [Array<Double>] Array of constants
144
144
  # @param [Hash] opts Set of options
145
145
  # @return [Vips::Image] Output image
146
146
 
@@ -292,9 +292,7 @@ module Vips
292
292
  # @!method sequential(opts = {})
293
293
  # Check sequential access.
294
294
  # @param [Hash] opts Set of options
295
- # @option opts [Boolean] :trace trace pixel requests
296
295
  # @option opts [Integer] :tile_height Tile height in pixels
297
- # @option opts [Vips::Access] :access Expected access pattern
298
296
  # @return [Vips::Image] Output image
299
297
 
300
298
  # @!method cache(opts = {})
@@ -313,7 +311,7 @@ module Vips
313
311
  # @param height [Integer] Image height in pixels
314
312
  # @param [Hash] opts Set of options
315
313
  # @option opts [Vips::Extend] :extend How to generate the extra pixels
316
- # @option opts [Array<Double>] :background Colour for background pixels
314
+ # @option opts [Array<Double>] :background Color for background pixels
317
315
  # @return [Vips::Image] Output image
318
316
 
319
317
  # @!method flip(direction, opts = {})
@@ -329,7 +327,7 @@ module Vips
329
327
  # @param y [Integer] Top edge of sub in main
330
328
  # @param [Hash] opts Set of options
331
329
  # @option opts [Boolean] :expand Expand output to hold all of both inputs
332
- # @option opts [Array<Double>] :background Colour for new pixels
330
+ # @option opts [Array<Double>] :background Color for new pixels
333
331
  # @return [Vips::Image] Output image
334
332
 
335
333
  # @!method join(in2, direction, opts = {})
@@ -337,10 +335,10 @@ module Vips
337
335
  # @param in2 [Vips::Image] Second input image
338
336
  # @param direction [Vips::Direction] Join left-right or up-down
339
337
  # @param [Hash] opts Set of options
340
- # @option opts [Vips::Align] :align Align on the low, centre or high coordinate edge
341
338
  # @option opts [Boolean] :expand Expand output to hold all of both inputs
342
339
  # @option opts [Integer] :shim Pixels between images
343
340
  # @option opts [Array<Double>] :background Colour for new pixels
341
+ # @option opts [Vips::Align] :align Align on the low, centre or high coordinate edge
344
342
  # @return [Vips::Image] Output image
345
343
 
346
344
  # @!method self.arrayjoin(in, opts = {})
@@ -374,6 +372,14 @@ module Vips
374
372
  # @param [Hash] opts Set of options
375
373
  # @return [Vips::Image] Output image
376
374
 
375
+ # @!method smartcrop(width, height, opts = {})
376
+ # Extract an area from an image.
377
+ # @param width [Integer] Width of extract area
378
+ # @param height [Integer] Height of extract area
379
+ # @param [Hash] opts Set of options
380
+ # @option opts [Vips::Interesting] :interesting How to measure interestingness
381
+ # @return [Vips::Image] Output image
382
+
377
383
  # @!method extract_band(band, opts = {})
378
384
  # Extract band from an image.
379
385
  # @param band [Integer] Band to extract
@@ -1406,7 +1412,7 @@ module Vips
1406
1412
  # @option opts [Integer] :height Size to this height
1407
1413
  # @option opts [Vips::Size] :size Only upsize, only downsize, or both
1408
1414
  # @option opts [Boolean] :auto_rotate Use orientation tags to rotate image upright
1409
- # @option opts [Boolean] :crop Reduce to fill target rectangle, then crop
1415
+ # @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop
1410
1416
  # @option opts [Boolean] :linear Reduce in linear light
1411
1417
  # @option opts [String] :import_profile Fallback import profile
1412
1418
  # @option opts [String] :export_profile Fallback export profile
@@ -1420,7 +1426,7 @@ module Vips
1420
1426
  # @option opts [Integer] :height Size to this height
1421
1427
  # @option opts [Vips::Size] :size Only upsize, only downsize, or both
1422
1428
  # @option opts [Boolean] :auto_rotate Use orientation tags to rotate image upright
1423
- # @option opts [Boolean] :crop Reduce to fill target rectangle, then crop
1429
+ # @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop
1424
1430
  # @option opts [Boolean] :linear Reduce in linear light
1425
1431
  # @option opts [String] :import_profile Fallback import profile
1426
1432
  # @option opts [String] :export_profile Fallback export profile
@@ -1527,7 +1533,7 @@ module Vips
1527
1533
  # @!method Lab2XYZ(opts = {})
1528
1534
  # Transform cielab to xyz.
1529
1535
  # @param [Hash] opts Set of options
1530
- # @option opts [Array<Double>] :temp Colour temperature
1536
+ # @option opts [Array<Double>] :temp Color temperature
1531
1537
  # @return [Vips::Image] Output image
1532
1538
 
1533
1539
  # @!method XYZ2Lab(opts = {})
@@ -1909,7 +1915,7 @@ module Vips
1909
1915
 
1910
1916
  # @!method draw_rect(ink, left, top, width, height, opts = {})
1911
1917
  # Paint a rectangle on an image.
1912
- # @param ink [Array<Double>] Colour for pixels
1918
+ # @param ink [Array<Double>] Color for pixels
1913
1919
  # @param left [Integer] Rect to fill
1914
1920
  # @param top [Integer] Rect to fill
1915
1921
  # @param width [Integer] Rect to fill
@@ -1920,7 +1926,7 @@ module Vips
1920
1926
 
1921
1927
  # @!method draw_mask(ink, mask, x, y, opts = {})
1922
1928
  # Draw a mask on an image.
1923
- # @param ink [Array<Double>] Colour for pixels
1929
+ # @param ink [Array<Double>] Color for pixels
1924
1930
  # @param mask [Vips::Image] Mask of pixels to draw
1925
1931
  # @param x [Integer] Draw mask here
1926
1932
  # @param y [Integer] Draw mask here
@@ -1929,7 +1935,7 @@ module Vips
1929
1935
 
1930
1936
  # @!method draw_line(ink, x1, y1, x2, y2, opts = {})
1931
1937
  # Draw a line on an image.
1932
- # @param ink [Array<Double>] Colour for pixels
1938
+ # @param ink [Array<Double>] Color for pixels
1933
1939
  # @param x1 [Integer] Start of draw_line
1934
1940
  # @param y1 [Integer] Start of draw_line
1935
1941
  # @param x2 [Integer] End of draw_line
@@ -1939,7 +1945,7 @@ module Vips
1939
1945
 
1940
1946
  # @!method draw_circle(ink, cx, cy, radius, opts = {})
1941
1947
  # Draw a circle on an image.
1942
- # @param ink [Array<Double>] Colour for pixels
1948
+ # @param ink [Array<Double>] Color for pixels
1943
1949
  # @param cx [Integer] Centre of draw_circle
1944
1950
  # @param cy [Integer] Centre of draw_circle
1945
1951
  # @param radius [Integer] Radius in pixels
@@ -1949,7 +1955,7 @@ module Vips
1949
1955
 
1950
1956
  # @!method draw_flood(ink, x, y, opts = {})
1951
1957
  # Flood-fill an area.
1952
- # @param ink [Array<Double>] Colour for pixels
1958
+ # @param ink [Array<Double>] Color for pixels
1953
1959
  # @param x [Integer] DrawFlood start point
1954
1960
  # @param y [Integer] DrawFlood start point
1955
1961
  # @param [Hash] opts Set of options
data/lib/vips/size.rb ADDED
@@ -0,0 +1,12 @@
1
+ module Vips
2
+
3
+ # Controls whether an operation should upsize, downsize, or both up and
4
+ # downsize.
5
+ #
6
+ # * `:both` size both up and down
7
+ # * `:up` only upsize
8
+ # * `:down` only downsize
9
+
10
+ class Size
11
+ end
12
+ end
data/lib/vips/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Vips
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-vips
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Cupitt
@@ -138,6 +138,7 @@ files:
138
138
  - example/trim8.rb
139
139
  - example/watermark.rb
140
140
  - example/wobble.rb
141
+ - install-vips.sh
141
142
  - lib/vips.rb
142
143
  - lib/vips/access.rb
143
144
  - lib/vips/align.rb
@@ -153,11 +154,13 @@ files:
153
154
  - lib/vips/extend.rb
154
155
  - lib/vips/foreignflags.rb
155
156
  - lib/vips/image.rb
157
+ - lib/vips/interesting.rb
156
158
  - lib/vips/interpolate.rb
157
159
  - lib/vips/interpretation.rb
158
160
  - lib/vips/kernel.rb
159
161
  - lib/vips/methods.rb
160
162
  - lib/vips/operation.rb
163
+ - lib/vips/size.rb
161
164
  - lib/vips/version.rb
162
165
  - ruby-vips.gemspec
163
166
  homepage: http://github.com/jcupitt/ruby-vips
@@ -180,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
183
  version: '0'
181
184
  requirements: []
182
185
  rubyforge_project:
183
- rubygems_version: 2.5.1
186
+ rubygems_version: 2.5.2
184
187
  signing_key:
185
188
  specification_version: 4
186
189
  summary: Ruby extension for the vips image processing library.