vendor/bundle/ruby/2.6.0/gems/ruby-vips-2.0.17/lib/vips/image.rb
# Write this image to a target. Save options may be encoded in
# the format_string or given as a hash. For example:
#
# ```ruby
# target = Vips::Target.new_to_file "k2.jpg"
# image.write_to_target target, ".jpg[Q=90]"
# ```
#
# or equivalently:
#
# ```ruby
# image.write_to_target target, ".jpg", Q: 90
# ```
#
# The full set of save options depend on the selected saver. Try
# something like:
#
# ```
# $ vips jpegsave_target
# ```
#
# to see all the available options for JPEG save.
#
# @param target [Vips::Target] the target to write to
# @param format_string [String] save format plus string options
# @macro vips.saveopts
Write this image to a target. Save options may be encoded in
the format_string or given as a hash. For example.



or equivalently.



The full set of save options depend on the selected saver. Try
something like.



to see all the available options for JPEG save.
Write this image to a target . Save options may be encoded in the format_string or given as a hash . For example . or equivalently . The full set of save options depend on the selected saver . Try something like . to see all the available options for JPEG save .
def write_to_target target, 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_target filename
      if saver == nil
        raise Vips::Error, "No known target saver for '#{filename}'."
      end
      Vips::Operation.call saver, [self, target], opts, option_string
      write_gc
    end
def write_to_target target , 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_target filename if saver == nil raise Vips :: Error , "No known target saver for '#{filename}'." end Vips :: Operation . call saver , [ self , target ] , opts , option_string write_gc end
Write this image to a target.
Write this image to a target .
target
the target to write to
the target to write to
format_string
save format plus string options
save format plus string options
opts
macro
None