Exemplo n.º 1
0
def thumbnail_wand(filename, size_1, distname, mode='s'):
	from image import SimpImage
	im = SimpImage(filename)
	if mode == 'c':
		ret = im.cropThumbnail(size_1, size_1)
	elif mode == 'w':
		ret = im.thumbnail(size_1, max_width=size_1)
	elif mode == 'h':
		ret = im.thumbnail(size_1, max_height=size_1)
	else:
		ret = im.thumbnail(size_1)

	print "thumbnail {} result: {}".format(size_1, ret)
	if ret:
		ret = im.save(distname)
	del im

	return ret
Exemplo n.º 2
0
def thumbnail_wand(filename, width, height, distname, mode='s'):
	from image import SimpImage
	im = SimpImage(filename)
	if mode == 'c':
		ret = im.cropThumbnail(width, height)
	elif mode == 'w':
		ret = im.thumbnail(width, max_width=width)
	elif mode == 'h':
		ret = im.thumbnail(width, max_height=width)
	else:
		ret = im.thumbnail(width, height)

	print "thumbnail {} {}x{} result: {}".format(mode, width, height, ret)
	if ret:
		ret = im.save(distname)
	del im

	return ret