# Path: imageio/plugins/pillow_legacy.py
# GENERIC_DOCS = """
#     Parameters for reading
#     ----------------------
# 
#     pilmode : str
#         From the Pillow documentation:
# 
#         * 'L' (8-bit pixels, grayscale)
#         * 'P' (8-bit pixels, mapped to any other mode using a color palette)
#         * 'RGB' (3x8-bit pixels, true color)
#         * 'RGBA' (4x8-bit pixels, true color with transparency mask)
#         * 'CMYK' (4x8-bit pixels, color separation)
#         * 'YCbCr' (3x8-bit pixels, color video format)
#         * 'I' (32-bit signed integer pixels)
#         * 'F' (32-bit floating point pixels)
# 
#         PIL also provides limited support for a few special modes, including
#         'LA' ('L' with alpha), 'RGBX' (true color with padding) and 'RGBa'
#         (true color with premultiplied alpha).
# 
#         When translating a color image to grayscale (mode 'L', 'I' or 'F'),
#         the library uses the ITU-R 601-2 luma transform::
# 
#             L = R * 299/1000 + G * 587/1000 + B * 114/1000
#     as_gray : bool
#         If True, the image is converted using mode 'F'. When `mode` is
#         not None and `as_gray` is True, the image is first converted
#         according to `mode`, and the result is then "flattened" using
#         mode 'F'.
# """
# class PillowFormat(Format):
#     class Reader(Format.Reader):
#     class Writer(Format.Writer):
# class PNGFormat(PillowFormat):
#     class Reader(PillowFormat.Reader):
#     class Writer(PillowFormat.Writer):
# class JPEGFormat(PillowFormat):
#     class Reader(PillowFormat.Reader):
#     class Writer(PillowFormat.Writer):
# class JPEG2000Format(PillowFormat):
#     class Reader(PillowFormat.Reader):
#     class Writer(PillowFormat.Writer):
#     def __init__(self, *args, plugin_id: str = None, **kwargs):
#     def plugin_id(self):
#     def _init_pillow(self):
#     def _can_read(self, request):
#     def _can_write(self, request):
#         def _open(self, pilmode=None, as_gray=False):
#         def _get_file(self):
#         def _close(self):
#         def _get_length(self):
#         def _seek(self, index):
#         def _get_data(self, index):
#         def _get_meta_data(self, index):
#         def _open(self):
#         def _close(self):
#         def _append_data(self, im, meta):
#         def set_meta_data(self, meta):
#         def _open(self, pilmode=None, as_gray=False, ignoregamma=True):
#         def _get_data(self, index):
#         def _open(self, compression=None, quantize=None, interlaced=False, **kwargs):
#         def _append_data(self, im, meta):
#         def _open(self, pilmode=None, as_gray=False, exifrotate=True):
#         def _get_file(self):
#         def _get_data(self, index):
#         def _rotate(self, im, meta):
#         def _open(self, quality=75, progressive=False, optimize=False, **kwargs):
#         def _append_data(self, im, meta):
#         def _open(self, pilmode=None, as_gray=False):
#         def _get_file(self):
#         def _get_data(self, index):
#         def _rotate(self, im, meta):
#         def _open(self, quality_mode="rates", quality=5, **kwargs):
#         def _append_data(self, im, meta):
# def save_pillow_close(im):
# def pil_try_read(im):
# def _palette_is_grayscale(pil_image):
# def pil_get_frame(im, is_gray=None, as_gray=None, mode=None, dtype=None):
# def ndarray_to_pil(arr, format_str=None, prefer_uint8=True):


import logging
import numpy as np
from .pillow_legacy import PillowFormat, ndarray_to_pil, image_as_uint
        from PIL.GifImagePlugin import getdata
        from PIL.GifImagePlugin import getheader
"""
PIL formats for multiple images.
"""





logger = logging.getLogger(__name__)

NeuQuant = None  # we can implement this when we need it



