MCPcopy Index your code
hub / github.com/diffgram/diffgram / new_thumb_image_from_frame

Method new_thumb_image_from_frame

shared/instance_tools.py:38–68  ·  view source on GitHub ↗
(
			self, 
			session,
			video,
			instance)

Source from the content-addressed store, hash-verified

36
37
38 def new_thumb_image_from_frame(
39 self,
40 session,
41 video,
42 instance):
43
44 # new
45 if video.root_blob_path_to_frames:
46 root_path = video.root_blob_path_to_frames
47 # assumed to have trailing "/"
48
49 blob_path = root_path + str(instance.frame_number)
50
51 # migration
52 else:
53 if not instance.file.image:
54 return False
55
56 blob_path = self.get_migration_path(
57 project = instance.file.project,
58 image = instance.file.image)
59
60 image_np = data_tools.get_image(blob_path)
61
62 cropped_image = self.crop_image(image_np, instance)
63 if cropped_image is False:
64 return False
65
66 self.upload(session, instance, cropped_image)
67
68 return True
69
70
71 def get_migration_path(self, project, image):

Callers 1

Calls 4

get_migration_pathMethod · 0.95
crop_imageMethod · 0.95
uploadMethod · 0.95
get_imageMethod · 0.45

Tested by

no test coverage detected