示例#1
0
    def test_convert_to_grayscale_should_update_image(self):
        engine = Engine(self.context)
        with open(join(STORAGE_PATH, 'animated.gif'), 'rb') as im:
            buffer = im.read()

        engine.load(buffer, '.gif')
        buffer = engine.read()
        engine.convert_to_grayscale()

        expect(buffer).not_to_equal(engine.read())
示例#2
0
    def test_convert_to_grayscale_should_update_image(self):
        engine = Engine(self.context)
        with open(join(STORAGE_PATH, "animated.gif"), "rb") as image_file:
            buffer = image_file.read()

        engine.load(buffer, ".gif")
        buffer = engine.read()
        engine.convert_to_grayscale()

        expect(buffer).not_to_equal(engine.read())
示例#3
0
    def test_convert_to_grayscale_should_update_image(self):
        engine = Engine(self.context)
        with open(join(STORAGE_PATH, 'animated.gif'), 'r') as im:
            buffer = im.read()

        engine.load(buffer, '.gif')
        buffer = engine.read()
        engine.convert_to_grayscale()

        expect(buffer).not_to_equal(engine.read())
示例#4
0
        def topic(self):
            config = Config()
            server = ServerParameters(
                8889, 'localhost', 'thumbor.conf', None, 'info', None
            )

            context = Context(server, config, Importer(config))
            context.server.gifsicle_path = which('gifsicle')

            context.request = RequestParameters()

            with open("%s/animated_image.gif" % FIXTURES_FOLDER, "rb") as f:
                buffer = f.read()

            engine = GifEngine(context=context)
            engine.load(buffer, '.gif')

            return engine.read()