예제 #1
0
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        def cmd(old, new):
            return [str(gs), '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
             '-sOutputFile=' + new, old]
        converter['pdf'] = make_external_conversion_command(cmd)
        converter['eps'] = make_external_conversion_command(cmd)

    if matplotlib.checkdep_inkscape() is not None:
        converter['svg'] = _SVGConverter()
예제 #2
0
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        def cmd(old, new):
            return [str(gs), '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
             '-sOutputFile=' + new, old]
        converter['pdf'] = make_external_conversion_command(cmd)
        converter['eps'] = make_external_conversion_command(cmd)

    if matplotlib.checkdep_inkscape() is not None:
        converter['svg'] = _SVGConverter()
예제 #3
0
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        cmd = lambda old, new: \
            [gs, '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
             '-sOutputFile=' + new, old]
        converter['pdf'] = make_external_conversion_command(cmd)
        converter['eps'] = make_external_conversion_command(cmd)

    if matplotlib.checkdep_inkscape() is not None:
        cmd = lambda old, new: \
            ['inkscape', '-z', old, '--export-png', new]
        converter['svg'] = make_external_conversion_command(cmd)
예제 #4
0
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        cmd = lambda old, new: \
            [gs, '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
             '-sOutputFile=' + new, old]
        converter['pdf'] = make_external_conversion_command(cmd)
        converter['eps'] = make_external_conversion_command(cmd)

    if matplotlib.checkdep_inkscape() is not None:
        cmd = lambda old, new: \
            ['inkscape', '-z', old, '--export-png', new]
        converter['svg'] = make_external_conversion_command(cmd)
예제 #5
0
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:

        def cmd(old, new):
            return [gs, "-q", "-sDEVICE=png16m", "-dNOPAUSE", "-dBATCH", "-sOutputFile=" + new, old]

        converter["pdf"] = make_external_conversion_command(cmd)
        converter["eps"] = make_external_conversion_command(cmd)

    if matplotlib.checkdep_inkscape() is not None:

        def cmd(old, new):
            return ["inkscape", "-z", old, "--export-png", new]

        converter["svg"] = make_external_conversion_command(cmd)
예제 #6
0
def get_file_hash(path, block_size=2 ** 20):
    md5 = hashlib.md5()
    with open(path, 'rb') as fd:
        while True:
            data = fd.read(block_size)
            if not data:
                break
            md5.update(data)

    if path.endswith('.pdf'):
        from matplotlib import checkdep_ghostscript
        md5.update(checkdep_ghostscript()[1].encode('utf-8'))
    elif path.endswith('.svg'):
        from matplotlib import checkdep_inkscape
        md5.update(checkdep_inkscape().encode('utf-8'))

    return md5.hexdigest()
예제 #7
0
def get_file_hash(path, block_size=2 ** 20):
    md5 = hashlib.md5()
    with open(path, 'rb') as fd:
        while True:
            data = fd.read(block_size)
            if not data:
                break
            md5.update(data)

    if path.endswith('.pdf'):
        from matplotlib import checkdep_ghostscript
        md5.update(checkdep_ghostscript()[1].encode('utf-8'))
    elif path.endswith('.svg'):
        from matplotlib import checkdep_inkscape
        md5.update(checkdep_inkscape().encode('utf-8'))

    return md5.hexdigest()
예제 #8
0
    return convert


if matplotlib.checkdep_ghostscript() is not None:
    # FIXME: make checkdep_ghostscript return the command
    if sys.platform == 'win32':
        gs = 'gswin32c'
    else:
        gs = 'gs'
    cmd = lambda old, new: \
        [gs, '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
         '-sOutputFile=' + new, old]
    converter['pdf'] = make_external_conversion_command(cmd)
    converter['eps'] = make_external_conversion_command(cmd)

if matplotlib.checkdep_inkscape() is not None:
    cmd = lambda old, new: \
              ['inkscape', '-z', old, '--export-png', new]
    converter['svg'] = make_external_conversion_command(cmd)


def comparable_formats():
    '''Returns the list of file formats that compare_images can compare
   on this system.'''
    return ['png'] + converter.keys()


def convert(filename):
    '''
   Convert the named file into a png file.
   Returns the name of the created file.
예제 #9
0
   return convert

if matplotlib.checkdep_ghostscript() is not None:
    if sys.platform == 'win32':
        gs = 'gswin32c'
    else:
        gs = 'gs'

    cmd = lambda old, new: \
        [gs, '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
        '-sOutputFile=' + new, old]
    converter['pdf'] = make_external_conversion_command(cmd)
    converter['eps'] = make_external_conversion_command(cmd)

if matplotlib.checkdep_inkscape() is not None:
   cmd = lambda old, new: \
             ['inkscape', '-z', old, '--export-png', new]
   converter['svg'] = make_external_conversion_command(cmd)

def comparable_formats():
   '''Returns the list of file formats that compare_images can compare
   on this system.'''
   return ['png'] + converter.keys()

def convert(filename, cache):
   '''
   Convert the named file into a png file.  Returns the name of the
   created file.

   If *cache* is True, the result of the conversion is cached in
예제 #10
0
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        converter['pdf'] = converter['eps'] = _GSConverter()
    if matplotlib.checkdep_inkscape() is not None:
        converter['svg'] = _SVGConverter()
예제 #11
0
def _update_converter():
    gs, gs_v = matplotlib.checkdep_ghostscript()
    if gs_v is not None:
        converter['pdf'] = converter['eps'] = _GSConverter()
    if matplotlib.checkdep_inkscape() is not None:
        converter['svg'] = _SVGConverter()