Class: Magick::Image

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/RMagick.rb,
lib/rmagick4j/image.rb

Overview

Ruby-level Magick::Image methods

Defined Under Namespace

Classes: Info, View

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns, rows, fill = nil, &info_block) ⇒ Image

Returns a new instance of Image.



188
189
190
191
192
# File 'lib/rmagick4j/image.rb', line 188

def initialize(columns, rows, fill=nil, &info_block)
  info = Info.new(&info_block)
  @image = Magick4J.MagickImage.new(columns, rows, info._info)
  fill.fill(self) if fill.respond_to? :fill
end

Class Method Details

.allocate(*args, &add) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rmagick4j/image.rb', line 22

def self.allocate(*args, &add)
  info = Info.new(&add)
  if args.length == 1
    case args[0]
    when String then
      # TODO Respect Dir.getwd
      name = args[0]
      @image = Magick4J.ImageDatabase.createDefault(name, info._info) || Magick4J.MagickImage.new(java.io.File.new(name))
    when Magick4J.MagickImage then
      @image = args[0]
    when Image then
      @image = args[0]._image
    else
      raise ArgumentError, "The argument just can be a String, a MagickImage or an Image instance."
    end
  else
    @image = Magick4J.MagickImage.new(args[0], args[1], info._info)
    if args.length == 3
      args[2].fill(self)
    end
  end
end

.from_blob(blob, &add) ⇒ Object



4
5
6
7
# File 'lib/rmagick4j/image.rb', line 4

def self.from_blob(blob, &add)
  # TODO multiple images in file
  [Image.from_image(Magick4J.MagickImage.from_blob(blob.to_java_bytes), &add)]
end

.from_image(image, &add) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
19
20
# File 'lib/rmagick4j/image.rb', line 15

def self.from_image(image, &add)
  raise ArgumentError, 'First parameter must be a MagickImage instance.' unless image.is_a? Magick4J.MagickImage
  magick_image = Image.new(image.getWidth(), image.getHeight(), &add)
  magick_image._image = image
  magick_image
end

.read(file, &add) ⇒ Object



9
10
11
12
13
# File 'lib/rmagick4j/image.rb', line 9

def self.read(file, &add)
  info = Info.new(&add)
  image = Magick4J.ImageDatabase.createDefault(file.to_s, info._info) || Magick4J.MagickImage.new(java.io.File.new(file.to_s))
  [Image.from_image(image,&add)]
end

Instance Method Details

#_imageObject



168
169
170
# File 'lib/rmagick4j/image.rb', line 168

def _image
  @image
end

#_image=(new_image) ⇒ Object



172
173
174
# File 'lib/rmagick4j/image.rb', line 172

def _image=(new_image)
  @image = new_image
end

#_infoObject



180
181
182
# File 'lib/rmagick4j/image.rb', line 180

def _info
  @info
end

#_info=(new_info) ⇒ Object



184
185
186
# File 'lib/rmagick4j/image.rb', line 184

def _info=(new_info)
  @info = new_info
end

#affinityObject



761
# File 'lib/RMagick.rb', line 761

alias_method :affinity, :remap

#annotate(draw, width, height, x, y, text, &block) ⇒ Object

Provide an alternate version of Draw#annotate, for folks who want to find it in this class.



765
766
767
768
769
# File 'lib/RMagick.rb', line 765

def annotate(draw, width, height, x, y, text, &block)
  check_destroyed
  draw.annotate(self, width, height, x, y, text, &block)
  self
end

#background_colorObject



45
46
47
# File 'lib/rmagick4j/image.rb', line 45

def background_color
  @image.getBackgroundColor
end

#background_color=(value) ⇒ Object

Raises:

  • (TypeError)


49
50
51
52
53
# File 'lib/rmagick4j/image.rb', line 49

def background_color=(value)
  raise TypeError, "argument must be color name or pixel (#{value.class} given)" unless value.is_a?(String) || value.is_a?(Pixel)
  value = Pixel.from_color(value) if value.is_a?(String)
  @image.setBackgroundColor(value)
end

#blurObject



55
56
57
# File 'lib/rmagick4j/image.rb', line 55

