def write_to_buffer format_string, opts = {}
      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
      if saver == nil
        raise Vips::Error, "No known saver for '#{filename}'."
      end

      buffer = Vips::Operation.call saver, [self], opts, option_string
      raise Vips::Error if buffer == nil

      write_gc

      return buffer
    end
def write_to_buffer format_string, opts = {}
      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
      if saver == nil
        raise Vips::Error, "No known saver for '#{filename}'."
      end

      buffer = Vips::Operation.call saver, [self], opts, option_string
      raise Vips::Error if buffer == nil

      write_gc

      return buffer
    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