本文整理汇总了Python中PythonMagick.Image.quality方法的典型用法代码示例。如果您正苦于以下问题:Python Image.quality方法的具体用法?Python Image.quality怎么用?Python Image.quality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PythonMagick.Image
的用法示例。
在下文中一共展示了Image.quality方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pdf2images
# 需要导入模块: from PythonMagick import Image [as 别名]
# 或者: from PythonMagick.Image import quality [as 别名]
def pdf2images(name):
np = getPdfNumPages(name)
for p in range(np):
i = Image()
i.density('200')
i.quality(100)
i.depth(24)
#i.backgroundColor(
#i.channel(
i.read(name + '[' + str(p) + ']')
i.write(name + str(p) + defaultImageExtension)
示例2: convert_photo_to_jpeg
# 需要导入模块: from PythonMagick import Image [as 别名]
# 或者: from PythonMagick.Image import quality [as 别名]
def convert_photo_to_jpeg(photo_path):
print 'Converting %s to JPEG...' % (photo_path,)
image = Image(photo_path)
image.magick("jpeg")
image.quality(100)
(_, file_name) = os.path.split(photo_path)
file_name = convert_local_filename_to_flickr(file_name)
file_name = os.path.join(tempfile.mkdtemp('.flickrsmartsync'), file_name)
image.write(file_name)
print 'Done converting photo!'
return file_name
示例3: pad_image_to_x480
# 需要导入模块: from PythonMagick import Image [as 别名]
# 或者: from PythonMagick.Image import quality [as 别名]
def pad_image_to_x480(file):
from PythonMagick import Image, CompositeOperator
fname = file.split(".")[0]
ext = file.split(".")[-1]
outfile = os.path.join(destdir, fname + "_" + "l" + ".jpg")
## Make BG layer
bgimg = Image('400x480', 'white')
## Open Primary image
img = Image(file)
img.backgroundColor("white")
img.sample('350x432')
# Composite + Save Primary over bg, padding primary with white of bg
type = img.type
img.composite(bgimg, 0, 0, CompositeOperator.DstOverCompositeOp)
img.magick('JPG')
img.type = type
img.quality(100)
img.write(outfile)