def blur
  @image.getBlur
end

#blur=(value) ⇒ Object

Raises:

  • (TypeError)


59
60
61
62
# File 'lib/rmagick4j/image.rb', line 59

def blur=(value)
  raise TypeError, "no implicit conversion to float from #{value.class.to_s.downcase}" unless value.is_a? Numeric
  @image.setBlur(value)
end

#blur_image(radius = 0.0, sigma = 1.0) ⇒ Object



64
65
66
67
# File 'lib/rmagick4j/image.rb', line 64

def blur_image(radius=0.0, sigma=1.0)
  # Swap order on purpose. I wanted them the other way around in Magick4J.
  Image.from_image(Effects.BlurEffect.new(radius,sigma).apply(_image))
end

#change_geometry(geometry) {|geometry.calculate_width(self._image), geometry.calculate_height(self._image), _self| ... } ⇒ Object

Yields:

  • (geometry.calculate_width(self._image), geometry.calculate_height(self._image), _self)

Yield Parameters:

  • _self (Magick::Image)

    the object that the method was called on



69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/rmagick4j/image.rb', line 69

def change_geometry(geometry)
  geometry = Geometry.from_s(geometry.to_s) unless geometry.is_a? Geometry
  index = if geometry.flag.nil?
            0
          else
            geometry.flag._val
          end
  geometry = JGeometries[index].new( geometry.width, geometry.height,
                                     geometry.x, geometry.y)
  yield geometry.calculate_width(self._image),
        geometry.calculate_height(self._image),
        self
end

#charcoal(radius = 0.0, sigma = 1.0) ⇒ Object



83
84
85
# File 'lib/rmagick4j/image.rb', line 83

def charcoal(radius=0.0, sigma=1.0)
  Image.from_image(Effects.CharcoalEffect.new(radius,sigma).apply(_image))
end

#color_fill_to_border(x, y, fill) ⇒ Object

Set all pixels that are neighbors of x,y and are not the border color to the fill color



787
788
789
# File 'lib/RMagick.rb', line 787

def color_fill_to_border(x, y, fill)
    color_flood_fill(border_color, fill, x, y, Magick::FillToBorderMethod)
end

#color_floodfill(x, y, fill) ⇒ Object

Set all pixels that have the same color as the pixel at x,y and are neighbors to the fill color



780
781
782
783
# File 'lib/RMagick.rb', line 780

def color_floodfill(x, y, fill)
    target = pixel_color(x, y)
    color_flood_fill(target, fill, x, y, Magick::FloodfillMethod)
end

#color_point(x, y, fill) ⇒ Object

Set the color at x,y



772
773
774
775
776
# File 'lib/RMagick.rb', line 772

def color_point(x, y, fill)
    f = copy
    f.pixel_color(x, y, fill)
    return f
end

#color_reset!(fill) ⇒ Object

Set all pixels to the fill color. Very similar to Image#erase! Accepts either String or Pixel arguments



793
794
795
796
797
798
799
800
801
802
803
804
805
# File 'lib/RMagick.rb', line 793

def color_reset!(fill)
    save = background_color
    # Change the background color _outside_ the begin block
    # so that if this object is frozen the exeception will be
    # raised before we have to handle it explicitly.
    self.background_color = fill
    begin
        erase!
    ensure
        self.background_color = save
    end
    self
end

#columnsObject



87
88
89
# File 'lib/rmagick4j/image.rb', line 87

def columns
  @image.getWidth
end

#composite(*args) ⇒ Object



91
92
93
94
95
96
# File 'lib/rmagick4j/image.rb', line 91

def composite(*args)
  # image, x, y, composite_op
  args[0] = args[0]._image
  args.map! {|arg| arg.is_a?(Enum) ? arg._val : arg}
  Image.from_image(@image.composited(*args))
end

#copyObject



98
99
100
# File 'lib/rmagick4j/image.rb', line 98

def copy
  Image.from_image(@image.clone)
end

#crop(*args) ⇒ Object



102
103
104
# File 'lib/rmagick4j/image.rb', line 102

def crop(*args)
  copy.crop!(*args)
end

#crop!(*args) ⇒ Object



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
# File 'lib/rmagick4j/image.rb', line 106

