We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent acdf04c commit 47cf9a8Copy full SHA for 47cf9a8
CHANGELOG.md
@@ -4,6 +4,7 @@
4
5
* simplify gemspec [sandstrom]
6
* remove jeweler dependency [John Cupitt]
7
+* add `.to_a` to Image [John Cupitt]
8
9
# Version 1.0.0
10
lib/vips/image.rb
@@ -926,6 +926,21 @@ def [](index)
926
end
927
928
929
+ # Convert to an Array. This will be very slow for large images.
930
+ #
931
+ # @return [Array] array of Fixnum
932
+ def to_a
933
+ ar = Array.new(height)
934
+ for y in 0...height
935
+ ar[y] = Array.new(width)
936
+ for x in 0...width
937
+ ar[y][x] = getpoint(x, y)
938
+ end
939
940
+
941
+ return ar
942
943
944
# Return the largest integral value not greater than the argument.
945
#
946
# @return [Image] floor of image
0 commit comments