vendor/bundle/ruby/2.6.0/gems/ruby-vips-2.0.17/lib/vips/image.rb
# 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
Write this image to a memory buffer. 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 memory buffer . 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_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 buffer 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 buffer 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.
Write this image to a memory buffer .
the image saved in the specified format
the image saved in the specified format
String
format_string
save format plus options
save format plus options
opts
macro
None