def crop!(*args)
  # gravity, x, y, width, height, reset_offset
  # Defaults.
  gravity = nil
  x = y = -1
  reset_offset = false
  # Find available args.
  if args.first.is_a? GravityType
    gravity = args.shift._val
  end
  if [FalseClass, TrueClass].member? args.last.class
    reset = args.pop
  end
  if args.length == 4
    x, y = args[0..1]
  end
  width, height = args[-2..-1]
  # Call Java.
  # TODO Why wouldn't we reset offset information? Do we need to use that?
  @image =  unless gravity.nil?
              if x == -1 || y == -1
                @image.crop(gravity, width, height)
              else
                @image.crop(gravity, x, y, width, height)
              end
            else
              @image.crop(x,y,width,height)
            end
  self
end

#cur_imageObject

Used by ImageList methods - see ImageList#cur_image



808
809
810
# File 'lib/RMagick.rb', line 808

def cur_image
    self
end

#displayObject



137
138
139
140
# File 'lib/rmagick4j/image.rb', line 137

def display
  @image.display
  self
end

#each_iptc_datasetObject

Iterate over IPTC record number:dataset tags, yield for each non-nil dataset



870
871
872
873
874
875
876
877
878
879
# File 'lib/RMagick.rb', line 870

def each_iptc_dataset
    Magick::IPTC.constants.each do |record|
        rec = Magick::IPTC.const_get(record)
        rec.constants.each do |dataset|
            data_field = get_iptc_dataset(rec.const_get(dataset))
            yield(dataset, data_field) unless data_field.nil?
        end
    end
    nil
end

#each_pixelObject

Thanks to Russell Norris!



813
814
815
816
817
818
# File 'lib/RMagick.rb', line 813

def each_pixel
  get_pixels(0, 0, columns, rows).each_with_index do |p, n|
    yield(p, n%columns, n/columns)
  end
  self
end

#edge(radius = 0.0) ⇒ Object



142
143
144
# File 'lib/rmagick4j/image.rb', line 142

def edge(radius=0.0)
  Image.from_image(Effects.EdgeEffect.new(radius).apply(_image))
end

#erase!Object



146
147
148
# File 'lib/rmagick4j/image.rb', line 146

def erase!
  @image.erase
end

#flipObject



159
160
161
# File 'lib/rmagick4j/image.rb', line 159

def flip
  copy.flip
end

#flip!Object



163
164
165
166
# File 'lib/rmagick4j/image.rb', line 163

def flip!
  @image.flip
  self
end

#formatObject



150
151
152
# File 'lib/rmagick4j/image.rb', line 150

def format
  @image.getFormat
end

#format=(format) ⇒ Object



154
155
156
157
# File 'lib/rmagick4j/image.rb', line 154

def format= format
  @image.setFormat(format)
  self
end

#get_exif_by_entry(*entry) ⇒ Object

Retrieve EXIF data by entry or all. If one or more entry names specified, return the values associated with the entries. If no entries specified, return all entries and values. The return value is an array of [name,value] arrays.



824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
# File 'lib/RMagick.rb', line 824

def get_exif_by_entry(*entry)
    ary = Array.new
    if entry.length == 0
        exif_data = self['EXIF:*']
        if exif_data
            exif_data.split("\n").each { |exif| ary.push(exif.split('=')) }
        end
    else
        get_exif_by_entry()     # ensure properties is populated with exif data
        entry.each do |name|
            rval = self["EXIF:#{name}"]
            ary.push([name, rval])
        end
    end
    return ary
end

#get_exif_by_number(*tag) ⇒ Object

Retrieve EXIF data by tag number or all tag/value pairs. The return value is a hash.



842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/RMagick.rb', line 842

def get_exif_by_number(*tag)
    hash = Hash.new
    if tag.length == 0
        exif_data = self['EXIF:!']
        if exif_data
            exif_data.split("\n").each do |exif|
                tag, value = exif.split('=')
                tag = tag[1,4].hex
                hash[tag] = value
            end
        end
    else
        get_exif_by_number()    # ensure properties is populated with exif data
        tag.each do |num|
            rval = self['#%04X' % num.to_i]
            hash[num] = rval == 'unknown' ? nil : rval
        end
    end
    return hash
