MCPcopy Create free account
hub / github.com/ChenWu98/agent-attack / resize_image

Function resize_image

agent_attack/attacks/utils.py:66–75  ·  view source on GitHub ↗
(image, size)

Source from the content-addressed store, hash-verified

64
65
66def resize_image(image, size):
67 # Resize such that the largest dimension is `size`
68 width, height = image.size
69 if width > height:
70 new_width = size
71 new_height = int(size * height / width)
72 else:
73 new_height = size
74 new_width = int(size * width / height)
75 return image.resize((new_width, new_height))

Callers 3

clip_attackFunction · 0.90
bimFunction · 0.90
pgdFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected