示例#1
0
文件: all.py 项目: ppawlak/pystacia
def closeup(f=None, factor=4):
    image = lena()
    image.resize(32, 32, 256, 256)

    if f:
        f(image)

    image.rescale(factor=factor, filter=filters.point)

    return image
示例#2
0
文件: all.py 项目: ppawlak/pystacia
def closeup(f=None, factor=4):
    image = lena()
    image.resize(32, 32, 256, 256)

    if f:
        f(image)

    image.rescale(factor=factor, filter=filters.point)

    return image
示例#3
0
    def test(self):
        import pystacia
        from pystacia import image

        with catch_warnings(record=True) as w:
            simplefilter('always')

            self.assertTrue(
                image.blank(30, 30).is_same(pystacia.blank(30, 30)))

            self.assertTrue('blank' in w[-1].message.args[0])

            if lena_available():
                self.assertTrue(image.lena().is_same(pystacia.lena()))
                self.assertTrue('lena' in w[-1].message.args[0])

            tmpname = mkstemp()[1] + '.bmp'
            img = sample()
            img.write(tmpname)

            self.assertTrue(
                pystacia.read(tmpname).is_same(image.read(tmpname)))
            self.assertTrue('read' in w[-1].message.args[0])

            self.assertTrue(
                pystacia.read_blob(img.get_blob('bmp')).is_same(
                    image.read_blob(img.get_blob('bmp'))))

            self.assertTrue(
                pystacia.read_raw(**img.get_raw('rgb')).is_same(
                    image.read_raw(**img.get_raw('rgb'))))

            img.close()

            for symbol in [
                    'magick_logo', 'wizard', 'netscape', 'granite', 'rose'
            ]:
                self.assertTrue(
                    getattr(image,
                            symbol)().is_same(getattr(pystacia, symbol)()))
                self.assertTrue(symbol in w[-1].message.args[0])

            self.assertIsInstance(pystacia.Image(), image.Image)

            names = [
                'composites', 'types', 'filters', 'colorspaces',
                'compressions', 'axes'
            ]
            for name in names:
                self.assertEqual(
                    getattr(pystacia, name).x,
                    getattr(image, name).x)
                self.assertTrue(name in w[-1].message.args[0])
示例#4
0
    def test(self):
        import pystacia
        from pystacia import image

        with catch_warnings(record=True) as w:
            simplefilter('always')

            self.assertTrue(image.blank(30, 30).
                            is_same(pystacia.blank(30, 30)))

            self.assertTrue('blank' in w[-1].message.args[0])

            if lena_available():
                self.assertTrue(image.lena().is_same(pystacia.lena()))
                self.assertTrue('lena' in w[-1].message.args[0])

            tmpname = mkstemp()[1] + '.bmp'
            img = sample()
            img.write(tmpname)

            self.assertTrue(pystacia.read(tmpname).
                            is_same(image.read(tmpname)))
            self.assertTrue('read' in w[-1].message.args[0])

            self.assertTrue(pystacia.read_blob(img.get_blob('bmp')).
                            is_same(image.read_blob(img.get_blob('bmp'))))

            self.assertTrue(pystacia.read_raw(**img.get_raw('rgb')).
                            is_same(image.read_raw(**img.get_raw('rgb'))))

            img.close()

            for symbol in ['magick_logo', 'wizard',
                           'netscape', 'granite', 'rose']:
                self.assertTrue(getattr(image, symbol)().
                                is_same(getattr(pystacia, symbol)()))
                self.assertTrue(symbol in w[-1].message.args[0])

            self.assertIsInstance(pystacia.Image(), image.Image)

            names = ['composites', 'types', 'filters', 'colorspaces',
                     'compressions', 'axes']
            for name in names:
                self.assertEqual(getattr(pystacia, name).x,
                                 getattr(image, name).x)
                self.assertTrue(name in w[-1].message.args[0])
示例#5
0
from os.path import join, dirname

from pystacia import lena, filters

dest = join(dirname(__file__), '../_static/generated')

from all import closeup

image = lena()

image.rescale(256, 256)

image.write(join(dest, 'lena_rescale_256.jpg'))

image.rescale(100, 200)

image.write(join(dest, 'lena_rescale_300.jpg'))

image.rescale(128, 128)

image.write(join(dest, 'lena_rescale_128.jpg'))

image.close()

image = lena(256)

image.rescale(factor=0.75)

image.write(join(dest, 'lena_rescale_f0.75.jpg'))

image.rescale(factor=(0.6, 0.5))
示例#6
0
from os.path import join, dirname

from pystacia import lena

dest = join(dirname(__file__), '../_static/generated')

image = lena(256)
image.equalize()
image.write(join(dest, 'lena_equalize.jpg'))
image.close()
示例#7
0
from os.path import join, dirname

from pystacia import lena, axes

dest = join(dirname(__file__), '../_static/generated')

image = lena(128)
image.skew(10, axes.x)
image.checkerboard()
image.write(join(dest, 'lena_skewx10.jpg'))
image.close()

image = lena(128)
image.skew(-5, axes.x)
image.checkerboard()
image.write(join(dest, 'lena_skewx-5.jpg'))
image.close()

image = lena(128)
image.skew(20, axes.y)
image.checkerboard()
image.write(join(dest, 'lena_skewy20.jpg'))
image.close()
示例#8
0
文件: all.py 项目: ppawlak/pystacia
from os.path import dirname, join

from pystacia import (lena, magick_logo, rose, wizard, granite, netscape,
                      filters)

dest = join(dirname(__file__), '../_static/generated')

image = lena(256)
image.write(join(dest, 'lena.jpg'))
image.close()

image = lena(128)
image.write(join(dest, 'lena128.jpg'))
image.close()

image = magick_logo()
image.write(join(dest, 'magick_logo.jpg'))
image.close()

image = rose()
image.write(join(dest, 'rose.jpg'))
image.close()

image = wizard()
image.write(join(dest, 'wizard.jpg'))
image.close()

image = granite()
image.write(join(dest, 'granite.jpg'))
image.close()
示例#9
0
文件: all.py 项目: ppawlak/pystacia
from os.path import dirname, join

from pystacia import (
    lena, magick_logo, rose, wizard, granite, netscape, filters)

dest = join(dirname(__file__), '../_static/generated')

image = lena(256)
image.write(join(dest, 'lena.jpg'))
image.close()

image = lena(128)
image.write(join(dest, 'lena128.jpg'))
image.close()

image = magick_logo()
image.write(join(dest, 'magick_logo.jpg'))
image.close()

image = rose()
image.write(join(dest, 'rose.jpg'))
image.close()

image = wizard()
image.write(join(dest, 'wizard.jpg'))
image.close()

image = granite()
image.write(join(dest, 'granite.jpg'))
image.close()
示例#10
0
from os.path import join, dirname

from pystacia import lena, composites

dest = join(dirname(__file__), '../_static/generated')

overlay = lena(64)

image = lena(128)
image.overlay(overlay, 32, 32)
image.write(join(dest, 'lena_overlay1.jpg'))
image.close()

image = lena(128)
image.overlay(overlay, 32, 32, composites.colorize)
image.write(join(dest, 'lena_overlay2.jpg'))
image.close()

image = lena(128)
image.overlay(overlay, 32, 32, composites.multiply)
image.write(join(dest, 'lena_overlay3.jpg'))
image.close()

image = lena(128)
image.overlay(overlay, 32, 32, composites.overlay)
image.write(join(dest, 'lena_overlay4.jpg'))
image.close()


image = lena(128)
image.overlay(overlay, 32, 32, composites.pin_light)
示例#11
0
from os.path import join, dirname

from pystacia import lena, composites

dest = join(dirname(__file__), '../_static/generated')

overlay = lena(64)

image = lena(128)
image.overlay(overlay, 32, 32)
image.write(join(dest, 'lena_overlay1.jpg'))
image.close()

image = lena(128)
image.overlay(overlay, 32, 32, composites.colorize)
image.write(join(dest, 'lena_overlay2.jpg'))
image.close()

image = lena(128)
image.overlay(overlay, 32, 32, composites.multiply)
image.write(join(dest, 'lena_overlay3.jpg'))
image.close()

image = lena(128)
image.overlay(overlay, 32, 32, composites.overlay)
image.write(join(dest, 'lena_overlay4.jpg'))
image.close()

image = lena(128)
image.overlay(overlay, 32, 32, composites.pin_light)
image.write(join(dest, 'lena_overlay5.jpg'))