end

#get_iptc_dataset(ds) ⇒ Object

Retrieve IPTC information by record number:dataset tag constant defined in Magick::IPTC, above.



865
866
867
# File 'lib/RMagick.rb', line 865

def get_iptc_dataset(ds)
    self['IPTC:'+ds]
end

#implode(amount = 0.5) ⇒ Object



176
177
178
# File 'lib/rmagick4j/image.rb', line 176

def implode(amount=0.5)
  Image.from_image(Effects.ImplodeEffect.new(amount).apply(_image))
end

#level(black_point = 0.0, white_point = nil, gamma = nil) ⇒ Object

(Thanks to Al Evans for the suggestion.)



894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
# File 'lib/RMagick.rb', line 894

def level(black_point=0.0, white_point=nil, gamma=nil)
    black_point = Float(black_point)

    white_point ||= Magick::QuantumRange - black_point
    white_point = Float(white_point)

    gamma_arg = gamma
    gamma ||= 1.0
    gamma = Float(gamma)

    if gamma.abs > 10.0 || white_point.abs <= 10.0 || white_point.abs < gamma.abs
        gamma, white_point = white_point, gamma
        unless gamma_arg
            white_point = Magick::QuantumRange - black_point
        end
    end

    return level2(black_point, white_point, gamma)
end

#matteObject



194
195
196
# File 'lib/rmagick4j/image.rb', line 194

def matte
  @image.getMatte
end

#matte=(matte) ⇒ Object



198
199
200
# File 'lib/rmagick4j/image.rb', line 198

def matte= matte
  @image.setMatte(matte)
end

#matte_fill_to_border(x, y) ⇒ Object

Make transparent any neighbor pixel that is not the border color.



948
949
950
951
952
953
# File 'lib/RMagick.rb', line 948

def matte_fill_to_border(x, y)
    f = copy
    f.opacity = Magick::OpaqueOpacity unless f.matte
    f.matte_flood_fill(border_color, TransparentOpacity,
                       x, y, FillToBorderMethod)
end

#matte_floodfill(x, y) ⇒ Object

Make transparent any pixel that matches the color of the pixel at (x,y) and is a neighbor.



939
940
941
942
943
944
945
# File 'lib/RMagick.rb', line 939

def matte_floodfill(x, y)
    f = copy
    f.opacity = OpaqueOpacity unless f.matte
    target = f.pixel_color(x, y)
    f.matte_flood_fill(target, TransparentOpacity,
                       x, y, FloodfillMethod)
end

#matte_point(x, y) ⇒ Object

Make the pixel at (x,y) transparent.



919
920
921
922
923
924
925
926
# File 'lib/RMagick.rb', line 919

def matte_point(x, y)
    f = copy
    f.opacity = OpaqueOpacity unless f.matte
    pixel = f.pixel_color(x,y)
    pixel.opacity = TransparentOpacity
    f.pixel_color(x, y, pixel)
    return f
end

#matte_replace(x, y) ⇒ Object

Make transparent all pixels that are the same color as the pixel at (x, y).



930
931
932
933
934
935
# File 'lib/RMagick.rb', line 930

def matte_replace(x, y)
    f = copy
    f.opacity = OpaqueOpacity unless f.matte
    target = f.pixel_color(x, y)
    f.transparent(target)
end

#matte_reset!Object

Make all pixels transparent.



956
957
958
959
# File 'lib/RMagick.rb', line 956

def matte_reset!
    self.opacity = Magick::TransparentOpacity
    self
end

#negate(grayscale = false) ⇒ Object



202
203
204
# File 'lib/rmagick4j/image.rb', line 202

def negate(grayscale=false)
  Image.from_image(Effects.NegateEffect.new(grayscale).apply(_image))
end

#normalizeObject



206
207
208
# File 'lib/rmagick4j/image.rb', line 206

def normalize
  Image.from_image(Effects.NormalizeEffect.new().apply(_image))
end

#quantize(number_colors = 256, colorspace = RGBColorspace, dither = true, tree_depth = 0, measure_error = false) ⇒ Object



