Download src/utils.py from Fynd/cloth-vton: direct link, hf CLI and curl.
- Browser
- Download file 483 Bytes
-
https://huggingface.co/Fynd/cloth-vton/resolve/main/src/utils.py
- Command line
-
hf download hf://Fynd/cloth-vton/src/utils.py
-
curl -L -o utils.py https://huggingface.co/Fynd/cloth-vton/resolve/main/src/utils.py
483 Bytes
| def crop_to_multiple_of_16(img): | |
| width, height = img.size | |
| # Calculate new dimensions that are multiples of 8 | |
| new_width = width - (width % 16) | |
| new_height = height - (height % 16) | |
| # Calculate crop box coordinates | |
| left = (width - new_width) // 2 | |
| top = (height - new_height) // 2 | |
| right = left + new_width | |
| bottom = top + new_height | |
| # Crop the image | |
| cropped_img = img.crop((left, top, right, bottom)) | |
| return cropped_img |