MCPcopy Create free account
hub / github.com/chenfei-wu/TaskMatrix / resize_image

Method resize_image

visual_chatgpt.py:1233–1238  ·  view source on GitHub ↗
(self, image, max_size=1000000, multiple=8)

Source from the content-addressed store, hash-verified

1231 return caption
1232
1233 def resize_image(self, image, max_size=1000000, multiple=8):
1234 aspect_ratio = image.size[0] / image.size[1]
1235 new_width = int(math.sqrt(max_size * aspect_ratio))
1236 new_height = int(new_width / aspect_ratio)
1237 new_width, new_height = new_width - (new_width % multiple), new_height - (new_height % multiple)
1238 return image.resize((new_width, new_height))
1239
1240 def dowhile(self, original_img, tosize, expand_ratio, imagine, usr_prompt):
1241 old_img = original_img

Callers 1

dowhileMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected