def write_to_file name, opts = {}
      filename = Vips::p2str(Vips::vips_filename_get_filename name)
      option_string = Vips::p2str(Vips::vips_filename_get_options name)
      saver = Vips::vips_foreign_find_save filename
      if saver == nil
        raise Vips::Error, "No known saver for '#{filename}'."
      end

      Vips::Operation.call saver, [self, filename], opts, option_string

      write_gc
    end
def write_to_file name, opts = {}
      filename = Vips::p2str(Vips::vips_filename_get_filename name)
      option_string = Vips::p2str(Vips::vips_filename_get_options name)
      saver = Vips::vips_foreign_find_save filename
      if saver == nil
        raise Vips::Error, "No known saver for '#{filename}'."
      end

      Vips::Operation.call saver, [self, filename], opts, option_string

      write_gc
    end
Write this image to a file. Save options may be encoded in the
 filename or given as a hash. For example:

 ```
 image.write_to_file "fred.jpg[Q=90]"
 ```

 or equivalently:

 ```
 image.write_to_file "fred.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.

 @!macro [new] vips.saveopts
   @param opts [Hash] set of options
   @option opts [Boolean] :strip (false) Strip all metadata from image
   @option opts [Array<Float>] :background (0) Background colour to
     flatten alpha against, if necessary

 @param name [String] filename to write to