class_docstr: An output connection.
  
      
docstr: Make a new target to write to a file.
  
  Make a new target that will write to the named file. For example::
  
      target = pyvips.Target.new_to_file("myfile.jpg")
  
  You can pass this target to (for example) :meth:`write_to_target`.
docstr_tok: ["Make","a","new","target","to","write","to","a","file",".","Make","a","new","target","that","will","write","to","the","named","file",".","For","example",":",":","target","=","pyvips.Target.new_to_file","(","``","myfile.jpg","''",")","You","can","pass","this","target","to","(","for","example",")",":","meth",":","`","write_to_target","`","."]
code: def new_to_file(filename):
      """Make a new target to write to a file.
  
      Make a new target that will write to the named file. For example::
  
          target = pyvips.Target.new_to_file("myfile.jpg")
  
      You can pass this target to (for example) :meth:`write_to_target`.
  
      """
  
      # logger.debug('VipsTarget.new_to_file: filename = %s', filename)
  
      pointer = vips_lib.vips_target_new_to_file(_to_bytes(filename))
      if pointer == ffi.NULL:
          raise Error(
              "can't create output target from filename {0}".format(
                  filename
              )
          )
  
      return Target(pointer)
  
file_path: pyvips/pyvips/vtarget.py
imports: from __future__ import division
  import logging
  import pyvips
  from pyvips import ffi, vips_lib, Error, _to_bytes
label_desc: Use image node_id 3 for calling the Target obj's underlying member method code with example usage: obj.new_to_file(filename) and returns: Target