本文整理汇总了Python中pgmagick.Image.orientation方法的典型用法代码示例。如果您正苦于以下问题:Python Image.orientation方法的具体用法?Python Image.orientation怎么用?Python Image.orientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pgmagick.Image
的用法示例。
在下文中一共展示了Image.orientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_image
# 需要导入模块: from pgmagick import Image [as 别名]
# 或者: from pgmagick.Image import orientation [as 别名]
def get_image(self, source):
blob = Blob()
blob.update(source.read())
image = Image(blob)
orientation = image.orientation()
if orientation in (OrientationType.UndefinedOrientation,
OrientationType.TopLeftOrientation):
pass
elif orientation == OrientationType.TopRightOrientation:
image.flop()
elif orientation == OrientationType.BottomRightOrientation:
image.rotate(180.)
elif orientation == OrientationType.BottomLeftOrientation:
image.flip()
elif orientation == OrientationType.LeftTopOrientation:
image.rotate(90.).flip()
elif orientation == OrientationType.RightTopOrientation:
image.rotate(90.)
elif orientation == OrientationType.RightBottomOrientation:
image.rotate(90.).flop()
elif orientation == OrientationType.LeftBottomOrientation:
image.rotate(270.)
image.orientation(OrientationType.TopLeftOrientation)
return image