# Path: imageio/plugins/pillow_legacy.py
# GENERIC_DOCS = """
#     Parameters for reading
#     ----------------------
# 
#     pilmode : str
#         From the Pillow documentation:
# 
#         * 'L' (8-bit pixels, grayscale)
#         * 'P' (8-bit pixels, mapped to any other mode using a color palette)
#         * 'RGB' (3x8-bit pixels, true color)
#         * 'RGBA' (4x8-bit pixels, true color with transparency mask)
#         * 'CMYK' (4x8-bit pixels, color separation)
#         * 'YCbCr' (3x8-bit pixels, color video format)
#         * 'I' (32-bit signed integer pixels)
#         * 'F' (32-bit floating point pixels)
# 
#         PIL also provides limited support for a few special modes, including
#         'LA' ('L' with alpha), 'RGBX' (true color with padding) and 'RGBa'
#         (true color with premultiplied alpha).
# 
#         When translating a color image to grayscale (mode 'L', 'I' or 'F'),
#         the library uses the ITU-R 601-2 luma transform::
# 
#             L = R * 299/1000 + G * 587/1000 + B * 114/1000
#     as_gray : bool
#         If True, the image is converted using mode 'F'. When `mode` is
#         not None and `as_gray` is True, the image is first converted
#         according to `mode`, and the result is then "flattened" using
#         mode 'F'.
# """
# class PillowFormat(Format):
#     class Reader(Format.Reader):
#     class Writer(Format.Writer):
# class PNGFormat(PillowFormat):
#     class Reader(PillowFormat.Reader):
#     class Writer(PillowFormat.Writer):
# class JPEGFormat(PillowFormat):
#     class Reader(PillowFormat.Reader):
#     class Writer(PillowFormat.Writer):
# class JPEG2000Format(PillowFormat):
#     class Reader(PillowFormat.Reader):
#     class Writer(PillowFormat.Writer):
#     def __init__(self, *args, plugin_id: str = None, **kwargs):
#     def plugin_id(self):
#     def _init_pillow(self):
#     def _can_read(self, request):
#     def _can_write(self, request):
#         def _open(self, pilmode=None, as_gray=False):
#         def _get_file(self):
#         def _close(self):
#         def _get_length(self):
#         def _seek(self, index):
#         def _get_data(self, index):
#         def _get_meta_data(self, index):
#         def _open(self):
#         def _close(self):
#         def _append_data(self, im, meta):
#         def set_meta_data(self, meta):
#         def _open(self, pilmode=None, as_gray=False, ignoregamma=True):
#         def _get_data(self, index):
#         def _open(self, compression=None, quantize=None, interlaced=False, **kwargs):
#         def _append_data(self, im, meta):
#         def _open(self, pilmode=None, as_gray=False, exifrotate=True):
#         def _get_file(self):
#         def _get_data(self, index):
#         def _rotate(self, im, meta):
#         def _open(self, quality=75, progressive=False, optimize=False, **kwargs):
#         def _append_data(self, im, meta):
#         def _open(self, pilmode=None, as_gray=False):
#         def _get_file(self):
#         def _get_data(self, index):
#         def _rotate(self, im, meta):
#         def _open(self, quality_mode="rates", quality=5, **kwargs):
#         def _append_data(self, im, meta):
# def save_pillow_close(im):
# def pil_try_read(im):
# def _palette_is_grayscale(pil_image):
# def pil_get_frame(im, is_gray=None, as_gray=None, mode=None, dtype=None):
# def ndarray_to_pil(arr, format_str=None, prefer_uint8=True):


# Path: imageio/plugins/pillowmulti.py
import logging
import numpy as np
from .pillow_legacy import PillowFormat, ndarray_to_pil, image_as_uint
        from PIL.GifImagePlugin import getdata
        from PIL.GifImagePlugin import getheader

"""
PIL formats for multiple images.
"""





logger = logging.getLogger(__name__)

NeuQuant = None  # we can implement this when we need it



class TIFFFormat(PillowFormat):