示例#1
0
#!/usr/bin/python3

import sys
import pyvips

pyvips.leak_set(True)
pyvips.cache_set_max(0)

for i in range(1000):
    print("loop {0} ...".format(i))
    im = pyvips.Image.new_from_file(sys.argv[1])
    im = im.embed(100, 100, 3000, 3000, extend="mirror")
    im.write_to_file("x.v")
示例#2
0
文件: vips.py 项目: homm/pillow-perf
# coding: utf-8

from __future__ import print_function, unicode_literals, absolute_import

import os

import pyvips
from pyvips import Image, Interpolate, at_least_libvips

from .base import BaseTestCase

# Make VIPS single threaded like other libraries are.
os.environ['VIPS_CONCURRENCY'] = '1'

pyvips.cache_set_max(0)


class VipsTestCase(BaseTestCase):
    @classmethod
    def resize(cls, im, *args, **kwargs):
        kernel = kwargs.pop('kernel', 'cubic')
        if at_least_libvips(8, 3):
            # resize with kernel added in 8.3
            kwargs['kernel'] = kernel
        else:
            kwargs['interpolate'] = Interpolate.new('bi' + kernel)

        return im.resize(*args, **kwargs)