def __init__(self, filename, data=None, shape=None, **kwargs):
Jp2kBox.__init__(self)<EOL>self.filename = str(filename)<EOL>self.box = []<EOL>self._codec_format = None<EOL>self._colorspace = None<EOL>self._layer = <NUM_LIT:0><EOL>self._codestream = None<EOL>if data is not None:<EOL><INDENT>self._shape = data.shape<EOL><DEDENT>else:<EOL><INDENT>self._shape = shape<EOL><DEDENT>self._ignore_pclr_cmap_cdef = False<EOL>self._verbose = False<EOL>if data is None and shape is None:<EOL><INDENT>self.parse()<EOL><DEDENT>elif data is not None:<EOL><INDENT>self._write(data, **kwargs)<EOL><DEDENT>
Only the filename parameter is required in order to read a JPEG 2000
file.

Parameters
----------
filename : str
    The path to JPEG 2000 file.
image_data : ndarray, optional
    Image data to be written to file.
shape : tuple, optional
    Size of image data, only required when image_data is not provided.
cbsize : tuple, optional
    Code block size (NROWS, NCOLS)
cinema2k : int, optional
    Frames per second, either 24 or 48.
cinema4k : bool, optional
    Set to True to specify Cinema4K mode, defaults to false.
colorspace : {'rgb', 'gray'}
    The image color space.
cratios : iterable, optional
    Compression ratios for successive layers.
eph : bool, optional
    If true, write SOP marker after each header packet.
grid_offset : tuple, optional
    Offset (DY, DX) of the origin of the image in the reference grid.
irreversible : bool, optional
    If true, use the irreversible DWT 9-7 transform.
mct : bool, optional
    Usage of the multi component transform.  If not specified, defaults
    to True if the color space is RGB.
modesw : int, optional
    mode switch
        1 = BYPASS(LAZY)
        2 = RESET
        4 = RESTART(TERMALL)
        8 = VSC
        16 = ERTERM(SEGTERM)
        32 = SEGMARK(SEGSYM)
numres : int, optional
    Number of resolutions.
prog : {"LRCP" "RLCP", "RPCL", "PCRL", "CPRL"}
    Progression order.
psnr : iterable, optional
    Different PSNR for successive layers.
psizes : list, optional
    List of precinct sizes, each precinct size tuple is defined in
    (height x width).
sop : bool, optional
    If true, write SOP marker before each packet.
subsam : tuple, optional
    Subsampling factors (dy, dx).
tilesize : tuple, optional
    Tile size in terms of (numrows, numcols), not (X, Y).
verbose : bool, optional
    Print informational messages produced by the OpenJPEG library.