210
211
212
# File 'lib/rmagick4j/image.rb', line 210

def quantize(number_colors=256, colorspace=RGBColorspace, dither=true, tree_depth=0, measure_error=false)
  Image.from_image(@image.quantized(number_colors, colorspace._val, dither, tree_depth, measure_error))
end

#raise(width = 6, height = 6, raise = true) ⇒ Object



214
215
216
# File 'lib/rmagick4j/image.rb', line 214

def raise(width=6, height=6, raise=true)
  Image.from_image(@image.raised(width, height, raise))
end

#remapObject



218
219
220
# File 'lib/rmagick4j/image.rb', line 218

def remap
	# TODO: Implement. Just here to avoid warning in RMagick 2.9 file.
end

#resample(x_res = 72.0, y_res = nil) ⇒ Object

Corresponds to ImageMagick’s -resample option



962
963
964
965
966
967
968
969
# File 'lib/RMagick.rb', line 962

def resample(x_res=72.0, y_res=nil)
    y_res ||= x_res
    width = x_res * columns / x_resolution + 0.5
    height = y_res * rows / y_resolution + 0.5
    self.x_resolution = x_res
    self.y_resolution = y_res
    resize(width, height)
end

#resize(*args) ⇒ Object



222
223
224
# File 'lib/rmagick4j/image.rb', line 222

def resize(*args)
  copy.resize!(*args)
end

#resize!(*args) ⇒ Object



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/rmagick4j/image.rb', line 226

def resize!(*args)
  @image =  if args.length == 1
              @image.resized(args[0])
            elsif args.length == 2 # It must be 4 nor 2, but two of them are not yet implemented
              # TODO  Implement the other two arguments.
              # arg[0] --> new_width
              # arg[1] --> new_height
              # arg[2] --> filter=LanczosFilter
              # arg[3] --> support=1.0
              @image.resized(args[0],args[1])
            else
              Kernel.raise ArgumentError, "wrong number of parameters(#{args.length} for 1 or 4)"
            end
  self
end

#resize_to_fill(ncols, nrows = nil, gravity = CenterGravity) ⇒ Object Also known as: crop_resized

Force an image to exact dimensions without changing the aspect ratio. Resize and crop if necessary. (Thanks to Jerett Taylor!)



973
974
975
# File 'lib/RMagick.rb', line 973

def resize_to_fill(ncols, nrows=nil, gravity=CenterGravity)
    copy.resize_to_fill!(ncols, nrows, gravity)
end

#resize_to_fill!(ncols, nrows = nil, gravity = CenterGravity) ⇒ Object Also known as: crop_resized!



977
978
979
980
981
982
983
984
985
# File 'lib/RMagick.rb', line 977

def resize_to_fill!(ncols, nrows=nil, gravity=CenterGravity)
    nrows ||= ncols
    if ncols != columns || nrows != rows
        scale = [ncols/columns.to_f, nrows/rows.to_f].max
        resize!(scale*columns+0.5, scale*rows+0.5)
    end
    crop!(gravity, ncols, nrows, true) if ncols != columns || nrows != rows
    self
end

#resize_to_fit(cols, rows = nil) ⇒ Object

Convenience method to resize retaining the aspect ratio. (Thanks to Robert Manni!)



993
994
995
996
997
998
# File 'lib/RMagick.rb', line 993

def resize_to_fit(cols, rows=nil)
    rows ||= cols
    change_geometry(Geometry.new(cols, rows)) do |ncols, nrows|
        resize(ncols, nrows)
    end
end

#resize_to_fit!(cols, rows = nil) ⇒ Object



1000
1001
1002
1003
1004
1005
# File 'lib/RMagick.rb', line 1000

def resize_to_fit!(cols, rows=nil)
    rows ||= cols
    change_geometry(Geometry.new(cols, rows)) do |ncols, nrows|
        resize!(ncols, nrows)
    end
end

#rotate(amount, qualifier = nil) ⇒ Object



242
243
244
# File 'lib/rmagick4j/image.rb', line 242

def rotate(amount, qualifier=nil)
  copy.rotate!(amount,qualifier)
end

