def write_image(self, img, extname=None, extver=None,<EOL>compress=None, tile_dims=None, header=None):
self.create_image_hdu(img,<EOL>header=header,<EOL>extname=extname, extver=extver,<EOL>compress=compress, tile_dims=tile_dims)<EOL>if header is not None:<EOL><INDENT>self[-<NUM_LIT:1>].write_keys(header)<EOL>self[-<NUM_LIT:1>]._update_info()<EOL><DEDENT>
Create a new image extension and write the data.

parameters
----------
img: ndarray
    An n-dimensional image.
extname: string, optional
    An optional extension name.
extver: integer, optional
    FITS allows multiple extensions to have the same name (extname).
    These extensions can optionally specify an EXTVER version number in
    the header.  Send extver= to set a particular version, which will
    be represented in the header with keyname EXTVER.  The extver must
    be an integer > 0.  If extver is not sent, the first one will be
    selected.  If ext is an integer, the extver is ignored.
compress: string, optional
    A string representing the compression algorithm for images,
    default None.
    Can be one of
        'RICE'
        'GZIP'
        'GZIP_2'
        'PLIO' (no unsigned or negative integers)
        'HCOMPRESS'
    (case-insensitive) See the cfitsio manual for details.
header: FITSHDR, list, dict, optional
    A set of header keys to write. Can be one of these:
        - FITSHDR object
        - list of dictionaries containing 'name','value' and optionally
          a 'comment' field; the order is preserved.
        - a dictionary of keyword-value pairs; no comments are written
          in this case, and the order is arbitrary.
    Note required keywords such as NAXIS, XTENSION, etc are cleaed out.


restrictions
------------
The File must be opened READWRITE