本文整理汇总了Python中wand.image.Image.background_color方法的典型用法代码示例。如果您正苦于以下问题:Python Image.background_color方法的具体用法?Python Image.background_color怎么用?Python Image.background_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wand.image.Image
的用法示例。
在下文中一共展示了Image.background_color方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _pdf_thumbnail
# 需要导入模块: from wand.image import Image [as 别名]
# 或者: from wand.image.Image import background_color [as 别名]
def _pdf_thumbnail(filename):
img = WandImage(filename=filename + '[0]')
img.background_color = Color('white')
tw, th = get_thumbnail_size(img.height, img.width, 50, 50)
img.resize(tw, th)
rawData = img.make_blob('jpeg')
return base64.b64encode(rawData)
示例2: pdf2image
# 需要导入模块: from wand.image import Image [as 别名]
# 或者: from wand.image.Image import background_color [as 别名]
def pdf2image(self,dest_width, dest_height):
RESOLUTION = 300
#blob = self.datas.decode('base64')
#raise Warning(self.base64_decode(self.datas))
#str = self.datas + '=' *(-len(self.datas)%4)
#img = Image(blob=self[0].datas.decode('base64'))
#img.resize(dest_width,dest_height)
#~ self[0].image = img.make_blob(format='jpg').encode('base64')
img = Image(blob=self[0].datas.decode('base64'),resolution=(RESOLUTION,RESOLUTION))
img.background_color = Color('white')
self[0].image = img.make_blob(format='jpg').encode('base64')
示例3: Image
# 需要导入模块: from wand.image import Image [as 别名]
# 或者: from wand.image.Image import background_color [as 别名]
pages = 1
image = Image(
width = imageFromPdf.width,
height = imageFromPdf.height*pages
)
for i in range(pages):
image.composite(
imageFromPdf.sequence[i],
top = imageFromPdf.height * i,
left = 0
)
image.resize(250,250)
image.alpha_channel = False
image.format = 'png'
print(image.size)
image.background_color = Color('pink')
image.type = 'grayscale'
image.caption = file.split('.')[0]
image.save(filename = fileDirectory+file.split('.')[0]+".png")
image.clear()
image.close()
#display(image)