#rotate!(amount, qualifier = nil) ⇒ Object



246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/rmagick4j/image.rb', line 246

def rotate!(amount, qualifier=nil)
  if qualifier == '<' && columns < rows
    @image.rotate(amount)
    self
  elsif qualifier == '>' && columns > rows
    @image.rotate(amount)
    self
  elsif qualifier.nil?
    @image.rotate(amount)
    self
  else
    nil
  end
end

#rowsObject



261
262
263
# File 'lib/rmagick4j/image.rb', line 261

def rows
  @image.getHeight
end

#shade(shading = false, azimuth = 30, elevation = 30) ⇒ Object



265
266
267
# File 'lib/rmagick4j/image.rb', line 265

def shade(shading=false,azimuth=30,elevation=30)
  Image.from_image(Effects.ShadeEffect.new(shading,azimuth,elevation).apply(_image))
end

#solarize(threshold = 50) ⇒ Object



269
270
271
# File 'lib/rmagick4j/image.rb', line 269

def solarize(threshold=50)
  Image.from_image(Effects.SolarizeEffect.new(threshold).apply(_image))
end

#store_pixels(x, y, columns, rows, pixels) ⇒ Object

Raises:

  • (IndexError)


273
274
275
276
277
# File 'lib/rmagick4j/image.rb', line 273

def store_pixels(x, y, columns, rows, pixels)
  ria_size = columns*rows
  raise IndexError, "not enough elements in array - expecting #{ria_size}, got #{pixels.size}" if pixels.size < ria_size
  @image.storePixels(x,y,columns,rows,pixels.to_java)
end

#texture_fill_to_border(x, y, texture) ⇒ Object

Replace neighboring pixels to border color with texture pixels



1014
1015
1016
# File 'lib/RMagick.rb', line 1014

def texture_fill_to_border(x, y, texture)
    texture_flood_fill(border_color, texture, x, y, FillToBorderMethod)
end

#texture_floodfill(x, y, texture) ⇒ Object

Replace matching neighboring pixels with texture pixels



1008
1009
1010
1011
# File 'lib/RMagick.rb', line 1008

def texture_floodfill(x, y, texture)
    target = pixel_color(x, y)
    texture_flood_fill(target, texture, x, y, FloodfillMethod)
end

#to_blob(&add) ⇒ Object



279
280
281
282
283
# File 'lib/rmagick4j/image.rb', line 279

def to_blob(&add)
  info = Info.new(&add)
  @image.setFormat(info.format) if info.format
  String.from_java_bytes(@image.toBlob)
end

#view(x, y, width, height) ⇒ Object

Construct a view. If a block is present, yield and pass the view object, otherwise return the view object.



1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
# File 'lib/RMagick.rb', line 1020

def view(x, y, width, height)
    view = View.new(self, x, y, width, height)

    if block_given?
        begin
            yield(view)
        ensure
            view.sync
        end
        return nil
    else
        return view
    end
end

#watermark(mark, lightness = 1.0, saturation = 1.0, gravity = nil, x_offset = 0, y_offset = 0) ⇒ Object



285
286
287
288
289
290
291
292
293
294
# File 'lib/rmagick4j/image.rb', line 285

def watermark(mark, lightness=1.0, saturation=1.0, gravity=nil, x_offset=0, y_offset=0)
  if gravity.is_a? Numeric
    # gravity is technically an optional argument in the middle.
    gravity = nil
    y_offset = x_offset
    x_offset = gravity
  end
  # TODO Perform watermark.
  self
end

#wave(amplitude = 25.0, wavelength = 150.0) ⇒ Object



296
297
298
# File 'lib/rmagick4j/image.rb', line 296

def wave(amplitude=25.0, wavelength=150.0)
  Image.from_image(Effects.WaveEffect.new(amplitude,wavelength).apply(_image))
end

#write(file, &add) ⇒ Object



300
301
302
303
304
305
306
# File 'lib/rmagick4j/image.rb', line 300

def write(file, &add)
  # TODO I'm having trouble finding out how this info is used, so I'll skip using it for now.
  info = Info.new(&add)
  # TODO Resolve pwd as needed
  @image.write(file)
  self
end