'Optional arguments are added to self.png_options for pickup when saving.
Palette argument is a URL relative to the configuration file,
and it implies bits and optional transparency options.
More information about options:
http://effbot.org/imagingbook/format-png.htm'

def setSaveOptionsPNG(self, optimize=None, palette=None, palette256=None):

    if (optimize is not None):
        self.png_options['optimize'] = bool(optimize)
    if (palette is not None):
        palette = urljoin(self.config.dirpath, palette)
        (palette, bits, t_index) = load_palette(palette)
        (self.bitmap_palette, self.png_options['bits']) = (palette, bits)
        if (t_index is not None):
            self.png_options['transparency'] = t_index
    if (palette256 is not None):
        self.palette256 = bool(palette256)
    else:
        self.palette256 = None
