Esempio n. 1
0
def probe_colorspace():
    paths = [
        "/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_cmyk.tif",
        "/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_grayscale.jpeg",
        "/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_lab.tif",
        "/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_rgb.png",
        "/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_srgb.png",
    ]
    for path in paths:
        wand = _libimg.new_image()
        _libimg.load_image(wand, path)
        _libimg.reset_iterator(wand)
        _libimg.next_image(wand)
        name = path.split('/')[-1]
        print name, '==>', _libimg.get_colorspace(wand)
Esempio n. 2
0
def probe_colorspace():
	paths = [
	"/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_cmyk.tif",
	"/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_grayscale.jpeg",
	"/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_lab.tif",
	"/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_rgb.png",
	"/home/igor/ws4/uniconvertor-2.x/trunk/src/unittests/_libimg_tests/img_data/cs_srgb.png",
		]
	for path in paths:
		wand = _libimg.new_image()
		_libimg.load_image(wand, path)
		_libimg.reset_iterator(wand)
		_libimg.next_image(wand)
		name = path.split('/')[-1]
		print name, '==>', _libimg.get_colorspace(wand)
Esempio n. 3
0
	def test06_number_images(self):
		names = []
		names.append(os.path.join(_pkgdir, 'img_data', '1layer.gif'))
		names.append(os.path.join(_pkgdir, 'img_data', '2layer.gif'))
		names.append(os.path.join(_pkgdir, 'img_data', '3layer.gif'))

		for name in names:
			wand = _libimg.new_image()
			result = _libimg.load_image(wand, name)
			self.assertEqual(1, result)
			num = _libimg.get_number_images(wand)
			self.assertEqual(names.index(name) + 1, num)
Esempio n. 4
0
	def test06_number_images(self):
		names = []
		names.append(os.path.join(_pkgdir, 'img_data', '1layer.gif'))
		names.append(os.path.join(_pkgdir, 'img_data', '2layer.gif'))
		names.append(os.path.join(_pkgdir, 'img_data', '3layer.gif'))

		for name in names:
			wand = _libimg.new_image()
			result = _libimg.load_image(wand, name)
			self.assertEqual(1, result)
			num = _libimg.get_number_images(wand)
			self.assertEqual(names.index(name) + 1, num)
Esempio n. 5
0
	def test07_image_type(self):
		names = []
# 		names.append(['type_bilevel.png', 'BilevelType'])
		names.append(['type_grayscale.png', 'GrayscaleType'])
		names.append(['type_palette.png', 'PaletteType'])
# 		names.append(['type_palettematte.png', 'PaletteMatteType'])
		names.append(['type_truecolor.png', 'TrueColorType'])
		names.append(['type_truecolormatte.png', 'TrueColorMatteType'])
		names.append(['type_cmyk.tif', 'ColorSeparationType'])
		names.append(['type_cmyka.tif', 'ColorSeparationMatteType'])

		for name in names:
			wand = _libimg.new_image()
			path = os.path.join(_pkgdir, 'img_data', name[0])
			result = _libimg.load_image(wand, path)
			self.assertEqual(1, result)
			_libimg.reset_iterator(wand)
			_libimg.next_image(wand)
			self.assertEqual(name[1], _libimg.get_image_type(wand))
Esempio n. 6
0
	def test05_write_image(self):
		filepath = os.path.join(_pkgdir, 'img_data', 'white_100x100.png')

		names = []
		names.append(os.path.join(_pkgdir, 'img_data', 'white.png'))
		names.append(os.path.join(_pkgdir, 'img_data', 'white.tif'))
		names.append(os.path.join(_pkgdir, 'img_data', 'white.jpg'))

		wand = _libimg.new_image()
		result = _libimg.load_image(wand, filepath)
		self.assertEqual(1, result)

		for name in names:
			result = _libimg.write_image(wand, name)
			self.assertEqual(1, result)
			if os.path.isfile(name):
				os.remove(name)
			else:
				self.fail()
Esempio n. 7
0
	def test07_image_type(self):
		names = []
		names.append(['type_bilevel.png', 'BilevelType'])
		names.append(['type_grayscale.png', 'GrayscaleType'])
		names.append(['type_palette.png', 'PaletteType'])
		names.append(['type_palettematte.png', 'PaletteMatteType'])
		names.append(['type_truecolor.png', 'TrueColorType'])
		names.append(['type_truecolormatte.png', 'TrueColorMatteType'])
		names.append(['type_cmyk.tif', 'ColorSeparationType'])
		names.append(['type_cmyka.tif', 'ColorSeparationMatteType'])

		for name in names:
			wand = _libimg.new_image()
			path = os.path.join(_pkgdir, 'img_data', name[0])
			result = _libimg.load_image(wand, path)
			self.assertEqual(1, result)
			_libimg.reset_iterator(wand)
			_libimg.next_image(wand)
			self.assertEqual(name[1], _libimg.get_image_type(wand))
Esempio n. 8
0
	def test05_write_image(self):
		filepath = os.path.join(_pkgdir, 'img_data', 'white_100x100.png')

		names = []
		names.append(os.path.join(_pkgdir, 'img_data', 'white.png'))
		names.append(os.path.join(_pkgdir, 'img_data', 'white.tif'))
		names.append(os.path.join(_pkgdir, 'img_data', 'white.jpg'))

		wand = _libimg.new_image()
		result = _libimg.load_image(wand, filepath)
		self.assertEqual(1, result)

		for name in names:
			result = _libimg.write_image(wand, name)
			self.assertEqual(1, result)
			if os.path.isfile(name):
				os.remove(name)
			else:
				self.fail()
Esempio n. 9
0
	def test04_load_wrong_image(self):
		filepath = os.path.join(_pkgdir, 'img_data', 'wrong_imape.png')
		wand = _libimg.new_image()
		self.assertEqual(0, _libimg.load_image(wand, filepath))
Esempio n. 10
0
	def test03_load_nonexist_image(self):
		wrong_filepath = os.path.join(_pkgdir, 'img_data', 'white_100.png')
		wand = _libimg.new_image()
		self.assertEqual(0, _libimg.load_image(wand, wrong_filepath))
Esempio n. 11
0
	def test02_load_image(self):
		filepath = os.path.join(_pkgdir, 'img_data', 'white_100x100.png')
		wand = _libimg.new_image()
		self.assertEqual(1, _libimg.load_image(wand, filepath))
Esempio n. 12
0
def probe_number_images():
    filepath = os.path.join(_pkgdir, '3layer.gif')
    wand = _libimg.new_image()
    _libimg.load_image(wand, filepath)
    print _libimg.get_number_images(wand)
Esempio n. 13
0
	def test04_load_wrong_image(self):
		filepath = os.path.join(_pkgdir, 'img_data', 'wrong_imape.png')
		wand = _libimg.new_image()
		self.assertEqual(0, _libimg.load_image(wand, filepath))
Esempio n. 14
0
	def test03_load_nonexist_image(self):
		wrong_filepath = os.path.join(_pkgdir, 'img_data', 'white_100.png')
		wand = _libimg.new_image()
		self.assertEqual(0, _libimg.load_image(wand, wrong_filepath))
Esempio n. 15
0
	def test02_load_image(self):
		filepath = os.path.join(_pkgdir, 'img_data', 'white_100x100.png')
		wand = _libimg.new_image()
		self.assertEqual(1, _libimg.load_image(wand, filepath))
Esempio n. 16
0
def probe_number_images():
	filepath = os.path.join(_pkgdir, '3layer.gif')
	wand = _libimg.new_image()
	_libimg.load_image(wand, filepath)
	print _libimg.get_number_images(wand)