本文整理汇总了Python中file.File.rotation_tag方法的典型用法代码示例。如果您正苦于以下问题:Python File.rotation_tag方法的具体用法?Python File.rotation_tag怎么用?Python File.rotation_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file.File
的用法示例。
在下文中一共展示了File.rotation_tag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_it_should_tell_the_truth_about_MP4_files
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import rotation_tag [as 别名]
def test_it_should_tell_the_truth_about_MP4_files(self):
test_file = File('/path/to/file.MP4')
self.assertFalse(test_file.is_image())
self.assertTrue(test_file.is_video())
self.assertEqual(test_file.filename(), '/path/to/file.MP4')
self.assertEqual(test_file.ext(), '.mp4')
self.assertEqual(test_file.media_type(), 'MP4')
self.assertEqual(test_file.date_taken_tag(), 'QuickTime:CreateDate')
self.assertEqual(test_file.rotation_tag(), 'Composite:Rotation')
示例2: test_it_should_tell_the_truth_about_MTS_files
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import rotation_tag [as 别名]
def test_it_should_tell_the_truth_about_MTS_files(self):
test_file = File('/path/to/file.MTS')
self.assertFalse(test_file.is_image())
self.assertTrue(test_file.is_video())
self.assertEqual(test_file.filename(), '/path/to/file.MTS')
self.assertEqual(test_file.ext(), '.mts')
self.assertEqual(test_file.media_type(), 'MTS')
self.assertEqual(test_file.date_taken_tag(), 'H264:DateTimeOriginal')
self.assertEqual(test_file.rotation_tag(), 'Composite:Rotation')
示例3: test_it_should_tell_the_truth_about_JPEG_files
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import rotation_tag [as 别名]
def test_it_should_tell_the_truth_about_JPEG_files(self):
test_file = File('/path/to/file.JPEG')
self.assertTrue(test_file.is_image())
self.assertFalse(test_file.is_video())
self.assertEqual(test_file.filename(), '/path/to/file.JPEG')
self.assertEqual(test_file.ext(), '.jpeg')
self.assertEqual(test_file.media_type(), 'JPEG')
self.assertEqual(test_file.date_taken_tag(), 'EXIF:DateTimeOriginal')
self.assertEqual(test_file.rotation_tag(), 'EXIF:Orientation')
示例4: get_rotation
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import rotation_tag [as 别名]
def get_rotation(self, path_to_file):
metadata = {}
with exiftool.ExifTool() as et:
metadata = et.get_metadata(path_to_file)
f = File(path_to_file)
tag = f.rotation_tag()
if tag not in metadata:
return 0
return int(metadata[tag])
示例5: set_rotation
# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import rotation_tag [as 别名]
def set_rotation(self, path_to_file, new_rotation):
f = File(path_to_file)
with exiftool.ExifTool() as et:
et.execute('-' + f.rotation_tag() + '=' + str(new_rotation), '-n',
OVERWRITE_ORIGINAL, path_to_file)