Method: Vips::Image#mutate

Defined in:
lib/vips/image.rb

#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)


844
845
846
847
848
# File 'lib/vips/image.rb', line 844

def mutate
  mutable = Vips::MutableImage.new self
  yield mutable
  mutable.image
end