예제 #1
0
    def testJPG(self):
        with open("./input/test_core_gridcrop_grid.jpg", "r") as fp:
            data = fp.read()

        datas = grid_crop(data, 2, 1024, 256, Format.JPG)
        self.assertEqual(len(datas), 4)

        for (x, y), d in datas.iteritems():
            with open(os.path.join(r"./output/TestGridCropBuffered", "%d-%d.jpg" % (x + 1, y + 1)), "wb") as fp:
                fp.write(d)
예제 #2
0
    def testPNG(self):
        with open("./input/test_core_gridcrop_grid.png", "r") as fp:
            data = fp.read()

        datas = grid_crop(data, 4, 1024, 0, Format.PNG)
        self.assertEqual(len(datas), 16)

        for (x, y), d in datas.iteritems():
            with open(os.path.join(r"./output/TestGridCrop", "%d-%d.png" % (x, y)), "wb") as fp:
                fp.write(d)